| MUSO | About FIT2022 | Assessment | Contacts | Laboratories | Lectures | Resources | Timetables | Tutorials |
| Last modified: 20070830:100745/initial version | FIT2022 AJH-2007-20 |
Objectives and Outcomes | The Exam Questions Basics | Lab 5: Process Scheduling | Any Other Issues
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 ^.
Is busy waiting always less efficient (in terms of using processor time) than a blocking wait? Explain.
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!
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.
(From the Lab5 lab sheet: read this and discuss any aspects that you find unclear.)
(20070830:101603) Note that this is not yet available ...
Are there any other issues you would like to discuss?
| 20070830:100745 | 1.0.0 | ajh | initial version |
| This page maintained by John Hurst. Copyright Monash University Copyright Policy |
| ||
Generated at 20090706:1915 from an XML file modified on 20070910:1307 | |||