G53OPS - Operating Systems

This course is run at the The University of Nottingham within the School of Computer Science & IT. The course is run by Graham Kendall (EMAIL : gxk@cs.nott.ac.uk)


Critical Sections

This section is based on (Tanenbaum, 1992), pages 34-35

One way to avoid race conditions is not to allow two processes to be in their critical sections at the same time (by critical section we mean the part of the process that accesses a shared variable). That is, we need a mechanism of mutual exclusion. Some way of ensuring that one processes, whilst using the shared variable, does not allow another process to access that variable.

In fact, to provide a good solution to the problem of race conditions we need four conditions to hold.

1. No two processes may be simultaneously inside their critical sections.
2. No assumptions may be made about the speed or the number of processors.
3. No process running outside its critical section may block other processes
4. No process should have to wait forever to enter its critical section.

As we shall see, it is difficult to devise a method that meets all these conditions.

Last Page Back to Main Index Next Page


 


 Last Updated : 08/01/2002