#### Programming Assignment 2.

This project is to be done either individually or in pairs. Do not show your code to any other group and do not look at any other group's code. Do not put your code in a public directory or otherwise make it public. However, you may get all the help you need from the TA or the instructor. You are encouraged to use the WebCT Discussions page to post problems so that other students can also see the answers.

Consider the famous Dinning Philosophers problem (Doug Lea's CPJ 2nd ed. pp. 371):  A table holds five (n>1) forks and a bowl of spaghetti. It seats five (n) philosophers, each of whom eats for a while, then thinks for a while, then eats and so on. Each philosopher requires two forks-the ones on the left and right- to eat, but releases them when thinking. The main problem is that without some kind of coordination the philosophers could starve when they pick up their left forks and then block forever trying to pick up the right forks which are being held by other philosophers.

A solution described by Hoare adds the requirement that at most four (n-1) philosophers are allowed to be seated.  This ensures that at all times, at least one philosopher  can eat.  This solution is implemented using JCSP and the programming assignment consists of writing the same solution on PICT.

Here are a list of possible extensions to the project. Completion of one or more of these will result in a better grade; however, groups of more than one person MUST complete at least one of these extensions to receive a full grade. It should also be noted that, if you have an idea for a different extension, ask either the instructor or TA for approval.

• Provide a solution in Nomadic PICT, where the philosopher processes enter the table by actually moving to a computer hosting the dinner party.
• Provide an alternative solution to deadlock, where all philosophers can be on the table at once.
• Prove or disprove that the solution is fair, i.e., all philosophers eventually get to eat.
Grading will be split in the following way:

60% correctness (Does it do what it's supposed to?)
20% error handling (Can it easily be crashed?)
20% documentation (Is it easy to read and understand the code?)

Submission:

The due date for this project is March 18th, 2002, 11:55pm EST.  You should use the assignments drop-off box located at the course's WebCT page.  Upload a file containing all the relevant documented  files, along with a README file containing instructions on running the program.