What an Operating System Is: Privilege and System Calls
An operating system manages resources and provides services. In the user/kernel protection model studied here, user code cannot execute restricted hardware-control instructions. System calls enter the kernel for checked services. CPU privilege, permission to request a service, and ordinary library calls are distinct.
What a learner can do afterwards
- Trace what happens on a system call, from the trap to the return
- Distinguish restricted hardware-control instructions from user-mode requests for permitted OS services
- Distinguish a library call that stays in user mode from a system call, and explain why their costs depend on the work performed
1 · Read
Multiple cores do not create the need for an OS; a single-core computer can use one too. An OS manages resources and provides services. Here we study protected user programs and a kernel. An app saving a file requests an OS service rather than controlling the storage device itself. Other systems can use different protection arrangements.
CPU privilege restricts particular hardware-control instructions. In our model, user code cannot directly change memory-protection control registers, disable hardware interrupts, or operate unassigned device controls. It can perform ordinary arithmetic. These restrictions differ from permission to ask the OS for a service. An authorized user program can request a clock change without executing privileged instructions itself.
Protection limits what one user program can do to another's memory and shared resources. If every program could change memory protection or issue unrestricted device commands, one could damage another's data. The kernel checks requests and uses controlled interfaces. Protection reduces these risks; it does not guarantee that the kernel, drivers or every program will be free of faults.
Creating a folder is an ordinary request available to an app with suitable permissions. The app remains user-mode software, but the request can enter the kernel to update the file system. Permission to request the action is not permission to execute restricted CPU instructions. Calling a service does not give the app permanent kernel privilege.
Entering kernel mode does not mean a request must be approved. The kernel checks arguments, file permissions and other policy rules. A file-read request may return an error, read cached data, or wait for storage. The system-call interface controls entry; the checks decide which requested work is allowed.
A library function can compute entirely in user mode or wrap a system call. Kernel entry, checks and return add work compared with an otherwise similar user-only call, but total cost depends on the task. Ordinary desktop apps also depend on OS services. Install a suitable OS before those apps on an empty desktop disk; firmware and bare-metal software can execute without an installed OS.
In this protection model, user programs request checked kernel services. CPU privilege differs from service permission. A library function may stay in user mode or invoke a system call.
Original lesson, questions and flashcards written for this dataset.
Original readings and flashcards written for this dataset.
2 · Watch
به انگلیسیTake it off screen
Where it sits
Learn first
Optional connections
8 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.