Return to Contents
Critical Section
- set of instructions that must be controlled so as to allow exclusive access to
one process
-
rarely: access to the critical section is limited to
n processes instead of 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...
- mutual exclusion: if process is executing in its critical section, no other
process is executing in its critical section
- 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
- 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)
Return to Contents