Skip to content

A Ruby implementation of the classic multi-process synchronization problem

Notifications You must be signed in to change notification settings

mikeweber/Dining-Philosophers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dining Philosophers
===================

To run, simply call `ruby philosophers.rb`.
After each state change, the current state of the table will be printed, with a 
'!' representing an available chop-stick, a '|' representing a chop-stick in use
and a 'O' representing a philosopher. e.g. '  |O  !' would be printed when a 
philosopher is using her chopstick on the left, but not using the one on her right. 
The program will continue until the whole process is deadlocked.

NOTE: The printing of the table is not synchronized, so it is possible to print a chop-stick
as in use if the print method is called while the chop-stick is changing states.

About

A Ruby implementation of the classic multi-process synchronization problem

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages