Premium Only Content
Deadlocks and the Dining Philosophers Problem
In this video we will cover the “Dining Philosophers” problem.
The “Dining Philosophers” problem is an example problem to demonstrate concurrent algorithm design.
A group of philosophers sit around a table and alternate between thinking and eating using the forks on their left and right. The forks represent a shared resource between the pair of philosophers on either side of them. Philosophers need both forks to eat and only one philosopher can use a fork at a time.
If the philosophers were to simply take forks as they needed them a situation could occur where a circle of philosophers are each holding one fork and waiting on another philosopher to give up a fork. This is referred to as a “deadlock”.
A simple solution to this problem is to add a waiter, who represents a lock, that the philosophers need exclusive access to before picking up either of their forks. Once a philosopher has exclusive access to the waiter’s attention they have that attention until the philosopher has successfully picked up both forks. When a philosopher has exclusive access to the waiter they will succeed in picking up their forks either because both forks are available, and no other philosophers have the waiter's attention, or they will wait with the waiter’s attention for the philosophers on either side of them to give up their forks.
This solution of using a central arbitrator to manage access prevents a circular cycle of philosophers holding one fork while waiting on another philosopher for their other fork that causes a deadlock. This solution is fair because all of the philosophers have equal access to the waiter. However, it can be inefficient because philosophers have to wait for the waiter even when both of their forks are available.
Reference:
Dining philosophers image: bdesham - https://commons.wikimedia.org/wiki/File:An_illustration_of_the_dining_philosophers_problem.png
-
LIVE
Redacted News
1 hour agoDeep State Coup Coming for Trump? New JFK Files Released and NATO Preparing Attack on Russia
10,916 watching -
LIVE
Dr Disrespect
6 hours ago🔴LIVE - DR DISRESPECT'S TRIPLE THREAT CHALLENGE - ARC RAIDERS • BF6 • FORTNITE
1,359 watching -
1:00:57
Russell Brand
3 hours agoThe Vaccine Ideology Unmasked | Dr Peter McCullough - SF658
78.1K31 -
1:11:25
vivafrei
2 hours agoKash Patel's Jacket-Gate! Pfizer Whistleblower Qui Tam on Appeal! Meanwhile in Canada! AND MORE!
25.9K21 -
16:30
Clintonjaws
6 hours ago $0.49 earnedEntire Room Speechless as Pete Hegseth Snaps Destroying All Media To Their Face
2.21K5 -
Dad Saves America
2 hours agoHow Greek Philosophers Created Western Civilization: The Death of Debate - Pt 2
14 -
LIVE
LFA TV
19 hours agoLIVE & BREAKING NEWS! | WEDNESDAY 12/03/25
1,319 watching -
1:05:46
The Quartering
3 hours agoNew Epstein Video Drops! The US Economy Has SCARY Numbers Released & More
102K20 -
1:07:11
The White House
6 hours agoPresident Trump Makes an Announcement, Dec. 3, 2025
14.5K15 -
LIVE
Film Threat
22 hours agoINSIDE THE DECLINE OF DISNEY! A WARNING FROM THE PAST | Hollywood on the Rocks
193 watching