This assignment makes use of the files contained in this zip file (or this zip file for Linux or Mac OS X). This assignment is due Tuesday, September 18. (Note: This is an updated due date.) In this assignment you will solve three related synchronization problems using the Pthreads library and condition variables.
In the zip file there is a file The first synchronization pattern puts a bound on the number of threads that can be in the "dining" state. Once the dining capacity is reached, new threads must block until some other threads leave the dining state. The second synchronization pattern is to solve the "sushi problem" as described in "The Little Book of Semaphores". There is a bound on the number of threads that can be in the dining state. In addition, once the bound is reached, new threads are blocked from the dining state until all threads in the dining state exit the dining state. At that point, blocked threads can enter the dining state (up to the bound of the dining state). If the bound on the number of threads in the dining state is not reached, then threads can enter the dining state without blocking. The third synchronization pattern is a variation on the sushi pattern (sometimes called the "art gallery problem"). There is no bound on the number of threads that can be in the dining state. Threads are allowed to enter the dining state only when the number of threads in the dining state goes to zero. At that time, all of the waiting threads (no matter how many there are) are allowed to enter the dining state, and then the dining room is "locked" until the last thread leaves the dining state, and then another group of threads can enter the dining state all together. When the number of threads in the dining state is zero and there is no thread blocked, then the first thread to try to enter the dining state gets in and locks the dining state, so it is in the dining state alone.
In the zip file there are four outlines of the customer thread,
Turn in a zip file containing your implementations of the This assignment is due Tuesday, September 18. |