the OS as a resource manager
A computer has only so much to go around: usually a handful of CPU cores, a fixed amount of memory, one disk, one network card, one screen. But you run dozens of programs that each behave as if they own the machine. Picture a single shared kitchen in a house full of cooks, each wanting the stove, the counter, and the sink at once. Without a manager it would be chaos — someone would grab the stove and never let go. The OS is that manager: it decides who uses each scarce resource, when, and for how long.
It manages three kinds of resource. Time-shared resources, like the CPU, are handed to one program for a brief slice and then taken back and given to the next, fast enough that everything seems to run at once (this is scheduling). Space-shared resources, like memory and disk, are divided into pieces and parcelled out, with the OS tracking who owns which piece so two programs cannot stomp on each other (this is allocation). Serially reusable devices, like a printer, are given to one user at a time, often through a queue. The OS keeps the books, grants and reclaims, and resolves competition fairly and safely.
This role explains a huge amount of the subject. CPU scheduling, memory allocation, deadlock, and disk scheduling are all just resource management done carefully. The honest catch is that there is no single right policy: maximizing fairness can hurt throughput, favoring interactive responsiveness can starve background work. The OS is constantly making trade-offs, and different operating systems make them differently — which is one reason a server OS feels different from a phone OS.
Two programs both ask for 3 GB on a machine with 4 GB of RAM. They cannot both have it at once, so the OS keeps part of one program's data on disk (in swap) and pages it back in when needed, juggling the limited memory so both can make progress — slower, but possible.
Allocation under scarcity: nobody gets everything, but everyone gets a turn.
Resource management is not the same as making things fast — it is about sharing safely and fairly. A perfectly managed system can still be slow if the underlying resource is simply too small for the demand.