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
-
1:03:37
Timcast
1 hour agoRepublicans Call For Mass EXPULSION Of Muslims, Travel BAN
54.6K58 -
LIVE
Dr Disrespect
4 hours ago🔴LIVE - DR DISRESPECT - ARC RAIDERS - NEW COLD SNAP UPDATE
1,537 watching -
LIVE
Sean Unpaved
1 hour agoAaron Rodgers & Steelers BOUNCE BACK In WIN vs. Dolphins! | UNPAVED
83 watching -
1:49:22
Steven Crowder
3 hours agoCandace & Erika: What The Meeting Really Says About Conservative Media
275K234 -
16:28
Adam Does Movies
56 minutes agoIT: Welcome To Derry Episode 8 Recap - What A Finale!
-
LIVE
LFA TV
15 hours agoLIVE & BREAKING NEWS! | TUESDAY 12/16/25
3,303 watching -
1:01:57
VINCE
4 hours agoThis Could Win Us The Midterms | Episode 189 - 12/16/25 VINCE
194K168 -
LIVE
The Mel K Show
2 hours agoMORNINGS WITH MEL K- The End of Zero Sum Game Theory Thinking Has Arrived - 12-16-25
749 watching -
LIVE
The Shannon Joy Show
1 hour agoSJ LIVE Dec 16 - TACO Trump Flees California After Judge Orders Him To Remove Troops! Plus The Bitcoin Collapse & AI Bubble W/ Fin-Analyst Jack Gamble!
297 watching -
LIVE
TheAlecLaceShow
1 hour agoBrown University | Rob Reiner | Guests: Senator Rick Scott & Sec. Linda McMahon | The Alec Lace Show
51 watching