Critical Section and Race Condition
- Critical Section: The portion of program text where the shared variables or shared resources will be placed.
- Race Condition: It is a bug which occurs when the final value of the shared variable depends onexecution sequence of the processes.
Several processes access and process the manipulations over the same data concurrently, then the outcome depends on the particular order in which the access takes place.
• To avoid race condition, only one process should be allowed into critical section at any point of time.
THE CRITICAL-SECTION PROBLEM
- The critical-section problem is to design a protocol using which the processes can cooperate. The protocol must ensure that when one process is executing in its critical section, no other process is allowed to execute in its critical section.
- The critical section problem is to design a protocol that the processes can use so that their action will not depend on the order in which their execution is interleaved (possibly on many processors).
Template for each process that involves a critical section:

Dear Aspirants,
Your preparation for GATE, ESE, PSUs, and AE/JE is now smarter than ever — thanks to the MADE EASY YouTube channel.
This is not just a channel, but a complete strategy for success, where you get toppers strategies, PYQ–GTQ discussions, current affairs updates, and important job-related information, all delivered by the country’s best teachers and industry experts.
If you also want to stay one step ahead in the race to success, subscribe to MADE EASY on YouTube and stay connected with us on social media.
MADE EASY — where preparation happens with confidence.

MADE EASY is a well-organized institute, complete in all aspects, and provides quality guidance for both written and personality tests. MADE EASY has produced top-ranked students in ESE, GATE, and various public sector exams. The publishing team regularly writes exam-related blogs based on conversations with the faculty, helping students prepare effectively for their exams.
