Skip to content

A simple yet robust solution to Dining Philosophers in pthread

License

Notifications You must be signed in to change notification settings

changgyhub/dining-philosophers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dining Philosophers

A simple yet robust solution to Dining Philosophers in pthread

Note

Do not copy contents of this repo for course assignments. You should take the responsibility for any form of plagiarism.

Output format

Philo State Fork Held by
[ 0]: Thinking [ 0]: Free
[ 1]: Eating [ 1]: 1
[ 2]: Waiting [ 2]: 1
[ 3]: Terminated [ 3]: 2
[ 4]: Eating [ 4]: 4
[ 5]: Thinking [ 5]: 4
[ 6]: Thinking [ 6]: Free
[ 7]: Thinking [ 7]: Free
[ 8]: Eating [ 8]: 8
[ 9]: Thinking [ 9]: 8
Th= 5 Wa= 1 Ea= 3 Use= 7 Avail= 3

Usage

  • Compilation: gcc DPP.c -o DPP -Wall -pthread
  • Run: ./DPP <N> <S> <T>
    N = number of philosophers
    S = random number seed
    T = seconds of running

About

A simple yet robust solution to Dining Philosophers in pthread

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages