All Questions
Dealing With Contention hard

How does a Ticket Lock ensure fairness?

  1. A Like a deli counter. Threads take a ticket (fetch-and-add). The lock holds a 'Serving' number. Threads spin until Ticket == Serving. This guarantees FIFO order.
  2. B It uses random numbers.
  3. C It uses checking accounts.
  4. D It blocks indefinitely.

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

Get the app

Related questions