pop up description layer
Last modified: 20070830:100745/initial version

FIT2022 AJH-2007-20

Tutorial 5

Objectives and Outcomes | The Exam Questions Basics | Lab 5: Process Scheduling | Any Other Issues

1. Objectives and Outcomes

1.1 Objectives

  1. To prepare for Lab 5 (Unit Objectives 1, 4, 5, 6b, 7 )
  2. To explore some problems in memory management and virtual memory

1.2 Outcomes

  1. A clear understanding of what lab 5 is about
  2. Techniques for solving typical problems in ...

2. The Exam Questions Basics

  1. The coroutine. Write a program to read 80 column cards and print them on 125 character lines, with the following changes. After every card image, an extra blank is inserted, and every adjacent pair of asterisks (**) on a card is replaced by the single character ^.

    1. Try writing this as an ordinary sequential program (in pseudo-code).
    2. Try writing it as suite of coroutines: read, print and squash, where squash is responsible for converting the ** characters to ^. Assume a statement resume name which is like a subroutine return, but returns to the named (co)routine, rather than the actual caller.
    3. Try writing it a set of three processes using semaphores.

  2. Is busy waiting always less efficient (in terms of using processor time) than a blocking wait? Explain.

  3. Consider the following attempt at a critical section algorithm.

              blocked = [false,false]          turn = 0          class P(Thread):              global blocked,turn              def __init__(self,id): self.id = id              while true:                  # entry code                  blocked[self.id] = true                  while turn != self.id:                      while blocked[1-self.id]                          turn = self.id                  # end entry code                  # critical section                  # exit code                  blocked[self.id] = false                  # end exit code          p0 = P(0); p1 = P(1); p0.start(); p1.start();        

    Explain why the algorithm fails. (This was published in the Communications of the ACM as a correct solution! If you can see why it fails, you are one up on the editors of that august journal!

  4. Jurassic Park consists of a dinosaur museum and a park for safari riding. There are m passengers and n single-passengers cars. Passengers wander around the museum for a while, then line up to take a ride in a safari car. When a car is available, it loads the one passenger it can hold and rides around the park for a random amount of time. If the n cars are all out riding passengers around, then a passenger who wants to ride waits: if a car is ready to load but there are no waiting passengers, then the car waits. Use semaphores to synchronize the m passengers and the n car processes.

3. Lab 5: Process Scheduling

(From the Lab5 lab sheet: read this and discuss any aspects that you find unclear.)

(20070830:101603) Note that this is not yet available ...

4. Any Other Issues

Are there any other issues you would like to discuss?


Document History

20070830:100745 1.0.0 ajh initial version

This page maintained by John Hurst.
Copyright Monash University Copyright Policy
1610 accesses since
10 Sep 2007
My PhotoTrain Photo

Generated at 20090706:1915 from an XML file modified on 20070910:1307
Maintainer use only; not generally accessible: Local ServerWork ServerCSSE Server

2093 accesses since 10 Sep 2007, HTML cache rendered at 20120213:1948