ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU-(2020-2021)-1 > student homework > 2018329621137_张翔 >
homework6_张翔_2018329621137 Version 0
👤 Author: by 2470994471qqcom 2020-11-05 09:53:01
Semaphores are integer variables that are used to solve the critical section problem by using two atomic operations, wait and signal that are used for process synchronization.

It has two operations wait() and signal()

The wait operation decrements the value of its argument S, if it is positive. If S is negative or zero, then no operation is performed.
wait(S)
{
   
while (S<=0);

   S
--;
}
The signal operation increments the value of its argument S.

signal(S)
{
   S
++;
}
Using semaphores to solve the producer-consumer problem


Please login to reply. Login

Reversion History

Loading...
No reversions found.