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:52 2:57:52Laura Loomer6 hours agoEP154: Naturalized US Navy Medic From GAZA Exposed For Ties To Hamas28.7K17
- 	
				 35:45 35:45Stephen Gardner9 hours ago🔴BREAKING: Election Auditor EXPOSES Democrat Election Fraud Evidence!14.3K33
- 	
				 15:48 15:48Sponsored By Jesus Podcast13 hours agoHow to Stop Being JEALOUS | When Comparison Steals Your Joy2.44K7
- 	
				 LIVE LIVEDLDAfterDark4 hours agoDon't Worry - Things Will Get SO Much Worse! Sometimes It Be Like That401 watching
- 	
				 25:41 25:41Robbi On The Record10 hours agoThe Billion-Dollar Lie Behind OnlyFans “Empowerment” (Her Testimony Will Shock You) | part II3.71K5
- 	
				 12:22 12:22Cash Jordan1 hour ago"CHICAGO MOB" Fights Back... "ZERO MERCY" Marines DEFY Judge, SMASH ILLEGALS7.98K19
- 	
				 46:58 46:58Brad Owen Poker13 hours agoI Make QUAD ACES!!! BIGGEST Bounty Of My Life! Turning $0 Into $10,000+! Must See! Poker Vlog Ep 3234.28K2
- 	
				 2:52:28 2:52:28TimcastIRL5 hours agoSTATE OF EMERGENCY Declared Over Food Stamp CRISIS, Judge Says Trump MUST FUND SNAP | Timcast IRL207K115
- 	
				 3:22:45 3:22:45Tundra Tactical11 hours ago $14.22 earned🚨Gun News and Game Night🚨 ATF Form 1 Changes, BRN-180 Gen 3 Issues??, and Battlefield 6 Tonight!27.8K2
- 	
				 1:45:13 1:45:13Glenn Greenwald8 hours agoJD Vance Confronted at Turning Point about Israel and Massie; Stephen Miller’s Wife Screams “Racist” and Threatens Cenk Uygur with Deportation; Rio's Police Massacre: 120 Dead | SYSTEM UPDATE #540106K112