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
-
2:57:44
The Charlie Kirk Show
9 hours agoWASHINGTON D.C. PRAYER VIGIL FOR CHARLIE KIRK
232K428 -
14:11
Robbi On The Record
10 hours agoThe Trap of Identity Politics: How Division is Killing America
5.75K11 -
1:29:23
Nerdrotic
10 hours ago $16.39 earnedThe Turning Point | New UFO Video with Michael Collins | Forbidden Frontier #117
74.3K27 -
1:08:26
Sarah Westall
7 hours agoSuicide Pacts forming in Youth Social Media Groups - Discord, Reddit, TikTok w/ John Anthony
67.2K20 -
2:25:31
vivafrei
18 hours agoEp. 281: Charlie Kirk; Routh Trial; Charlotte Train; Bolsanaro Defense; SCOTUS & MORE!
148K212 -
2:55:38
Turning Point USA
9 hours agoWASHINGTON D.C. PRAYER VIGIL FOR CHARLIE KIRK
90.2K41 -
35:54
The Mel K Show
9 hours agoMel K & Tim James | Healing is an Inside Job | 9-14-25
67.4K4 -
3:06:33
IsaiahLCarter
12 hours ago $11.60 earnedCharlie Kirk, American Martyr (with Mikale Olson) || APOSTATE RADIO 028
74.9K23 -
16:43
Mrgunsngear
16 hours ago $11.39 earnedKimber 2K11 Pro Review 🇺🇸
54.4K14 -
13:40
Michael Button
1 day ago $3.51 earnedThe Strangest Theory of Human Evolution
49.6K24