Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider three concurrent processes A. B. and C. synchronized by three semaphore

ID: 3639436 • Letter: C

Question

Consider three concurrent processes A. B. and C. synchronized by three semaphores mutex, goB. and goC. which are initialized to 1. 0 and 0 respectively: Does there exist an execution scenario in which (i) all three processes block permanently? (ii) A scenario in which precisely two processes block permanently? (iii) A scenario in which no processes block permanently? Justify- your answers. Now consider a slightly modified example: Let m > n. In this case, does there exist an execution scenario in which both processes block permanently? Does there exist an execution scenario in which neither process blocks permanently'? Explain your answers. Now. let m

Explanation / Answer

a) i) Consider a scenario where process B executes first. It sets mutes to 0 and goes inside the critical section and then waits for goB. Now since process B is in critical section no process can enter critical section and also B is stuck due to wait(goB), so all three processes get blocked. Same thing happens when process C executes first. It gets blocked due to a wait(goC) call and since it is in critical section all other processes get stuck. ii) Consider a case where A executes first. It sets goB to 1 and exits. Then C executes and waits on goC since its value is 0. Meanwhile process B is also blocked since C is in its critical section. So process B and C both get blocked. iii) When a is executed first it sets semaphore goB to 1 and exits. Then B is executed and it sets semaphore goC to 1 and then C executes which also exits since value of goC is 1.