CRITICAL SECTION
Dept Of Computational Sciences
Presented By: Chandni Gupta
Student Code: BWU/MCA/22/119
Course Name: Master Of Computer Application
Department: ComputationalScience
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
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
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
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
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
Advantages of critical section in process synchronization
• Prevents race conditions
• Provides mutual exclusion
• Reduces CPU utilization
• Simplifies synchronization
Dept Of Computational Sciences
Disadvantages of critical section in process synchronization
• Overhead
• Deadlocks
• Can limit parallelism
• Can cause contention
Dept Of Computational Sciences
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
Reference
• https://www.geeksforgeeks.org/g-fact-70/
• “OPERATING SYSTEM CONCEPTS”
Abraham Simberschatz ;
Peter Baer Galvin.
Dept Of Computational Sciences
Dept Of Computational Sciences

Critical Section in Operating System

  • 1.
    CRITICAL SECTION Dept OfComputational Sciences Presented By: Chandni Gupta Student Code: BWU/MCA/22/119 Course Name: Master Of Computer Application Department: ComputationalScience
  • 2.
    CONTENT • Introduction • Whatis 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 morethan 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 theCritical 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 Synchronizationmechanisms 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 twoor 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 criticalsection in process synchronization • Prevents race conditions • Provides mutual exclusion • Reduces CPU utilization • Simplifies synchronization Dept Of Computational Sciences
  • 8.
    Disadvantages of criticalsection in process synchronization • Overhead • Deadlocks • Can limit parallelism • Can cause contention Dept Of Computational Sciences
  • 9.
    Conclusion  Disabling interruptsis 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
  • 10.
    Reference • https://www.geeksforgeeks.org/g-fact-70/ • “OPERATINGSYSTEM CONCEPTS” Abraham Simberschatz ; Peter Baer Galvin. Dept Of Computational Sciences
  • 11.