What is Critical Section Problem
Definition of Critical Section Problem:- Critical section is a part of program code, which requires shared resources with two or more programs in order to be executed. These resources can be a computer's memory location, data structure, CPU or other hardware device. Meaning that the critical section shares those important resources, which if two or more programs want to be used simultaneously, then the output of both the programs may be affected or the whole computer system may hang. It is very important for the operating system or OS to determine how it will manage the program in critical section conditions.
Example of Critical Section in Operating System
If two programs want to print two different files at the same time, they have to do it in sequence because the printer can print only one file at a time.
Similarly, if two different programs want to use the computer's speaker, then this is not possible, at which time one program uses the computer's speaker, then the other program will have to wait for the speaker to be empty.
If both the programs want to use the printer or speaker simultaneously, then the condition of deadlock may arise in the whole computer system, which means that the computer system may hang or may get wrong and strange output.
Critical Section Problem: - Critical Section Problem is used to design such a protocol (set of rules) so that coordination between two or more programs can be established and and All programs can execute properly without affecting each other.
Solution to Critical Section Problem
Solution to Critical Section Problem - Solution to Critical Section Problem must satisfy the following three conditions
Mutual Exclusion:- This means that when one process or program is executing in the critical section, no other program will enter the critical section. Meaning that two or more programs cannot enter the critical section at the same time.
Progress :- It means that if one process is not required to execute in critical section, then it should not prevent any other processes from coming in critical section.
Bounded Waiting:- When a program requests access to the critical section, the system should be able to estimate how long it will have to wait for it to reach the critical section and execute. It should not happen that a program has to wait an eternity to access the critical section.
Advantages of Critical Section Problem:-
It maintains harmony between programs and avoids the situation of mutual deadlock.
It helps the operating system or OS to improve the performance of the entire computer system.
Summery of Critical Section Problem :- In this article, we have tried to explain Critical Section Problem occurring in operating system or OS in simple Hindi language. Hope you liked this article on critical section problem in hindi. If you want to give any suggestion related to this article written on critical section problem operating system in hindi, then definitely tell us by writing in the comment box below so that we can make necessary changes in our article to make it more useful.