Intermediate Assembly Language
Q58 / 100

What is CMPXCHG used for?

Correct! Well done.

Incorrect.

The correct answer is B) Atomically comparing a memory location to EAX and, if equal, replacing it with another register value

B

Correct Answer

Atomically comparing a memory location to EAX and, if equal, replacing it with another register value

Explanation

LOCK CMPXCHG [mem], ECX: if [mem]==EAX, store ECX; else load [mem] into EAX. This is the CAS (Compare-And-Swap) operation for lock-free algorithms.

Progress
58/100