CSCI 350 Fall 2001 Quiz 2

Statistics:

mean     39.905 (838.000/21)
stddev   5.528
median   41.000
midrange 34.000-42.750

  1. What distinguishes a microkernel architecture for an operating system from a monolithic architecture? We discussed two specific aspects in class.

  2. In your own words, explain the following as they relate to process synchronization.
  3. Peterson's approach to shared-memory process synchronization involves the following two procedures.
    void lock() {
        interested[me] = true;
        turn = other;
        while(turn != me && interested[other]);
    }
    
    void unlock() {
        interested[me] = false;
    }
    
    Suppose we exchange the first two lines of lock().
    void lock() {
        turn = other;
        interested[me] = true;
        while(turn != me && interested[other]);
    }
    
    This approach is no longer correct. Explain what is wrong, giving a detailed step-by-step trace that exemplifies the problem.

    This does not have mutual exclusion. The following time sequence illustrates a situation where this occurs.

    B: turn = A
    A: turn = B
    A: interested[A] = true
    A: while(turn != A && interested[B]);
    A: enters critical section (since interested[B] == false)
    B: interested[B] = true;
    B: while(turn != B && interested[A]);
    B: enters critical section (since turn == B)
    
    At this point, both A and B have managed to enter their critical sections.