0% found this document useful (0 votes)
21 views

OS Initial Script

The document discusses the classic dining philosophers problem which involves resource allocation and synchronization issues. It describes the problem where 5 philosophers alternate between thinking and eating but must acquire both forks to eat, which can lead to deadlocks. It then explains some famous solutions to this problem like Djikstra's priority-based approach, arbitrator-based solutions, limiting the number of eating philosophers, and Chandy-Mishra's communicating philosophers approach.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

OS Initial Script

The document discusses the classic dining philosophers problem which involves resource allocation and synchronization issues. It describes the problem where 5 philosophers alternate between thinking and eating but must acquire both forks to eat, which can lead to deadlocks. It then explains some famous solutions to this problem like Djikstra's priority-based approach, arbitrator-based solutions, limiting the number of eating philosophers, and Chandy-Mishra's communicating philosophers approach.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Good day, my name is Riccardo Di Silvio Maury and today I’m going to be talking about a

classic synchronization problem, the dining philosopher problem.


This problem was first created by Djikstra (the same person who made the graph algorithm,
curiously) in his university classroom to teach about resource allocation and deadlocking.
The problem goes like this: There are 5 philosophers who must alternate between thinking and
eating. There is a fork between each pair of philosophers. To eat, a philosopher must use both
adjacent forks and when he is done eating, he lets go of both. Additionally, philosophers cannot
communicate.
This problem highlights 2 major difficulties when dealing with synchronization: deadlocking and
mutual exclusion. Because a philosopher must use both forks in order to eat, both adjacent
philosophers cannot themselves eat. To make a solution “fair” any algorithm must ensure that all
philosophers eventually eat. We can see that these two necessities contradict each other, which is
why mutual exclusion makes creating a solution harder. Deadlocking can also happen when no
progress can be made due to the current state of the problem. Let’s say somehow all philosophers
picked up their left fork. That means every other philosopher’s right fork is missing, therefore
they will infinitely wait for it, which will stop any progress.
Avoiding these two problems is key to developing any satisfactory solution.
The most famous solutions are:
Djikstra’s: In it, forks are given priority numbers, and any philosopher must pick forks with the
lowest number first. This solution is made to avoid deadlocks since higher numbered forks will
tend to be free, it is impractical because if any lower numbered forks are freed while a
philosopher is holding a higher numbered one, the philosopher must let go of its current one to
pick up the new one. In cases where philosophers must use many forks to eat, or a huge amount
of forks are available, this would make the process incredibly slow.
Arbitrator solutions: In these any philosopher can only pick up both forks at the same time when
available and must ask permission to a secondary centralized arbiter which can analyze the
table’s state.
Limiting diners: In this one, one philosopher must always wait without eating while waiting for
someone else to be done, and the eat accessing their leftover resources. This solution ensures
progress can always be made by at least one philosopher.
Chandy Mishra: This solution breaks the rules to make philosophers able to communicate
through requests for resources. Through a 4 step process, “starving” philosophers are identified
and prioritized. This solution is the most complete one, since it makes sure fairness and progress
are kept.
In conclusion, the dining philosophers problem is a timeless synchronization problem, which can
help understand the key aspects of this field of study such as deadlocking and mutual exclusion,
and through its lenses we can understand the complexity of concurrent, resource-driven
programming

You might also like