Exercise 2: Why Memory Kills but CPU Throttles — Possible Solution ==================================================================== The property that explains the difference, per the chapter's own tip-box: whether the resource is COMPRESSIBLE or NOT. CPU is a COMPRESSIBLE resource. A container that's given less CPU time than it wants doesn't fail or crash -- it simply runs more SLOWLY. The runtime can reduce the container's share of CPU cycles gradually and continuously, and the container keeps functioning, just less performantly. Because there's a smooth, safe way to reduce CPU consumption without destroying anything (the process doesn't lose any data or state by getting fewer CPU cycles), throttling -- gradually restricting how much CPU time the container gets -- is a viable enforcement mechanism. Memory is NOT a compressible resource in the same way. A process that has already allocated a certain amount of memory (variables, cached data, program state, all held in that memory) cannot simply be told "use less memory right now" the way it can be told "use less CPU right now" -- there's no safe, graceful way to forcibly shrink a process's already-allocated memory without destroying data or corrupting its running state. Per the chapter, "there's no graceful way to 'un-allocate' memory a process is already using." Because there's no safe intermediate action available, the ONLY enforcement option left once a memory limit is exceeded is to kill the container outright (the OOM-kill) and let it restart fresh, rather than trying to partially reduce its memory usage in place. Summary: CPU can be smoothly throttled because reducing CPU time doesn't destroy anything the process already has. Memory can't be smoothly "throttled" the same way, because a process's already- allocated memory represents real state that can't be safely and partially taken back -- so exceeding the limit forces an all-or- nothing kill instead of a graceful reduction. WHY THIS WORKS AS AN ANSWER ------------------------------ This names the specific property (compressible vs. non-compressible) the chapter attributes to each resource type and explains WHY that property specifically determines which enforcement mechanism (gradual throttling vs. an all-or-nothing kill) is even possible for each -- rather than simply restating that they behave differently without explaining the underlying reason.