← 💻 Coding for Infra
Advanced
Concurrency in Python, Go and C++
Infrastructure code is concurrent by nature: a loader feeding a GPU, a gateway holding ten thousand streams, a controller reconciling a fleet. The coding screen tests whether you know which primitive fits which problem in the language you claim, and the three languages the field uses answer differently: Python has one interpreter lock and an event loop, Go has cheap goroutines and channels, C++ has threads, mutexes and atomics with no safety net. This page gives the model of each, works the favourite problems (a thread-safe LRU, a worker pool, a bounded fan-out) in each, and derives when threads, processes or async buy throughput.
Unlock the full curriculum — ₹2,000 / $25every concept + every answer · 6 months · no auto-renew
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
Coding for InfraWrite a thread-safe counter in C++ that many threads increment. What are the memory-ordering and layout choices?→Coding for InfraIn Go, download many model shards concurrently with a concurrency limit, a timeout and clean cancellation. Write it.→Coding for InfraImplement a batcher that flushes when the batch is full or when a timeout expires. What breaks in the timer path?→Networking, Interconnects & StorageWhat does NCCL actually do when you call all-reduce, and how does it decide which algorithm to use?→CUDA, Triton & Kernel EngineeringSum 100 million floats on the GPU as fast as the hardware allows. Write the kernel and justify each step.→LLM Inference & ServingYou have eight H100s and Llama 3.1 70B. How many concurrent users can you serve, and what changes the number?→
