Module 9: Addendum to Module 6: Shared Memory Multiprocessors
  Lecture 18: Sharing Patterns and Cache Coherence Protocols
 


Sharing Patterns

  • Producer-consumer (initially flag, done are zero)

    T0: while (!exit) {x=y; flag=1; while (done != k);
    flag=0; done=0;}
    T1 to Tk : while (!exit) {while (!flag); use x;
    done++; while (flag);}

    • Exit condition not shown
    • What if T1 to Tk do not have the outer loop?
  • Migratory (initially flag is zero)

    T0: x = f0(x); flag++;
    T1 to Tk : while (flag != pid ); x = f1(x); flag++;

    • Migratory hand-off?

Migratory Hand-off

  • Needs a memory writeback on every hand-off
    • r0, w0, r1 , w1, r2 , w2, r3 , w3, r4 , w4, …
    • How to avoid these unnecessary writebacks ?
    • Saves memory bandwidth
    • Solution: add an owner state (different from M) in caches
    • Only owner can write a line back on eviction
    • Ownership shifts along the migratory chain