solve dining pholosopher problem
use semaphore
semaphore chopstick[5];
do {
wait(chopstick[i])
wait(chopstick[(i+1) % 5])
…
eating
…
signal(chopstick[i]);
signal(chopstick[(i+1) % 5]);
…
thinking
…
} while (1);
0 Response to "solve dining pholosopher problem"
Posting Komentar