# os & concurrency
// [27] real interview questions. Answers and sources live in the practice app.
practice this topic- What is a process, and what does the OS actually set up when it creates one?(junior)
- You're designing a service that handles many independent tasks. Processes or threads — and when does the difference actually matter?(mid)
- What is context switching, and why is it expensive?(mid)
- Your service occasionally freezes with several threads stuck forever. What is a deadlock and how would you confirm that's what you're seeing?(mid)
- Deadlock prevention vs deadlock detection — which strategy do real systems use, and why?(senior)
- What is a race condition? Give a concrete example and how you'd fix it.(mid)
- How does paging work, and what role does the TLB play?(mid)
- A production box's CPU shows high 'system' and I/O wait, throughput has collapsed, and the disk is constantly busy — but the app isn't doing more work. What's likely happening?(senior)
- ps shows processes in state Z marked <defunct> piling up on your server. What are they and how do you get rid of them?(mid)
- What is Inter-Process Communication (IPC)? Compare the main mechanisms and when you'd pick each.(mid)
- What does the volatile keyword do in Java, and when is it the right tool instead of a lock?(mid)
- What is ThreadLocal, when is it the right choice, and what's the classic production bug it causes?(senior)
- A worker thread in your service dies silently and work just stops. How do you catch exceptions thrown in another thread?(senior)
- What actually happens when your program calls read()? Explain user mode vs kernel mode and system calls.(mid)
- Why does Unix split launching a program into two calls, fork() and exec()? What does each do?(mid)
- fork() logically copies the whole address space — yet forking a 10 GB process is nearly instant. How?(senior)
- What is a page fault, and why isn't every page fault a bug?(mid)
- Stack vs heap: what lives where, and what exactly is a stack overflow?(junior)
- kill vs kill -9: what's the difference between SIGTERM and SIGKILL, and how does graceful shutdown actually work?(mid)
- kill -9 does nothing to a process, and ps shows it in state D. What's going on and what can you actually do?(senior)
- Your service vanished with exit code 137 and no application logs; dmesg says 'Out of memory: Killed process'. Explain the OOM killer.(senior)
- uptime shows load average 1.43, 2.34, 2.78 — what do the three numbers mean, and when is a high load actually bad?(mid)
- Your server starts throwing 'Too many open files'. What is a file descriptor, and how do you debug this?(mid)
- What actually isolates a Docker container? Compare the mechanism with a virtual machine.(mid)
- You're deploying (a) your own microservices and (b) untrusted code submitted by customers. Containers, VMs, or both — and why?(senior)
- Why are container images built as layers, and what do you gain — and risk — from that design?(mid)
- You type notes on the subway with no signal, and later they silently appear on your laptop. How does an app let you work offline and reconcile changes when the network comes back?(mid)