yujiri.xyz

Software

Learn programming for good instead of profit

How does an operating system work?

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 overwriting each other's data?

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 so they all get a turn with it. (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 uses the Linux kernel.)

Proxied content from gemini://yujiri.xyz/software/guide/os.gmi

Gemini request details:

Original URL
gemini://yujiri.xyz/software/guide/os.gmi
Status code
Success
Meta
text/gemini; lang=en
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.

What is Gemini?