CMD + K

Kapittel 9 · Tråder, locks og condition variableslocks

Test-and-Set: Building a Lock with One Atomic Instruction

0:54Fortellerstemme
0:00 / 0:00

Test-and-set lock — a single atomic hardware instruction reads a flag's old value and writes one in the same step; threads that read zero own the lock, threads that read one spin until it is released

spin locktest-and-setatomic instructionmutual exclusionbusy waiting