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
Game On!
16 hours agoBIGGEST 2025 College Football Playoff 1st Round BETS NOW!
941 watching -
LIVE
Crypto Power Hour
9 hours agoState of Early Stage Crypto Investor Rob Good
1,257 watching -
LIVE
LIVE WITH CHRIS'WORLD
16 hours agoTHE WAKE UP CALL - 12/17/2025 - Episode 27
336 watching -
27:51
ThinkStory
17 hours agoIT: WELCOME TO DERRY Season 1 Ending Explained!
4.91K -
5:29
Gamazda
11 hours ago $0.94 earnedMetallica - Nothing Else Matters (Live Piano in a Church)
4.26K3 -
2:50:56
The Confessionals
19 hours agoHe Killed a Monster (Then They Told Him to Stay Silent)
5.42K3 -
41:42
Brad Owen Poker
13 hours ago $0.31 earnedMy BIGGEST WIN EVER!! $50,000+ In DREAM Session!! Must See! BEST I’ve Ever Run! Poker Vlog Ep 360
4.02K -
17:53
The Illusion of Consensus
18 hours agoWhat Women REALLY Want in Public (It’s Not What You Think) | Geoffrey Miller
4.57K1 -
1:32:16
Uncommon Sense In Current Times
16 hours ago $0.32 earnedPolygyny Debate: The Biblical Case For and Against Plural Marriage | Uncommon Sense
8.27K -
LIVE
BEK TV
22 hours agoTrent Loos in the Morning - 12/17/2025
146 watching