The dining philosophers benchmark
The faculty of the College of Philosophy in an old seaside resort city (on the Atlantic coast of the US) has a long-standing tradition of dining together every Sunday night. The food is catered from Mo's Deli, but is always – always – a heaping bowl of spaghetti. No one can remember why, but Mo's a great chef, and each week's spaghetti is a unique experience.
The philosophy department is small, having five tenured faculty members. They're also impoverished and can only afford five forks. Because the dining philosophers each require two forks to enjoy their pasta, they sit around a circular table, so each philosopher has access to two nearby forks.
This requirement for two forks to eat leads to an interesting resource contention problem, shown in the following diagram:
Figure 14.2: The dining philosophers
Ideally, a philosopher, say Philosopher 4, the department chairperson, and an Ontologist,...