cmpsc 301 - Csmaster

advertisement
CMPSC 301
Assignments
Classical IPC Problems / Monitors
Spring 2007
HW due Tuesday, Feb. 20:
1. Read pp. 115-119 on Monitors.
2. Submit answers to questions #31, 32 on p. 155 – fix typos in book
3. Run Demo 1, the first simulation of the Dining Philosopher problem found at
http://vip.cs.utsa.edu/simulators/run/spdemos.html. This simulation illustrates how the classical
solution to the problem works, how starvation can occur, and how processes move among monitor
queues. Experiment with changing the speed of the simulation to suit your taste, turning animation
on to make it easier to follow the steps. Run this several times to get familiar with the environment,
and using the hand-outs as a resource, determine what each of the boxes represents in the simulator
diagram. We will work with this and the other demos (2-4) in class on 2/20.
NO CLASS Thursday, Feb. 22
HW due Tuesday, Feb. 27:
1. Submit Problem #50 on p. 157 of your textbook. Use semaphores for synchronization. Display
something like “Male”, “Female” and “Empty” to indicate the state of the bathroom at any given time
– your output must make it clear that at no time will you find members of the opposite sex in the
bathroom together. Use the Readers-Writers solution as a helpful guide.
2. Submit your final solution to the readers-writers problem, using a monitor in BACI (this may have
been finished in lab). A general description of the problem is found on p. 155, problem #33. You
will be working from a shell of a program (rw.cm on csmaster)
3. We will have a test review in class on 2/27.
HW due Thursday, March 1:
Study for TEST 1 – Chapter 1; Sections 2.1 – 2.4 in Chapter 2
Download