Consider a shared variable with an initial value of 1, this shared variable is used by four concurrent processes X, Y, Z, and W. Process X reads the shared variable and decrement it by 4 and process Y reads the shared variable and increments it by 2 before writing it to the memory. Process Z reads the shared variable and decrements it by 3 while process W reads the shared variable and increments it by 1 before writing it to the memory. All the processes before reading the value perform a wait operation on a counting semaphore variable S and after writing it to the memory signal operation is performed before the processes get terminated. What will be the possible sequence of termination provided that the shared variable has a minimum value in memory after the termination of all processed (initially S = 2)?

I. X W Y Z

II. Z W Y X

III. X Y W Z

IV. Z Y W X

1
Only I
2
Only II and IV
3
Only I and III
4
I, II, III and IV

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation