In the solution to the dining philosophers problem (Fig. 2-20), why is the state variable set to

Question:

In the solution to the dining philosophers problem (Fig. 2-20), why is the state variable set to HUNGRY in the procedure take_forks?#define N #define LEFT #define RIGHT #define THINKING void philosopher(int i) { } #define HUNGRY #define

void take forks(int i) { down(&mutex); state[i] = HUNGRY; test(i); } up(&mutex); down(&s[i]); } void

void test(i) { /* i: philosopher number, from 0 to N-1 */ if (state[i]= HUNGRY && state[LEFT] != EATING &&

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Operating Systems Design And Implementation

ISBN: 9780131429383

3rd Edition

Authors: Andrew Tanenbaum, Albert Woodhull

Question Posted: