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
Revenge of the Cis
2 hours agoEpisode 1341: Drip
4,666 watching -
1:19:53
Awaken With JP
3 hours agoPolitical Correctness Has Been Murdered - LIES Ep. 39
47.3K32 -
57:17
The Chris Cuomo Project
11 hours agoTulsi Gabbard's Case Against the Democratic Party
5.31K28 -
15:08
TudorDixon
1 hour agoPro-Hamas Protests Have The Left Frightened | The Tudor Dixon Podcast
61817 -
1:13:44
TheMonicaCrowleyPodcast
3 hours agoThe Inmates Running the Asylum
3521 -
2:25:07
Due Dissidence
7 hours agoGOP Senators THREATEN ICC, Israel Orders Rafah EVACUATION, Lee Fang Dissident Dialogues Interview
20.3K45 -
3:03:56
Russell Brand
9 hours agoTulsi Gabbard LIVE: The END Of Free Speech, Nuclear War, Trump’s VP & More! - Stay Free #360
186K334 -
53:34
Steven Crowder
8 hours agoDEPORT THEM ALL! How Trump’s Historic Mass Deportation Plan Is Going To Work
305K661 -
2:07:42
TheAlecLaceShow
6 hours agoGuest: Daniel Turner | Gaza Meets Gala | Flag Burning in NYC | Energy Crisis | The Alec Lace Show
18.9K11 -
47:41
Out & About
11 hours agoWhy Tom Brady's Roast was a Genius Move for His Career | Out & About Ep. 273
35.5K9