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
-
3:13:00
Badlands Media
20 hours agoThe Narrative Ep. 40: Acceleratia.
32.7K9 -
LIVE
SpartakusLIVE
5 hours ago#1 Solo Spartan Sunday || TOXIC Comms, TACTICAL Wins, ENDLESS Content
1,411 watching -
49:45
Sarah Westall
4 hours agoComedians take Center Stage as World goes Nuts w/ Jimmy Dore
18.5K11 -
3:26:14
IsaiahLCarter
12 hours ago $2.89 earnedAntifa Gets WRECKED. || APOSTATE RADIO 030 (Guests: Joel W. Berry, Josie the Redheaded Libertarian)
28.8K -
LIVE
CassaiyanGaming
3 hours agoArena Breakout: Infinite Dawg
124 watching -
2:24:32
vivafrei
12 hours agoEp. 284: Ostrich Crisis Continues! Kirk Updates! Fed-Surrection Confirmed? Comey Indicted! AND MORE!
112K176 -
LIVE
Cewpins
3 hours agoSunday Sesh!🔥Rumble Giveaway Tonight!🍃420💨!MJ !giveaway
270 watching -
3:03:11
Conductor_Jackson
4 hours agoLet’s Play BioShock Infinite Burial at Sea Episode 2!
7.53K -
5:21:16
EricJohnPizzaArtist
6 days agoAwesome Sauce PIZZA ART LIVE Ep. #63: Charlie Sheen
35.9K4 -
LIVE
THOUGHTCAST With Jeff D.
2 hours agoTHOUGHTCAST Jeff and Keegan play Left 4 Dead 2. Classic games
39 watching