pop up description layer
Last modified: 20080903:150246/initial version for 2008

FIT2022 AJH-2008-30

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 scheduling

1.2 Outcomes

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

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 as 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.)

(20080903:150332) Note that this is not yet available ...

4. Any Other Issues

Are there any other issues you would like to discuss?


Document History

20080903:150246 2.0.0 ajh initial version for 2008

This page maintained by John Hurst.
Copyright Monash University Copyright Policy
378 accesses since
03 Sep 2008
My PhotoTrain Photo

Generated at 20090708:1704 from an XML file modified on 20080903:1537
Maintainer use only; not generally accessible: Local ServerWork ServerCSSE Server

745 accesses since 03 Sep 2008, HTML cache rendered at 20120212:1601