Home | | Operating Systems | Critical-Section Problem

Chapter: Operating Systems : Process Scheduling and Synchronization

Critical-Section Problem

The producer-consumer problem described above is a specific example of a more general situation known as the critical section problem.

CRITICAL-SECTION PROBLEM

 

ü The producer-consumer problem described above is a specific example of a more general situation known as the critical section problem. The general idea is that in a number of cooperating processes, each has a critical section of code, with the following conditions and terminologies:

 

o   Only one process in the group can be allowed to execute in their critical section at any one time. If one process is already executing their critical section and another process wishes to do so, then the second process must be made to wait until the first process has completed their critical section work.

 

o   The code preceding the critical section, and which controls access to the critical section, is termed the entry section. It acts like a carefully controlled locking door.

 

o   The code following the critical section is termed the exit section. It generally releases the lock on someone else's door, or at least lets the world know that they are no longer in their critical section.

p   The rest of the code not included in either the critical section or the entry or exit sections is termed the remainder section.


 

 

ü A solution to the critical section problem must satisfy the following three conditions:

 

1.     Mutual Exclusion - Only one process at a time can be executing in their critical section.

 

2.     Progress - If no process is currently executing in their critical section, and one or more processes want to execute their critical section, then only the processes not in their remainder sections can participate in the decision, and the decision cannot be postponed indefinitely. ( i.e. processes cannot be blocked forever waiting to get into their critical sections. )

 

3.     Bounded Waiting - There exists a limit as to how many other processes can get into their critical sections after a process requests entry into their critical section and before that request is granted. ( I.e. a process requesting entry into their critical section will get a turn eventually, and there is a limit as to how many other processes get to go first. )

 

ü We assume that all processes proceed at a non-zero speed, but no assumptions can be made regarding the relative speed of one process versus another.

 

ü Kernel processes can also be subject to race conditions, which can be especially problematic when updating commonly shared kernel data structures such as open file tables or virtual memory management. Accordingly kernels can take on one of two forms:

 

 

o   Non-preemptive kernels do not allow processes to be interrupted while in kernel mode. This eliminates the possibility of kernel-mode race conditions, but requires kernel mode operations to complete very quickly, and can be problematic for real-time systems, because timing cannot be guaranteed.

 

o   Preemptive kernels allow for real-time operations, but must be carefully written to avoid race conditions. This can be especially tricky on SMP systems, in which multiple kernel processes may be running simultaneously on different processors.

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Operating Systems : Process Scheduling and Synchronization : Critical-Section Problem |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.