ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > zstu-(2021-2022)-1 > 2019529628029 KUTLYYEV YUSUP >
Homework 6 KUTLYYEV YUSUP 2019529628029 Version 0
👤 Author: by wx287_oz26ft5iagvbbhc4i9tk-g9xjqia 2022-02-17 15:07:50
Problem: Whenever a process is constantly checking value while waiting (see while(s==0)) and wasting CPU cycles, we can take the following train of thought to avoid this situation:

P(Semaphore s)

{

s=s-1;

if(s<0){

block();

}

}

V(Semaphore s)

{

s=s+1;

if(s >=0){

wakeup(p);

}

}

Please login to reply. Login

Reversion History

Loading...
No reversions found.