Skip to content
Log in

Concurrency Review

Names the shared mutable state first, because every concurrency bug in the code follows from it.

0

Share this prompt

Free — no card needed

Create a free account

to open Concurrency Review — and the other 364 prompts across 21 categories.

We store your email address to send these. We never sell it or pass it to advertisers. Withdraw at any time. Privacy Policy.

Already have an account?

CategoryCodingForDevelopersTested onClaudeChatGPT

Running it, start to finish

  1. List every piece of shared mutable state before analysing anything.
  2. Fix the check-then-act cases with atomic operations or constraints.
  3. Verify the synchronisation holds across multiple instances.

What you get back

The output this produces, every time.

  • Enumerates shared mutable state first, which makes the rest of the analysis tractable.
  • Finds every check-then-act shape, the most common source of production races.
  • Asks whether synchronisation survives multiple instances, which is where scaling breaks things.

Getting better results

Where this usually goes wrong, and how to avoid it.

  • Include the state you forget is state. Lazy singletons, memoised values and counters are shared mutable state and are where the surprising races live.
  • Prefer a database constraint. For exists-then-create, a unique constraint cannot be forgotten by a future caller the way a lock can.
  • Check locks held across I/O. It is correct and it destroys throughput, and it only shows up under load.

More Coding prompts

All Coding

Written for The AI University. Every prompt in this library is original work — authored, tested and revised here, not collected from elsewhere. 365 of them, free with an account.