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:49:51
Steve-O's Wild Ride! Podcast
8 days ago $3.65 earnedChet Hanks Found God On Chat GPT | Wild Ride #266
56.9K5 -
2:18:15
Badlands Media
5 hours agoOnlyLands Ep. 25: Erica Kirk Steps Up, Antifa Fallout, and Global Sparks
63.2K17 -
2:05:01
TimcastIRL
8 hours agoTrump Just Ended H1B Visas In Major Crackdown, Charging $100k Per Visa | Timcast IRL
280K179 -
4:02:20
Nerdrotic
14 hours ago $21.54 earnedKimmel MELTDOWN | Hollywood Boycotts Disney | Friday Night Tights 372 with Kaida
120K20 -
34:08
Bannons War Room
9 hours agoMEGYN KELLY: Jimmy Kimmel and Sore Cultural Losers, and Charlie Kirk's Spiritual Revival, w/ Bannon
82.1K89 -
59:27
NAG Podcast
9 hours agoBrandon Straka: BOLDTALK with Angela Belcamino
74.2K11 -
59:43
Sarah Westall
7 hours agoVietnam Shuts down 86 Million Bank Accounts, The Fourth Turning & more w/ Andy Schectman
56.7K14 -
1:17:51
Flyover Conservatives
14 hours agoMary Flynn O’Neill and Clay Clark: The Church Must Rise or America Falls | FOC Show
50K12 -
3:36:01
I_Came_With_Fire_Podcast
16 hours agoThe Global ANTIFA Connection You've Never Heard Of | The Israel Question
43.3K11 -
16:38
RTT: Guns & Gear
1 day ago $5.59 earnedExtar EP9 Review: The Best Budget 9mm PCC?
57.3K6