Reputation: 3009
Does round-robin scheduling ever cause deadlock? What happens if the CPU scheduling is based on round-robin and at one point in the schedule two different processes request the same file that no process owns? Would that cause deadlock or would the file be given to the process that is supposed to execute in the next step of the schedule?
Upvotes: 0
Views: 3403
Reputation: 11
rr scheduling can course deadlock.for example,if process A requests and gets a printer but exceeded its time quantum,and processB happens to have its normal cpu burst time equals to its time quantum..then its execution will be completed..then it requests for the printer which process A is still holding..while waiting at the queue tail for entry into the memory still onhold by process B..then deadlock has occured
Upvotes: 1
Reputation: 2667
The case you describe will not cause deadlock. Locks are atomic, so only one process can hold one at a time. Thus, whichever process has control at the time will acquire the lock and the second process will fail.
However, in a more general case, deadlock can occur in RR scheduling. Consider two processes and two locks. Process A acquires lock 1 and then yields the processor to Process B. Process B then acquires lock 2 and attempts to acquire lock 1. Because lock 1 belongs to Process A, process B will then sleep. Process A awakes and attempts to acquire lock 2. Lock 2 still belongs to process B, so neither process can move forward and you have a deadlock.
Upvotes: 1