Return to Contents


Process Synchronization

Reference: S&G, Chapter 6
Concurrent Processes

Concurency

Mutual Exclusion

Resource Allocation

NOTE: S&G, p. 167: ``we do assume that the basic machine-language instructions (the primitive instructions such as load, store, and test) are executed atomically.'' Another way of thinking about this is that the memory hardware enforces mutually exclusive access to a word of memory. Thus, if two processes or processors try to write different values (say 16 and 29) to word OD45E, one or the other of these values will be written first (say 29) and the other will be written second (say 16), but the bits of the two values 16 and 29 will not be scrambled together.

Low-Level Techniques for Mutual Exclusion

  1. Turn Off Interrupts

    Two Problems:

    1. if you need to do a lot of operations in the mutually exclusive segment
    2. multiple processor machine (multiprocessor)

      • Zeus has 12 processors that share the same memory (shared memory architecture)
      • turning off interrupts gives one process exclusive access to its processor but other processes on other processors can still make changes to memory

  2. Busy Wait (SpinLock)


Return to Contents