Linearizability and Checking a History · seed 1 · A4, ink-friendly. The answer key prints on its own page for grown-ups.
به انگلیسی

One instant per operation

Computing · Networks & Security · ages 22-23
Name ______________________   Date ____________
  1. The value of x starts at 1. A write of x = 2 finishes. Then a read of x starts. No other operation runs. What must the read return?

    • 1, the value from before
    • 2
    • Either 1 or 2
  2. Each operation appears to take effect at one instant. Where must that instant sit?

    • Somewhere between its call and its return
    • At the moment the server first hears about it
    • Just after its return, once the client has the answer
  3. A write of x = 4 finishes. Then two reads start one after the other, and both return 4. This history is linearizable.

    Circle one:   True   False

  4. A write of x = 1 starts and finishes. Then a write of x = 2 starts and finishes. Then a read starts and returns 1. What is the verdict?

    • Not linearizable: the read missed the latest write
    • Linearizable, because the read is allowed to be stale
    • Linearizable, if the two writes are swapped in order
  5. A write of x = 1 and a write of x = 2 overlap in time. A read that overlaps both returns 1. Is there a single-object explanation?

    • No, overlapping writes never allow any valid order
    • No, a read that overlaps a write must return 2
    • Yes: write 1, then the read, then write 2
  6. The client times and the server's private log disagree about which operation ran first. What decides the check?

    • The order the server wrote the operations to its log
    • The order the replicas applied them to disk
    • The call and return times the clients saw
  7. Write A finishes. Then write B starts. A read that overlaps write B returns B's value. Which order explains it?

    • B, then A, then the read
    • A, then B, then the read
    • A, then the read, then B
  8. A database runs every transaction in some valid order. But a read that starts after a write finishes sometimes returns the old value. What is true?

    • It is linearizable, since the order is valid
    • It can be serializable but not linearizable
    • It is neither, because stale reads break every model
LightMySky · lightmysky.comW1-mt_lTaHmlGtuo-s1

Answer key

For grown-ups. Fold this page away before handing over the rest.

One instant per operation W1-mt_lTaHmlGtuo-s1

  1. 2 · Real-time order is law: the finished write comes first.
  2. Somewhere between its call and its return · The instant belongs to the operation, so it lives inside its window.
  3. True · The write comes first and both reads return its value, so one order explains every answer.
  4. Not linearizable: the read missed the latest write · The read started after both writes finished, yet it returned the older value.
  5. Yes: write 1, then the read, then write 2 · All three operations overlap, so any order is allowed. Write 1, then the read, then write 2 makes the read return 1.
  6. The call and return times the clients saw · The check uses client-observed windows, never server order.
  7. A, then B, then the read · A finished before B started, so A comes first. The read returns B, so it sits after B.
  8. It can be serializable but not linearizable · A valid transaction order is serializable. Linearizability also needs real-time order, and a stale read breaks that.
Worksheet · LightMySky