09.08.2013 Views

Design and Verification of Adaptive Cache Coherence Protocols ...

Design and Verification of Adaptive Cache Coherence Protocols ...

Design and Verification of Adaptive Cache Coherence Protocols ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.5 Soundness Pro<strong>of</strong> <strong>of</strong> the Base Protocol<br />

Soundness <strong>of</strong> a cache coherence protocol means that the TRS specifying the protocol can be<br />

simulated by the TRS specifying the memory model. In this section, we prove the soundness<br />

<strong>of</strong> the Base protocol by showing that CRF can simulate Base. We de ne a mapping function<br />

from Base to CRF, <strong>and</strong> show thatany imperative rule <strong>of</strong> Base can be simulated in CRF with<br />

respect to the mapping function. The soundness <strong>of</strong> the Base protocol follows from the fact that<br />

all the Base rules can be derived from the Base imperative rules.<br />

Before delving into the pro<strong>of</strong>, we present some invariants that will be used throughout the<br />

pro<strong>of</strong>. The invariants also help us underst<strong>and</strong> the behavior <strong>of</strong> the protocol.<br />

4.5.1 Some Invariants <strong>of</strong> Base<br />

Lemma 1 consists <strong>of</strong> two invariants that describe the correspondence between cache states <strong>and</strong><br />

messages in transit. An address is cached in the <strong>Cache</strong>Pending state, if <strong>and</strong> only if there is a<br />

<strong>Cache</strong>Req or <strong>Cache</strong> message between the cache <strong>and</strong> the memory. An address is cached in the<br />

WbPending state, if<strong>and</strong>onlyifthereis a Wb or WbAck message between the cache <strong>and</strong> the<br />

memory.<br />

Lemma 1 Given a Base term s,<br />

(1) Cell(a,-,<strong>Cache</strong>Pending) 2 <strong>Cache</strong> id(s) ,<br />

Msg(id ,H,<strong>Cache</strong>Req,a) 2 MinCout id (s) _ Msg(H,id ,<strong>Cache</strong>,a,-) 2 MoutCin id (s)<br />

(2) Cell(a,v,WbPending) 2 <strong>Cache</strong> id(s) ,<br />

Msg(id ,H,Wb,a,v) 2 MinCout id (s) _ Msg(H,id ,WbAck,a) 2 MoutCin id (s)<br />

Pro<strong>of</strong> The pro<strong>of</strong> is based on induction on rewriting steps. The invariants hold trivially for<br />

the initial term where all caches <strong>and</strong> queues are empty. It can be shown by checking each rule<br />

that, if the invariants hold for a term, they still hold after the term is rewritten according to<br />

that rule. 2<br />

Lemma 2 means that there exists at most one message in transit between the same source <strong>and</strong><br />

destination regarding the same address. This implies that the soundness <strong>and</strong> liveness <strong>of</strong> the<br />

Base protocol are not contingent upon the FIFO order <strong>of</strong> message passing.<br />

Lemma 2 Given a Base term s,<br />

msg1 2 s ^ msg2 2 s )<br />

Src(msg1) 6=Src(msg2) _ Dest(msg1) 6= Dest(msg2) _ Addr(msg1) 6=Addr(msg2)<br />

Pro<strong>of</strong> The pro<strong>of</strong> is based on induction on rewriting steps. The invariant holds trivially for<br />

the initial term where all queues are empty. It can be shown by checking each rule that, if the<br />

invariant holds for a term, it still holds after the term is rewritten according to that rule. Note<br />

that a cache can send a message only when the address is uncached or cached in a stable state<br />

(which means there is no message between the cache <strong>and</strong> the memory regarding the address),<br />

while the memory can send a message only when it receives an incoming message. 2<br />

76

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!