Skip to the content ForoHackers
Log inJoin

mutex_mike

Joined 15 February 2024

Posts in the forum

  1. Replied in Reader-writer locks and the writer who never gets in: a timeline

    Right, Two Phase: the "DDL waits for a long query, then everything waits for the DDL" incident has the same shape as my diagram, just with a worse name. The cure is the same too: a timeout on the wai…

  2. Started Reader-writer locks and the writer who never gets in: a timeline

    A reader-writer lock lets many readers in at once, or exactly one writer. The tempting implementation, "readers may enter whenever no writer is *active*", has a nasty property: if readers keep arrivi…

  3. Replied in Lost wakeups: the condition variable bug that works 999 times in 1000

    That is the signature: nothing in the code changed, only the schedule. A stress test that spins 64 threads for a minute finds this more often than a month of code reading.

  4. Started Lost wakeups: the condition variable bug that works 999 times in 1000

    A bug I keep seeing in code review: the lost wakeup. Condition variables are easy to use wrong in a way that works 999 times out of 1000. ```c /* waiter */ pthread_mutex_lock(&m); if (!ready) …

  5. Replied in You cannot average percentiles (a dashboard bug I keep seeing)

    Related trap: measuring latency at the server only sees the requests the server accepted. A request that waited in a queue before being accepted is not in your histogram. Under overload your p99 look…

  6. Replied in I reported 97% accuracy and it was data leakage. A post-mortem.

    Mine is the same shape in a different field: a benchmark where the second run was twice as fast as the first. The cache had been warmed by the previous run. A result that is great and was not predict…

  7. Replied in "Exactly-once delivery" is at-least-once plus a dedup you must design

    Good one, Carl. Duplicates per hour is one of the first graphs I draw on any queue.

  8. Started "Exactly-once delivery" is at-least-once plus a dedup you must design

    A message broker can lose an acknowledgement in transit. Consumer processes a message, crashes before acking, broker redelivers. Or the consumer acks but the ack is lost, same result. You can only ch…

  9. Replied in A 20-line TLA+ spec finds the lost update before you write the code

    I love that the counterexample is a four-line timeline. The thing I tell sceptical colleagues: the model checker does exhaustive interleaving and your brain does the three most likely ones.

  10. Replied in Two-phase commit: all the commitment issues, none of the closure

    One extra picture of the in-doubt window: ``` Coord: --collect votes--[crash]..................recover--decide A: --prepared (locks held) ---------------------------> ? B: --prepared (loc…

  11. Replied in End-to-end checksums: the disk's ECC does not cover the whole path

    Same principle as in networking: you cannot rely on a lower layer's guarantee for an end-to-end property. The only check that counts is made by the endpoint that cares.

  12. Replied in Lamport clocks vs vector clocks, with a timeline you can check by hand

    Agreed, Rita. Lamport and vector clocks capture causality only. "Concurrent" here means "neither could have influenced the other", not "at the same instant".

  13. Started Lamport clocks vs vector clocks, with a timeline you can check by hand

    Two processes, P1 and P2, one message. Each event gets a Lamport counter `L` and a vector `V`. Rules. Lamport: tick on every event; on receive, `L = max(local, msg) + 1`. Vector: each process owns o…

  14. Replied in Why does a dynamic array double its size? (amortized cost)

    That hiccup is why real-time code preallocates. In a low-latency path I want worst-case, not amortized. An average that includes a 40 ms pause is not an average anyone wants to experience.

  15. Replied in Before you design the protocol: write down the failure model

    Add one under network: "messages can arrive after the sender has crashed". People assume a message from a dead node cannot appear. It can, and it will be processed as if the node were alive.

  16. Replied in Lock-free is not wait-free (a timeline)

    Right, steps, not seconds. A wait-free algorithm on a starved thread is still late. It is just guaranteed to be late in a bounded number of instructions.

  17. Started Lock-free is not wait-free (a timeline)

    These two terms get mixed up constantly. Short version: - **Blocking**: if the thread holding a lock is descheduled, everyone waits. - **Lock-free**: *some* thread always makes progress, but an indi…