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
-
LIVE
putther
49 minutes ago⭐ Bounty Hunting on GTA Online & GTA 5 RP ❗
3,434 watching -
1:20:13
Sports Wars
8 hours agoCollege Football UPSETS, MLB Playoff Drama, NFL Week 4
65.9K11 -
LIVE
GritsGG
3 hours agoQuad Win Streaks!🫡 Most Wins in WORLD! 3600+
230 watching -
1:00:24
Jeff Ahern
6 hours ago $6.05 earnedThe Sunday Show with Jeff Ahern
33.7K15 -
LIVE
OhHiMark1776
3 hours ago🟢 09-28-25 ||||| Act 3 Continue ||||| Baldur's Gate 3 (2023)
115 watching -
2:04:33
DooM49
3 hours ago12 Days until Battlefield 6
17.8K1 -
17:23
Russell Brand
2 days agoThey couldn't handle this...
136K322 -
18:18
DeVory Darkins
23 hours ago $32.43 earnedPortland gets NIGHTMARE NEWS as Trump orders Troops to crush violent rioters
77.3K366 -
1:32:21
JTtheSG
3 hours agoLIVE Replay - Ready To Play VOID BREAKER
12.9K -
4:43:17
DoldrumDan
6 hours agoNEW STREAM SCHEDULE 3PM EST TO 7PM EST EVERY DAY
38K5