594 views
3 votes
3 votes
Let S be a binary semaphore variable. Let S = 0 initially.

Assume that no blocked processes exist in the system. The following signal (V), wait (P) operations are performed.

5 P, 7 V, 10 P, 13 V, 17 P

The number of blocked processes at the end are _________.

1 Answer

Best answer
4 votes
4 votes
S is Binary Semaphore and can have either 0 or 1 value.

 

Initially S=0

5 P:  5 blocked processes

7 V: S=1 & 0 blocked process

 

(As all five blocked processes will be resumed and 6th V will make S = 1 and 7th V will continue to keep S = 1)

 

10 P: 9 blocked processes

13 V: S=1 and 0 blocked process

17 P:  S=0 and 16 blocked processes

 

The number of blocked processes at the end are 16
selected by

Related questions