All Questions
Dealing With Contention medium

The CAS (Compare-And-Swap) operation is a hardware primitive used to implement lock-free structures. How does it work?

  1. A It swaps two memory addresses.
  2. B It encrypts the data.
  3. C Atomically: 'If value at address X is Expected, set it to New. Else, fail'. This allows logic like `while(!CAS(val, current, current+1))`.
  4. D It parses JSON.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions