Thursday 22 September 2011

Process Synchronization : Critical Section


Critical Section
  • set of instructions that must be controlled so as to allow exclusive access to one process
  • execution of the critical section by processes is mutually exclusive in time
Critical Section (S&G, p. 166) (for example, ``for the process table'')
repeat
      
      critical section
      
      remainder section
until FALSE


Solution to the Critical Section Problem must meet three conditions...
  1. mutual exclusion: if process  is executing in its critical section, no other process is executing in its critical section
  2. progress: if no process is executing in its critical section and there exists some processes that wish to enter their critical sections, then only those processes that are not executing in their remainder section can participate in the decision of which will enter its critical section next, and this decision cannot be postponed indefinitely
    • if no process is in critical section, can decide quickly who enters
    • only one process can enter the critical section so in practice, others are put on the queue
  3. bounded waiting: there must exist a bound on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted
    • The wait is the time from when a process makes a request to enter its critical section until that request is granted
    • in practice, once a process enters its critical section, it does not get another turn until a waiting process gets a turn (managed as a queue)

0 comments:

Post a Comment