Propose a different solution to the use of traffic lights; they can use pseudocode or some preferred language to present the solution.
The Philosophers' Dinner Problem
Five philosophers sit around a table and spend their lives dining and thinking. Each philosopher has a bowl of noodles and a fork to the left of your plate. To eat the noodles you need two forks and each philosopher you can only take the ones to your left and right. If any philosopher takes a fork and the other is busy, he will wait, fork in hand, until pick up the other fork, so you can start eating later. If two adjacent philosophers try to pick up the same fork at the same time, a race condition: they both compete to take the same fork, and one of them left without eating. If all the philosophers take the fork to their right at the same time, then everyone will be waiting forever, because someone must release the fork that is lack. No one will because everyone is in the same situation (hoping that someone put down their forks). Then the philosophers will starve. This lock mutual is called deadlock or deadlock. The problem is to find an
1) Propose a different solution to the use of traffic lights; they can use pseudocode or some preferred language to present the solution.
Step by step
Solved in 3 steps