Operating System - Critical Section Problem


Next >>

The critical section is a code segment in which each process may modify the common variables, update the table, write the files and so on. The critical section allows only one process to run at the given time. Suppose if the other process wants to enter in its critical section, it must wait until the running process exits from the section.

The critical section problem is nothing but designing the protocol that are used by the cooperating processes. This protocol format contains several sections that are:

  • Entry section: it gives permission to the process to enter into its critical section.
  • Critical section: it allows only one process to execute.
  • Exit section: it follows the critical section.
  • Remainder section:it contains the remaining code.

Solution to the Critical Section Problem

There are three conditions that must be satisfied by a solution to the critical-section problem.:

1.  Mutual Exclusion

At a given point in time, only one process should execute in its critical section.

2.  Progress

If no process is in its critical section and if any of the processes want to enter in its critical section, then that process is allowed to enter in their critical section, provided there is not much delay.

3.  Bounded waiting

After a process has made a request for getting critical section and before that the request is granted, There is a limit for number of times that other processes are allowed to enter their critical section. Usually, the limit is one time


Next >>