- Click the START button to initialize and set the philosopher state to thinking.
- Now, change the philosopher's state by clicking on any philosopher (P0, P1, P2, P3, P4) in the action container.
- Clicking on a philosopher (Pi) for the first time will initiate the process of picking up its left chopstick (Ci-1).
- On the second click, the philosopher (Pi) will pick up its right chopstick (Ci).
- On the third click, the philosopher (Pi) will start eating.
- On the fourth click, the philosopher (Pi) will stop eating and will free both chopsticks (Ci-1 & Ci).
- Randomly click on any philosopher and try to understand the problem.
- After every click, observe the changes in the State Table, State Array and Code section.
- To get the solution of this problem, click on NEXT button.
NOTE 1:When a philosopher (Pi) is eating, this state is reflected as 0 in the Philosopher Array.
NOTE 2: To understand the instructions in the code, hover over the line.
NOTE 3: Read all the alerts carefully.