Explain critical section problem with example | Operating System Question & Answer

Each process contains two sections. One is critical section where a process may need to access common variable or objects and other is remaining section containing instructions for processing of sharable objects or local objects of the process. Each process must request for permission to enter inside its critical section. The section of code implementing this request is the entry section. In entry section if a process gets permission to enter into the critical section then it works with common data. At this time all other processes are in waiting state for the same data. The critical section is followed by an exit section. Once the process completes its task, it releases the common data in exit section. Then the remaining code placed in the remainder section is executed by the process.

Two processes cannot execute their critical sections at the same time. The critical section problem is to design a protocol that the processes can use to cooperate i.e. allowing entry to only one process at a time inside the critical section. Before entering into the critical section each process must request for
permission to entry inside critical section. 

Post a Comment

0 Comments