💾 Archived View for yujiri.xyz › software › guide › os.gmi captured on 2023-01-29 at 04:46:05. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Learn programming for good instead of profit
What really *is* an operating system, and why are there different ones? I think the best way to explain it is to ask: how does a computer run multiple programs at once? Since those programs don't know about each other and they're both storing their data in the same physical memory device and running on the same CPU, what stops them from clobbering each other?
This is the basic role of an operating system, or more precisely, a kernel: it manages the multiple programs you want to run in such a way that they don't clobber each other. The kernel is the first program that starts when you boot the computer. It is the only program with direct access to all the hardware. When you start a program, the kernel assigns some region of memory to that program, and allows it to access only that region. The kernel also shares the CPU; it pauses and resumes programs to give them all a turn with the CPU. (These "turns" are tiny fractions of a second, which makes it look to a human like programs run "at the same time" even if that's not actually the case.)
While we sometimes use the term "operating system" to just mean a kernel, it can also be more broad than that, including other basic software components that end-user programs rely on. (This is why we don't normally think of Android phones and Linux desktops as having the same operating system, even though Android actually uses the Linux kernel.)