Previous | Next --- Slide 15 of 30
Back to Lecture Thumbnails
Q_Q

On a strong memory consistency model processor, this bounded queue (also a circular buffer) doesn't need any sort of locking because the producer never modifies head and the consumer never modifies tail. They do read each other's variables, but this is okay because tail and head only ever increment. Since the purpose of reading the other party's variable is to prevent getting ahead of the other party, reading a stale value which has not been incremented yet is safe, because reading a stale value will not cause either party to overrun the other one.