375 views
0 votes
0 votes
Consider a process with three threads A, B, and C. The default thread of the process receives multiple requests, and places them in a request queue that is accessible by all the three threads A, B, and C. For each request, we require that the request must first be processed by thread A, then B, then C, then B again, and finally by A before it can be removed and discarded from the queue. Thread A must read the next request from the queue only after it is finished with all the above steps of the previous one.
sem a1done = 0; b1done = 0; cdone = 0; b2done = 0;
ThreadA:
get request from queue and process
up(a1done)
down(b2 done)
finish with request
Thread B:
down(a1done)
//do work
up(b1done)
down(cdone)
//do work
up(b2done)
ThreadC:
down(b1done)
//do work
up(cdone)
All thread is running in forever loop.
Which of the following is correct?

A. The proposed solution prevents deadlock but fails to guarantee mutual exclusion

B.The proposed solution guarantees mutual exclusion but fails to prevent deadlock

C.The proposed solution guarantees mutual exclusion and prevents deadlock

1 Answer

Best answer
1 votes
1 votes
is C the answer?
selected by

Related questions

0 votes
0 votes
2 answers
2
Kartavya Kothari asked Aug 27, 2018
646 views
A ____ can be used to prevent a user program from never returning control to the operating system.