Mutual Exclusion

Mutual exclusion


Question :-  What is mutual exclusion ? Hence explain concept of deadlock.       (6 m ) ( Nov – Dec 18 )

Ans :- Mutual exclusion is a process used to deal with shared file of shared variable. When two or more processes reading or writing in some shared variable then we may get wrong result, this condition is called as race condition. To avoid race condition we must go for critical section . A shared resource of shared variable or shared file is known as critical resource. The portion of a program that uses critical resource is known as critical section of a program. It is necessary that only one program should allowed to go into its critical section.

                The mutual exclusion is a method of making sure that if one process is using a shared variable or file, the other processes will be excluded from doing the same thing. Mutual  exclusion is implemented with the help of critical section. Mutual exclusion is implemented by software approach as well as hardware approach ( i. e,  by disabling interrupts as well as by machine instructions )

Mutual exclusion

Deadlock :-


Mutual exclusion implies that the resource is either free or assigned to exactly one process.

In multiprogramming environment several processes  may compete for a  fixed number of resources. A process requests a resource and if the resource is not available at that time, it enters a wait state. It may happen that it will never gain access to the resource, if that resource is being held by other waiting process. A set of processes is deadlocked if each process is waiting for a resource that is held by a deadlocked process.

a) Process P1 is holding the resource R1 and making a request for the resource R2.

b) Process P2 is holding the resource R2 and making a request for the resource R1.

     Both process, P1 and P2 are waiting for resources which they will never get. This condition is called as deadlock.

c) In general four strategies are used for dealing with deadlock:-

1) Just ignore the problem all together.

2) Deadlock detection and recovery

3) Dynamic avoidance by careful resource allocation.

4) Prevention, by negating one of the four necessary conditions.


  • WikiNote Foundation

Last modified: Friday, 20 September 2019, 10:20 AM