Dining Philosophers in C#

This is a simple solution to dining philosophers problem demonstrating how to synchronize access to shared state in a multithreaded environment.

C# (74.0 KB)
 
 
 
 
 
(0)
2,675 times
Add to favorites
4/11/2013
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Philosopher 0 grabs the wrong chopstick
    1 Posts | Last post July 12, 2016
    • The current implementation has philosopher 0 grabbing chopsticks reversed relative to all of the other philosophers.  If you fix this the current solution is prone to deadlocks (all acquire left, all deadlock waiting for right).  To fix the deadlock issue you should use Monitor.TryEnter with retry.