|
|
|
|
|
|
|
Figure 8.37
Node example [104]. |
|
|
|
|
|
|
|
|
fenced (or synchronized) at the end of the last write, so that all writes must complete before a flag can be set to allow consumers of the line to read the line. Consumers, on the other hand, attempt to read shared data potentially at some time earlier than the flag is set by the producer. The consumer will spin, that is, continue to access, a read flag in the cache until the producer, by setting the flag, changes its state either by declaring the current value of the flag invalid or by simply updating it, depending upon the protocol. After the read flag is changed to a valid state, the consumer reads the shared data. Protocols differ in at least three ways: |
|
|
|
|
|
|
|
|
1. The time to complete the writes to the shared memory location. |
|
|
|
|
|
|
|
|
2. The time to notify the consumer of the newly written data. This corresponds to the time required to either invalidate or update the read flag. |
|
|
|
|
|
|
|
|
3. Protocols differ in the read latencythe time required for consumers to read the new data. |
|
|
|
|
|
|
|
|
A number of design choices can significantly affect the relative performance of a coherence protocol. All protocols profit by line prefetching. Figure 8.38a illustrates the actions that a producer must take in producing a series of values. It performs its computation, writes its values to memory, then does a fence operation to ensure all of the writes are completed before the final operation, the setting of a semaphore, is completed. The consumer, on the other hand, must wait until the semaphore is set before it can consume, or use, the written values. Invalidate-based protocols (Figure 8.38b) can use a write prefetch effectively by providing early invalidation of a line that will be written into. |
|
|
|
|
|
|
|
|
If this is performed at an auspicious time, it can overlap some of the delay in the fence latency. In the invalidate-based protocol, usually the reads should not be prefetched until the semaphore is set. Otherwise, fetched data will |
|
|
|
|
|