lab-T-dining - The Dining Philosophers Due March 8 4:59:59...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
The Dining Philosophers Due: March 8 4:59:59 PM Overview In this lab you will implement several variations of the classic "dining philosophers problem" in order to practice your multi-threaded programming skills. As in the classic problem, there are N plates and N chopsticks arranged around a circular table. There are N philosophers, each of whom periodically eats. A philosopher must grab the two chopsticks to the left and right of his/her plate in order to eat. In the new problem, the philosophers have become rather worldly and hired two servants. At the center of the table there is a bowl that holds some servings of rice. One servant occasionally refills the bowl when it is empty. Ocassionally, when the bowl is empty and no one is eating, the other servant gathers up all of the plates, chopsticks, and the bowl, cleans the table, and then returns the plates, chopsticks, and bowl to their places; this cleaning is only done if all philosophers have eaten at least once since the last cleaning (i.e., all plates are dirty.) A philosopher cannot eat if there is no rice to take from the bowl; nor can a philosopher eat while the chopsticks or plates are being cleaned. The filling servant cannot fill if the bowl is being cleaned. The cleaning servant does not clean if anyone is eating, if the bowl has rice in it, or if the bowl is currently being filled. Despite this worldly change, a handful of the pilosophers occasionally reach a state of trancendental bliss during which they can go long periods of time without eating. We model philosophers and servers as threads. We maintain all shared state in a "table "object, and the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 04/05/2010.

Page1 / 3

lab-T-dining - The Dining Philosophers Due March 8 4:59:59...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online