CRITICAL SECTION AND ITS SOLUTIONS

What is Critical section?

A Critical Section can be defined as a code segment which accesses shared variables, that needs to be excuted as an atomic action.

In simple words, at a given point of time, in a group of cooperating processes, in its critical section not more than one process can be executed. If, at the same time any other process want to access its critical section, then it must wait for the first process to finish its critical section.

Solution for Critical Section

To avoid critical section problem it should satisfy the following conditions-

1. Mutual Exclusion

It means that if one process is accessing the shared variables or is executing inside its critical section then no other process can enter the critical section.

2. Progress

In the critical section if there are no processes, and if any one or more processes wants to enter their critical section, then any of the processes can be allowed to enter into its critical section.

3. Bounded Waiting

There is a specified limit for how many program can execute their critical section, so, when a process ask to enter its critical section and if the limit is reached then the system must grant permission for entering into its critical section.

No comments to show.

Leave a comment

Design a site like this with WordPress.com
Get started