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
TheSaltyCracker
34 minutes agoWar Crimes ReeEEStream 12-03-25
7,834 watching -
LIVE
Glenn Greenwald
1 hour agoTrump Administration Claims to Save Hundreds of Millions of Lives by Blowing Up Drug Boats; Ethan Klein's Unhinged Vengeance & Lawsuits Against Other YouTubers: With Taylor Lorenz | SYSTEM UPDATE #553
4,273 watching -
LIVE
Barry Cunningham
2 hours agoLIVE BREAKING NEWS: Erika Kirk and TPUSA Have Had It With Candace Owens | Where Are The Children?
2,217 watching -
LIVE
The Jimmy Dore Show
2 hours agoTrump Pardons DEMOCRAT Henry Cuellar! Candace SHUTS DOWN Zionist Talking Points! w/ Nick Cruse
8,381 watching -
1:05:17
BonginoReport
3 hours agoWhite House Claps Back At Sabrina Carpenter - Nightly Scroll w/ Hayley Caronia (Ep.189)
84.2K14 -
1:06:50
TheCrucible
4 hours agoThe Extravaganza! EP: 69 (12/03/25)
52.4K15 -
1:08:49
Kim Iversen
3 hours agoEpstein Island: What's With The Creepy Medical Chair and Masks?
30.9K30 -
23:54
Jasmin Laine
4 hours agoCarney’s WORST Day EVER—BOOED, Fact-Checked, and Forced to FLEE the House
12.9K13 -
1:59:47
Redacted News
4 hours agoDeep State Coup Coming for Trump? New JFK Files Released and NATO Preparing Attack on Russia
151K92 -
7:31:43
Dr Disrespect
9 hours ago🔴LIVE - DR DISRESPECT'S TRIPLE THREAT CHALLENGE - ARC RAIDERS • BF6 • FORTNITE
91.1K6