Lab on Deadlock and Starvation
Lab on Deadlock and Starvation
Goals: This lab provides practice considering alternative
approaches to avoid deadlock and starvation when writing programs involving
multiple processes.
Resources:
-
Textbook, exercise 6.14
-
Handout with problems about a roller coaster, baboons crossing a canyon,
and a fraternity/sorority party.
Steps for this Lab:
-
Working in groups of 2 or 3, write out answers to exercise 6.14 (a and b)
from the textbook. Then identify at least one way to modify the proposed
solution to the Dining Philosophers Problem which prevents both deadlock
and starvation. Your solution also should allow multiple philosophers to
eat concurrently (at least some times), assuming that there are more than 3
philosophers altogether.
-
Still working in groups, outline a solution to the Fraternity/Sorority
Party problem. In particular, identify any needed semaphores and shared
variables, and write pseudo-code to show which processes will access which
of these resources when.
Work to be turned in:
-
Written answer to step 1. Note, however, that you do not need
to write a working C program for this lab.
This document is available on the World Wide Web as
http://www.math.grin.edu/~walker/courses/213.fa98/lab-deadlock.html
created October 27, 1998
last revised October 28, 1998