Deadlock-Free Position Transfers Between Concurrent Trading Books
Last updated: November 29, 2026
Quick Overview
Build a thread-safe position keeper where many threads apply fills to trading books and move inventory between books, without deadlocks, lost updates, or a firm-wide total that ever drifts.
Point72
November 29, 20260
0
0 solved
Build a thread-safe position keeper where many threads apply fills to trading books and move inventory between books, without deadlocks, lost updates, or a firm-wide total that ever drifts.
Point72 engineers build the position and risk services that dozens of portfolio manager pods read in real time, so a fundamentals round often turns a simple shared-state problem into a concurrency exercise. The interviewer wants to see you pick a lock granularity, prevent the classic two-lock deadlock, and reason about what a consistent snapshot means while writes keep arriving.
What the Interviewer Expects
- Explain why a single global lock is correct but throttles unrelated books
- Use per-book locks and acquire them in a fixed global order for transfers
- Make transfers atomic: either both books change or neither does
- Protect the lazy creation of book state itself, not just the positions
- Describe how to take a consistent firm-wide total without stopping the world forever
- Write a concurrent test that would catch a lost update or a deadlock
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- How would you change this if reads outnumber writes by 100 to 1?
- What happens to tail latency of the firm-wide total as the number of books grows, and how would you avoid it?
- How would you design this without locks, for example with a single-writer event loop per shard?
- If transfers span two processes, how do you keep the invariant?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
fill(book, symbol, qty) adds to one book. transfer(src, dst, symbol, qty) moves inventory and must reject (and change nothing) if the source is short. snapshot(book) returns that book's position...
High-Level Design
One global lock is trivially correct but serialises every pod against every other pod. Instead each book gets its own lock. A registry lock guards only the map of books, so creating a book on first us...