Module 6: Shared Memory Multiprocessors: Consistency and Coherence
  Lecture 11: Introduction to Snoopy Coherence
 


Write Atomicity

  • Example (A=0, B=0 initially)

P0: A=1;
P1: while (!A); B=1;
P2: while (!B); print A;

  • A correct execution on an SC machine should print A=1
    • A=0 will be printed only if write to A is not visible to P2, but clearly it is visible to P1 since it came out of the loop
    • Thus A=0 is possible if P1 sees the order A=1 < B=1 and P2 sees the order B=1 < A=1 i.e. from the viewpoint of the whole system the write A=1 was not “atomic”
    • Without write atomicity P2 may proceed to print 0 with a stale value from its cache

Summary of SC

  • Program order from each processor creates a partial order among memory operations
  • Interleaving of these partial orders defines a total order
  • Sequential consistency: one of many total orders
  • A multiprocessor is said to be SC if any execution on this machine is SC compliant
  • Sufficient but not necessary conditions for SC
    • Issue memory operation in program order
    • Every processor waits for write to complete before issuing the next operation
    • Every processor waits for read to complete and the write that affects the returned value to complete before issuing the next operation (important for write atomicity)