Mutual exclusion in Operating System with its four conditions

When a process is executed in a critical section, then no other process can be executed in their critical section. It consists of a single process temporarily excluding all others from using a shared resource in a way that guarantees the integrity of the system. It assures that when one thread is functioning read or write operation, then others avoided to doing the same on shared data. 

There are four conditions applied on mutual exclusion. These are the following:

  • Mutual exclusion must be guaranteed between the different processes when accessing the shared resource. There cannot be two processes within their respective critical sections at any time.
  • No assumptions should be made as to the relative speed of the conflicting processes.
  • No process that is outside its critical section should interrupt another for access to the critical section.
  • When more than one process wants to enter its critical section, it must be granted entry in a finite time, that is, it will never be kept waiting in a loop that has no end.