6. Sleeping Barber - continued
I would like to continue this thread, but am busy at the moment. I just want to point out the provably false statement in Tanenbaum. Consider page 130:
page 130. "Our solution uses three semaphores: customers, which counts waiting customers (excluding the customer who is in the barber chair, who is not waiting) , barbers, the number of barbers (0 or 1) who are idle, waiting for customers, and mutex, which is used for mutual exclusion. We need also a variable, waiting, which also counts the waiting customers."
The fact is that the barbers semaphore is _not_ restricted to having values 0 or 1 as Tanenbaum states, and as is suggested by his meaning given to the semaphore. The semaphore may take arbitrarily large values.
page 130. "Our solution uses three semaphores: customers, which counts waiting customers (excluding the customer who is in the barber chair, who is not waiting) , barbers, the number of barbers (0 or 1) who are idle, waiting for customers, and mutex, which is used for mutual exclusion. We need also a variable, waiting, which also counts the waiting customers."
The fact is that the barbers semaphore is _not_ restricted to having values 0 or 1 as Tanenbaum states, and as is suggested by his meaning given to the semaphore. The semaphore may take arbitrarily large values.
Labels: computing
1 Comments:
How Can I run this sleeping barber.java in windows?
Post a Comment
<< Home