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)
2,694 times
Add to favorites
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.