操作系统(operating system, OS) 是位于硬件和你的程序之间的软件层。它管理机器的资源——CPU、内存、存储、设备——并通过一个干净、安全的接口把它们暴露给应用程序,从而让许多程序可以共享一台计算机而不互相干扰。
两个世界:kernel 与 user space
text
┌─────────────────────────────────────────────────┐
│ User space │ browser editor shell ... │ ← your apps (unprivileged)
├───────────────┴─────────────────────────────────┤
│ system calls (open, read, ...) │ ← the boundary
├─────────────────────────────────────────────────┤
│ Kernel space │ scheduler memory mgr drivers │ ← privileged, trusted
├───────────────┴─────────────────────────────────┤
│ Hardware (CPU, RAM, disk) │
└─────────────────────────────────────────────────┘
是运行在特权 CPU 模式、拥有完整硬件访问权限的核心。 是普通应用程序运行的地方,彼此之间以及与硬件之间相互隔离。应用程序不能直接触碰硬件;它们通过 请求 kernel。
