How Modern Software Really Runs on a CPU
From machine code to Kubernetes — the same problem, solved again at every altitude.
You write code, deploy it with kubectl apply, and a container starts somewhere. This pathway is what actually happens in between — from the CPU executing machine instructions, through the OS process model and Linux isolation primitives, to how Kubernetes decides where your workload runs and how much CPU it's allowed to use.
Every layer in this stack solves the same problem again: who gets the CPU, and for how long? An operating system answers it for processes on one machine. Kubernetes answers it for containers across a fleet. This route follows that question from the fetch-execute cycle inside a single core to the scheduler deciding which node your Pod lands on — so the YAML field you fill in without thinking has a mechanism behind it, not just documentation.
16 steps live · 5 sites
What you'll be able to do
- →Trace a running program from CPU instructions to a Kubernetes Pod, in one continuous chain.
- →Explain what a process, a thread, and a container actually are — by mechanism, not analogy.
- →Read
resources.requestsandresources.limitsas what they really are: cgroup CPU shares and memory limits. - →Diagnose CPU throttling and OOMKilled Pods from first principles, not guesswork.
The Machine Underneath
What Actually Happens When Your Code Runs
Computer Science · EssentialsBefore anything else here makes sense: the CPU doesn't run Python. It runs this.
A CPU executes exactly one language: machine code, opcodes read one at a time in a fetch-decode-execute loop. Every abstraction in every language you write eventually reduces to this tiny vocabulary — demonstrated here with a real compiled function and its disassembly across six languages.
Compilers vs. Interpreters
Computer Science · EfficiencyHow the code you actually wrote turns into the instructions from step one.
"Python is interpreted, Go is compiled" is why Go starts instantly and Python spins up a virtual machine first. Covers what a compiler and an interpreter actually do to your source before a single instruction from step one ever runs.
The Stack, the Heap, and Virtual Memory
Computer Science · EssentialsEvery process believes it owns all the RAM. Here's the lie, and who's telling it.
Every process believes it owns all the RAM on the machine, starting at zero — a fiction the OS maintains via the MMU and page tables, translating each process's private addresses to real physical RAM. That translation is the actual mechanism behind process isolation, and the reason a stack overflow has a hard, fixed ceiling.
Operating System Basics
Computer Science · EfficiencyKernel mode, user mode, and the syscall that separates them.
CPU privilege rings, not politeness, are what stop your code from touching hardware directly — user-space code reaches the kernel only through the single, audited door of a system call. A real strace walkthrough shows what that boundary costs, and why buffering writes instead of calling one at a time is measurable advice, not folklore.
Processes and Threads
Computer Science · EfficiencyThe unit the OS actually schedules — and what it costs to switch between them.
A process is fully isolated and expensive to create; a thread shares its process's memory and is cheap — that one difference is the entire trade between them. Context switching is what makes many of them look simultaneous on too few cores, and it isn't free either.
How the OS Scheduler Actually Decides
Computer Science · EfficiencyThousands of processes, one CPU. The algorithm that decides who runs next.
Linux's CFS scheduler always runs whichever runnable thread has received the least CPU time so far — a real, checkable value called vruntime, not a vague priority suggestion. This is the exact shape of problem Kubernetes solves again a few steps later, across a fleet of machines instead of one core.
One Kernel, Many Machines
Linux Processes
Linux · EssentialsThe theory made concrete: ps, kill, and the process tree on a real machine.
ps, kill, signals, and process states made concrete on a real machine — the operating-system theory from the last several steps, now something you can run yourself and read the output of.
Namespaces and cgroups
Linux · EfficiencyHow one kernel convinces a process it's alone on the machine.
Namespaces control what a process can see; cgroups control how much it can use — the same two kernel mechanisms, stacked together, are what make a container a container, long before Docker or Kubernetes existed.
Where Your Memory Actually Goes: Swap and the OOM Killer
Linux · EfficiencyWhat happens when the memory a process was promised runs out.
When RAM and swap are both exhausted, the kernel's OOM killer picks a victim by oom_score and terminates it on purpose — not a crash, a deliberate decision, and the exact mechanism behind a Kubernetes Pod going OOMKilled a few steps later.
Who Decides Which CPU
Kubernetes Architecture
Kubernetes · EssentialsWho's actually deciding anything, across a fleet of these machines.
A working mental model of a cluster: the control plane that decides, the nodes that run your Pods, and the reconcile loop tying them together — just enough machinery to make the rest of this pathway's Kubernetes steps precise.
The CRI: How kubelet Talks to Container Runtimes
Kubernetes · EfficiencyThe exact handoff from kubelet to the container runtime underneath.
kubelet never talks to containerd or CRI-O directly — it goes through the Container Runtime Interface, a deliberate abstraction that is why "Docker support removed" never actually broke anything. The full chain from kubectl apply to a running Linux process, named end to end.
The Kubernetes Scheduler
Kubernetes · EfficiencyThe same problem as step 6, at cluster scale: which machine runs this next?
Every unscheduled Pod goes through filtering (which Nodes even qualify) then scoring (which qualifying Node is best) — the same shape of problem as the OS scheduler a few steps back, solved across a fleet instead of one CPU. Taints, tolerations, and node affinity are how you shape that decision on purpose.
Resource Requests and Limits
Kubernetes · EssentialsClose the loop: this YAML field is a cgroup CPU quota.
The payoff for the whole pathway: resources.limits.cpu and resources.limits.memory are a cgroup CPU quota and memory ceiling in a YAML costume, the exact Linux mechanisms from earlier steps. Includes the specific reason a Pod gets CPU-throttled while its usage graph looks perfectly calm.
Diagnosing Pod Failure States
Kubernetes · EssentialsWhen placement or limits go wrong, this is what it looks like from the outside.
CrashLoopBackOff, Pending, ImagePullBackOff, and OOMKilled each point to a different failure — different subsystems, different fixes — and kubectl describe pod's Events section almost always names the exact cause directly, once you know where to look.
Go Deeper
Diagnosing CPU Throttling and OOMKills in Production
coming soonKubernetes · MasteryThe theory pays off here: reading a throttled or OOMKilled Pod like a systems engineer.
Reading a throttled or OOMKilled Pod like a systems engineer, using every mechanism this pathway covered end to end. Reserved for the paid Mastery tier — coming soon.