OS design issues
Design goals, mechanism vs policy, implementation — with a sorting quiz.
Operating-system design issues
Goals, mechanism versus policy, implementation choices — and the recurring questions every OS designer faces.
Start from the goals
User goals
- Convenient to use
- Easy to learn
- Reliable and safe
- Fast
System goals
- Easy to design, implement and maintain
- Flexible
- Reliable and error-free
- Efficient
A hard real-time controller ranks predictability first; a phone ranks battery life and touch response; a cloud server ranks throughput, isolation and uptime; a desktop ranks responsiveness. There is no single best OS — only an OS that fits its goals.
Mechanism vs policy
Mechanisms determine how to do something; policies decide what will be done. Keeping them separate means a policy can change (by setting a parameter) without re-engineering the mechanism.
| Mechanism (how) | Policy (what / which) |
|---|---|
| Hardware timer interrupt | Time slice of 10 ms for interactive users, 100 ms for batch |
| Priority-based ready queue | I/O-bound processes get higher priority than CPU-bound ones |
| Page-replacement framework | Evict the least recently used page (LRU) |
| File permission bits (rwx) | Only faculty may write to the marks file |
| Loadable-module loader | Only signed modules may be loaded |
“Processes of the user `root` always get a larger CPU share.”
The code that saves registers of one process and loads those of another (context switch).
“Disk requests are served in order of nearest cylinder first.”
The mode bit that distinguishes user mode from kernel mode.
Implementation
Early OSes were written entirely in assembly language. Modern ones are written mostly in C or C++, with assembly only where the hardware must be touched directly — boot code, interrupt entry and the context switch. Linux is now adding Rust for memory-safe drivers.
Advantages of a high-level language
- Code is written faster, is more compact, and easier to understand and debug.
- Compiler improvements speed up the whole OS by recompiling.
- Portable — Linux runs on x86, ARM, RISC-V and more from one code base.
Possible disadvantages
- Slightly lower speed and higher memory use.
- In practice, better algorithms and data structures matter far more; hot spots can be hand-optimised later.
Recurring design issues
| Issue | Typical tension |
|---|---|
| Performance | vs protection checks and isolation |
| Concurrency | parallel speed vs correctness of shared data (locks) |
| Protection & security | safety vs convenience |
| Reliability | fault isolation vs speed (microkernel vs monolithic) |
| Extensibility | run-time flexibility vs kernel stability |
| Portability & compatibility | supporting new hardware vs running old binaries |
| Scalability & energy | using 128 cores vs saving battery on 4 |