2019329621127 毛雷溥浩 homework6 Version 0 |
|
👤 Author: by 2972850556qqcom 2021-12-15 02:19:48 |
The bank provides a service window and 10 seats for customers to wait. When the customer arrives at the bank, if there is a free seat, he will pick up a
number at the number machine and wait for the number to be called.Only one customer i allowed to use the number picking machine at a time. When thesalesperson is free, he calls a customer to serve him.
semaphore empty = 10
semaphore mutex = 1semaphore full = osemaphore service = 0
customer
wait(empty)wait(mutex)
signal(mutex)signal(full)wait(service)
Salesperson
while(true)
wait(full)signal(empty)signal(service)}
}