Dining Philosophers

Did you know of the dining philosophers’ problem? It’s a classic problem in computer science, where it is used to study the sharing of scarce resources among different processes.

Five philosophers sit around the table, where they think and eat. (Isn’t that what philosophers do?) There is a fork between each philosopher, but each philosopher needs two forks to eat. Forks are picked up one at a time. The problem is to find a way for all philosophers to avoid deadlock (every philosopher has one fork but no one can eat) and consequent starvation. Starvation may also occur without deadlock if one or more philosophers never get to pick up two forks. Don’t you find it reassuring that computer scientists are busy keeping us philosophers alive and thinking?