Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

lock prefix

The x86-64 prefix byte (f0) that makes the memory update of the instruction after it atomic, as in lock add.

The lock prefix (0xF0) makes a read-modify-write instruction with a memory destination (add, sub, inc, and, or, xor, xadd, cmpxchg, bts ...) atomic, by holding the cache line in exclusive state for the duration; it also acts as a full memory barrier. xchg with memory is implicitly locked.

Examples

  • lock add qword ptr [rdi], 1 is an atomic increment on x86-64.

Read the full section →