He __________ his phone unlocked on the table every time, and it’s starting to get on my nerves.
The engineers __________ (test) the new software
for weeks, and when it was launched, it was bug-free.
What is value of binary semaphore "S" after executing 10 P (Wait) operations if the initial value of "S" is 1? how many process will be blocked?
Познач способи зараження ВІЛ / СНІД
Укажи, на яких фото люди дбають про своє здоров’я
Познач ознаки найвищого (п’ятого) рівня спілкування
boolean blocked[2];
int turn;
void P(int id) {
while(true) {
blocked[id] = true;
while(turn != id) {
while(blocked[1-id])
/* do nothing */;
turn = id;
}
/* critical section */
blocked[id] = false;
/* remainder */
}
}
void main() {
blocked[0] = false;
blocked[1] = false;
turn = 0;
parbegin(P(0), P(1)); //RUN P0 and P1 parallel
The above code provide satisfies progress or not?