Previous | Next --- Slide 24 of 52
Back to Lecture Thumbnails
woohoo

A memory fence enforces an ordering on memory accesses before and after the fence. Basically, it says not to reorder memory accesses to the other side of the fence. This is different from barriers, which requires all computations by all threads before the barrier to complete before any after the barrier begins.

williamx

If we put a memory fence between every operation, it seems like we can allow any type of re-orderings and still maintain sequential consistency. However, this seem to be very inefficient. Are there programs that allows re-ordering and uses memory fences sparsely to speed up their runtime?

kayvonf

@williamx. If you had a fence between memory operations you by definition are no longer allowing any memory reorderings! And your comment about cost is exactly why processor architects decide to relax orderings in some situations.

Firephinx

I couldn't really find a definition for weak ordering on google except for a page that talked about sets. Does weak ordering mean weak consistency as in the wikipedia page?

kayvonf

@Firephinx. You'll need to go pretty far back! Weak ordering has a specific definition where memory ordering is relaxed in many situations, but importantly, not relaxed on special synchronization operations. (Obviously the details of weak ordering are not important to the course, but you may enjoy thumbing through the following...)

Weak Ordering - A New Definition Adve and Hill ISCA 90

And the original: Memory access buffering in multiprocessors -- Dobois et al. ISCA 1986.