In: Computer Science
Operating systems
Explain what the critical section problem is. Please explain this
in about 1-2 paragraphs.
Critical section problem:
In the computer system, the memory, CPU, hard disk, and Input/Output, etc are known as resources. If a program tries to access the shared resources(CPU, HD, IO devices, etc) then only that part of the program source code is known as the critical section.
The critical section is the part of the computer program where the resources can't be shared among the process and the operating system needs to set up some rules to enter into the critical section. When more than one process tries to enter into the race condition then a critical section problem may occur.
Only one process must be allowed into the critical section and the remaining processes must wait for their turn.
A semaphore is a simple variable and it solves the critical section problem.
Semaphore is nothing but is a special integer variable that can be accessed by only two system calls which are atomic in nature, known as p() and v() or wait() and signal(). It is a signaling mechanism.
The binary semaphore can have two values(0, 1) only
The counting semaphore has an unrestricted
domain.