Low-level design
Object-oriented design for interviews: the framework, design principles and patterns, concurrency, and problem breakdowns you can practice in the code runner.
Object-oriented design for interviews: the framework, design principles and patterns, concurrency, and problem breakdowns you can practice in the code runner.
9 write-ups
| Title | Difficulty |
|---|---|
| Build a Semaphore, Latch and Barrier Build a counting semaphore, a countdown latch and a reusable barrier from one lock and a condition variable, and learn the wait loop behind every blocking primitive. | Medium |
| Design a Bounded Blocking Queue Design a fixed-size FIFO queue that makes producers wait when it is full and consumers wait when it is empty, built from one lock and two condition variables. | Medium |
| Design a Connection Pool Design a database connection pool with a size limit, callers that wait in line with a timeout, idle timeouts, dead connections dropped and replaced, and a thread-safe version. | Medium |
| Design a Deadlock Detector Design a lock manager that builds a wait-for graph, detects a deadlock the moment it forms, picks a victim to abort, and hands its locks to the next waiters, safely across threads. | Medium |
| Design a Loading Cache Design a thread-safe cache that loads missing values through a loader, runs one load per key when many threads miss at once, expires entries after a TTL, and never caches failures. | Medium |
| Design a Rule Engine Design a fraud rule engine for card payments, with conditions composed from AND, OR and NOT, velocity rules, the most severe action winning, and safe rule changes under concurrent load. | Medium |
| Design Concurrent Bank Transfers Design a bank where many threads move money between accounts at once, with per-account locks taken in a fixed order so transfers never deadlock and the total is always conserved. | Medium |
| Design Dining Philosophers Let n philosophers share n forks with no deadlock and no starvation, from why "left fork first" gets stuck to a fair waiter that hands out both forks at once. | Medium |
| Implement a Read-Write Lock Build a read-write lock from a mutex and a condition variable, with writer preference so writers never starve, try methods, and the upgrade, reentrancy and fairness follow-ups. | Medium |