Premium Only Content
![Deadlocks and the Dining Philosophers Problem](https://1a-1791.com/video/s8/6/v/X/k/h/vXkhd.qR4e.1.jpg)
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
-
36:50
Mrgunsngear
18 hours ago $10.33 earnedPresident Trump's Executive Order To The ATF: This Could Be Huge!
34.4K36 -
25:48
Adam Does Movies
20 hours ago $1.34 earnedTop 10 Reasons Why Emilia Pérez Is Complete TRASH!
19.9K7 -
26:56
MYLUNCHBREAK CHANNEL PAGE
1 day agoUnder The Necropolis - Pt 6
175K45 -
6:03
Tactical Advisor
1 day agoEverything New From Panzer Arms 2025
2.04K -
1:15:59
CarlCrusher
18 hours agoUFOs & Paranormal Phenomena are Not Imaginary | Dr Jim Segala MUPAS Phase 2
6.5K1 -
12:44
BlackDiamondGunsandGear
13 hours agoRadian Ramjet & Afterburner / Worth it? / Which Shoots Flatter?
23.2K2 -
49:10
CharLee Simons Presents Do Not Talk
10 days agoDO NOT TALK with GIL MAZA & SAM ANTHONY (Mass Deportation Results)
3.91K -
8:07
Tundra Tactical
19 hours ago $4.07 earnedHiPoint Embraces The MEME Yet Again.
42.4K6 -
36:00
hickok45
6 hours agoSunday Shoot-a-Round # 267
2.93K11 -
38:57
PMG
16 hours agoHannah Faulkner and Brandon Tatum | BREAKING THE CHAINS: Exposing the Left’s Manipulation
1.71K