QUESTION 13
1 |
||
0 |
||
-1 or 1 |
||
-1 |
||
-1, 0 or 1 |
QUESTION 14
Deadlock avoidance |
||
Deadlock prevention |
||
Deadlock ignoring |
||
Deadlock detection + resolution |
Ques 13. Answer : (b) 0
The possible order in which the processes can run are
P0 : count++
count = count + 1 = 0+ 1
count = 1
P1 : count--
count = count - 1
count = 1 - 1
count = 0
P1 : count--
count = count - 1
count = 0 - 1
count = -1
P0 : count++
count = count + 1 = -1 + 1
count = 0
So, the value is same in all cases.
Ques 14. Answer ; (b)
Inn the given condition, then philosophers are picking in a way that a possible deadlock is avoided or prevented. So, it is Deadlock prevention.
QUESTION 13 Variable count=0 is shared between processes P0 and P1. P0 executes code count++;. P1...