- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Critical Section Problem
The critical section is a code segment where the shared variables can be accessed. An atomic action is required in a critical section i.e. 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.
A diagram that demonstrates the critical section is as follows −
In the above diagram, the entry section handles the entry into the critical section. It acquires the resources needed for execution by the process. The exit section handles the exit from the critical section. It releases the resources and also informs the other processes that the critical section is free.
Solution to the Critical Section Problem
The critical section problem needs a solution to synchronize the different processes. The solution to the critical section problem must satisfy the following conditions −
- Mutual Exclusion
Mutual exclusion implies that only one process can be inside the critical section at any time. If any other processes require the critical section, they must wait until it is free.
- Progress
Progress means that if a process is not using the critical section, then it should not stop any other process from accessing it. In other words, any process can enter a critical section if it is free.
- Bounded Waiting
Bounded waiting means that each process must have a limited waiting time. Itt should not wait endlessly to access the critical section.
- Related Articles
- Race Condition, Critical Section and Semaphore
- Program to find out the critical and pseudo-critical edges in a graph in Python
- What is Critical Chain Project Management
- Critical Connections in a Network in C++
- Critical Resistance of a DC Shunt Generator
- Critical factors in determining the Capital Structure
- Relation Between Critical Angle and Refractive Index
- 3 Critical Skills Middle Managers Must Develop
- Critical Path Method – Scheduling the Complex Projects
- Partition problem
- Peterson’s Problem
- HTML DOM Section Object
- Understanding the 5 Critical Roles in Project Management
- Why Project Management Is Critical to Your Organization
- Readers-Writers Problem
