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
-
29:13
Clownfish TV
20 hours agoGen Z are Becoming the Boomers?! | Clownfish TV
76323 -
1:48:31
Squaring The Circle, A Randall Carlson Podcast
15 hours agoMEGA Tsunamis and the formation of our World ft. Dr. Dallas Abbot
8101 -
13:13
Mrgunsngear
12 hours ago $0.50 earnedStreamlight TLR-1 HP Review: Can It Dethrone Surefire?
1.66K4 -
6:53
Rena Malik, M.D.
21 hours agoWhy Antidepressants Wreak Havoc on Your Sex Life?! | Urologist Explains How to Boost your Libido
852 -
1:00:00
BEK TV
2 days agoMIKE MOTSCHENBACHER ON NORTH DAKOTA POLITICS, TEA PARTY ROOTS, AND THE 2026 ELECTION
2.7K -
15:31
Breaking Points
1 day agoIs Trump Planning VENEZUELA Regime Change?
19.4K13 -
2:06:05
"What Is Money?" Show
2 days agoTrump Family Bitcoin Bet Will Trigger Nation-State FOMO w/ Matt Prusak (CEO American Bitcoin)
5.94K -
1:04:36
Dialogue works
2 days ago $2.44 earnedMohammad Marandi: Iran Just Gave Israel a FINAL Warning…
10.6K6 -
9:20
daniellesmithab
1 day ago3 Bad Laws
15.1K7 -
9:22
MattMorseTV
17 hours ago $10.46 earnedINDIA just made a BIG MISTAKE.
58.3K52