Previous | Next --- Slide 23 of 30
Back to Lecture Thumbnails
smklein

Using 4 bytes for a pointer and 4 bytes for two shorts, it seems like it would be possible to use cmpxchg8b for a "Triple compare and swap" on x86 (the same idea extends to x86-64 systems). Do complex lock-free data structures make use of this ability? Or is there a reason to avoid doing so?

kayvonf

Honestly, I have no idea. If anyone does run into this case, certainly let us know.

dfarrow

On x86 architectures, read-modify-write instructions (like CMPXCHG) should be prefixed with a LOCK, which will cause the next instruction to be executed atomically. There's a short writeup of the concept here, and a longer writeup here.