Previous | Next --- Slide 39 of 43
Back to Lecture Thumbnails
ppwwyyxx

Sense reversal fixes the previous incorrect implementation by not clearing the flag bit. It instead wait for flag to become an alternating value in every call to barrier(). In the first call, everyone waits for flag to be 1. In the next call, everyone waits for it to become 0. This way a consecutive call won't mess things up with the previous call.

monkeyking

Use a local_sense instead of a global one so that we don't need to invalidate cache once we flip it.

ote

This short video was a really helpful visualization of sense reversal, since I was having a difficult time wrapping my head around it, and I think it may be helpful for others as well.