Compiling brilliance
Did you know? An LRU cache is a HashMap + a doubly-linked list → O(1) get & put.
Compiling brilliance
Did you know? An LRU cache is a HashMap + a doubly-linked list → O(1) get & put.
Tag
13 articles tagged concurrency.
Concurrency patterns explained: producer-consumer, thread pool, future, read-write lock, thread-safe singleton, and a semaphore-bounded pool for safe multithreaded design.
The Uber ride concurrency interview question: seat ride-request threads into cabs of four — 4+0, 0+4, or 2+2 only — with a mutex, two semaphores, and a barrier. Deadlock-free, stress-tested.
A ride sharing system design (Uber/Ola-style): the geospatial cell index that finds nearby drivers fast, the driver offer as a hold with a TTL, the double-match race, and surviving a hot region.
A movie ticket booking system design (BookMyShow-style): the data model, a seat-hold with a TTL, stopping double-booking with an atomic update, and idempotent payment at scale.
A low-level design walkthrough of a web crawler core: the frontier queue, URL normalization before deduplication, a shared seen-set, per-host politeness, and termination by in-flight count.
A low-level design walkthrough of an online voting system: separating eligibility from the ballot so one vote per voter never links who voted to what, with an append-only, recountable tally.
A low-level design walkthrough of a download manager: splitting a file into byte-range segments, downloading them in parallel with retries, and resuming after a crash from an on-disk journal.
A low-level design walkthrough of a thread pool: the bounded work queue, the worker loop that must never die, saturation and rejection, and the graceful shutdown promise — fully tested.
A low-level design walkthrough of an inventory management system: on-hand vs reserved vs available, two-phase reservations with commit and release, and the race that double-sells the last unit.
A low-level design walkthrough of a rate limiter: the token bucket class, the race condition that breaks it, making it thread-safe, a per-client registry, and the complete implementation.
A friendly tour of multithreading: threads, race conditions, synchronized, wait/notify — then the classic interview questions, odd-even printing, producer-consumer and deadlocks, solved and explained.
A low-level design walkthrough of an O(1) LRU cache — a hash map plus a doubly linked list — how eviction works, the locking story, and the full browsable implementation.
The system design classic: where a rate limiter sits in your architecture, fixed window vs sliding window vs token bucket, going distributed with Redis, and a thread-safe core you can ship.