⇰ CRITICAL SECTION :-
Critical Section is the part of a program where shared resources or data are accessed by various cooperative processes. That resource may be any resource in a computer like a memory location, Data structure, CPU or any IO device.
Therefore we can say when more than one processes access a same code segment that segment is known as critical section. The resources or data which are present in critical section must be synchronized to maintain data consistency.
Each process has a segment of code called critical section, where the process may be changing common variables, updationg a table, writing a file and so on. The important feature of system is that when one process is executing in critical section, no other process is allowed to execute or enter in critical section. An atomic action is required in a critical section means, only one process can execute in its critical section at a time. All the other processes have to wait to execute in their critical sections until it become empty.
The critical section cannot be executed by more than one process at the same time. But operating system faces some difficulties in allowing and disallowing the processes from entering the critical section again and again. The critical section problem is used to design a set of protocols which must ensure that the race condition will never occur. Each process must request permission to enter the critical section. The section of code for this request is called Entry section. The remaining code is called the remainder section.
In order to synchronize the cooperative processes in any system, the main task is to solve the critical section problem. A solution to the critical section problem must satisfy the following requirements :-
i> Mutual Exclusion :- If one process is in critical section, then no other process can be allowed to enter in critical section. This will done by writing the code of entry section.
ii> Progress :- If no process is executing in critical section and some process wish to enter the critical section, then only those can enter that are not executing in their remainder section.
iii> Bounded Wait :- Their exist a bounded limit on the number of times that one process is allowed to enter in critical section regularly. Means there is a limit that a process can enter critical section.
Share, Follow and please comment if you find anything incorrect or to share more information about the topic discussed above
Comments
Post a Comment
Please comment.