Quiz Entry - updated: 2026.07.14
What is the role of the operating system?
The OS protects the hardware from misuse and gives programs simple, uniform abstractions for it — processes, virtual memory, and files.
It sits between programs and the machine so that no single buggy or malicious program can monopolize the CPU, corrupt another program's memory, or talk to devices directly — everything risky is funneled through the kernel.
Two main roles:
- Protect hardware from misuse by buggy/malicious programs
- Provide simple, uniform mechanisms for hardware manipulation
Three fundamental OS abstractions:
| Abstraction | Abstracts Over | Purpose |
|---|---|---|
| Processes | Processor | Illusion of dedicated CPU |
| Virtual Memory | Main memory | Illusion of dedicated memory |
| Files | I/O devices | Uniform interface for all I/O |
Why these abstractions exist:
- Without processes, one buggy program could crash the whole system
- Without virtual memory, programs would fight over memory addresses
- Without file abstraction, every program would need disk/network/device drivers!
Protection Rings (x86):
- Ring 0 (Kernel): Full hardware access - can execute ANY instruction
- Ring 1-2 (Device drivers): Limited access (rarely used in modern OSes)
- Ring 3 (Applications): Most restricted - can only execute "safe" instructions
Why rings matter for security:
- Malware in Ring 3 can't directly access hardware or other processes
- Even if your browser is compromised, it can't read kernel memory
- Kernel bugs (Ring 0) are much more dangerous than userspace bugs
Tip: Ring 0 = "Root/God mode", Ring 3 = "Restricted/User mode". Lower ring number = more power.
Go deeper:
Operating system (Wikipedia) — managing and protecting hardware, isolating programs, and abstracting devices behind common services.