2. CONTENT
• Introduction
• What is the Critical Section in OS?
• Requirementsof Synchronizationmechanisms
• Problems
• Advantages of critical section in process synchronization
• Disadvantages of critical section in process synchronization
• Conclusion
Dept Of Computational Sciences
3. INTRODUCTION
When more than one processes try to access the same code segment .
It contains shared variables or resources which are needed to be synchronized to maintain the
consistency of data variables.
It refers to the segment of code or the program which tries to access or modify the value of the
variables in a shared resource.
Dept Of Computational Sciences
4. What is the Critical Section in OS?
• The section above the critical section is called the Entry Section. The process that is
entering the critical section must pass the entry section.
• The section below the critical section is called the Exit Section.
• The section below the exit section is called the Reminder Section .
Dept Of Computational Sciences
5. Requirements of Synchronization mechanisms
1.Mutual Exclusion
• Our solution must provide mutual exclusion. By Mutual Exclusion, we mean that if one
process is executing inside critical section then the other process must not enter in the critical
section.
2.Progress
• Progress means that if one process doesn't need to execute into critical section then it should
not stop other processes to get into the critical section.
3.Bounded Waiting
• To predict the waiting time for every process to get into the critical section as process must
not be endlessly waiting for getting into the critical section.
Dept Of Computational Sciences
6. Problems
• Deadlock-When two or more threads or processes wait for each other to
release a critical section in which none of the threads or processes can move.
• Starvation-When a thread or process is repeatedly prevented from entering
a critical section, it can result in starvation.
• Overhead -When using critical sections, threads or processes must acquire
and release locks or semaphores, which can take time and resources.
Dept Of Computational Sciences
7. Advantages of critical section in process synchronization
• Prevents race conditions
• Provides mutual exclusion
• Reduces CPU utilization
• Simplifies synchronization
Dept Of Computational Sciences
8. Disadvantages of critical section in process synchronization
• Overhead
• Deadlocks
• Can limit parallelism
• Can cause contention
Dept Of Computational Sciences
9. Conclusion
Disabling interrupts is sometimes a useful technique within the kernel
of an operating system.
But it is not appropriate as a general mutual exclusion mechanism for
users process.
The reason is that it is unwise to give user process the power to turn
off interrupts.
Dept Of Computational Sciences