LightMySky
به انگلیسی

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.

No account needed. Progress saves in this browser.

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.

prepare read requesttrap into kernel modecheck and handle requestreturn result or errorresume in user mode
For this file-read model, the program prepares a request, enters kernel mode, receives a checked result or error, and resumes in user mode.

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.

request enters kernelcheck permissionpermitted result or error

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

Print a worksheetA4 with an answer key page for grown-ups. No screen, no internet.

Where it sits

Then practise

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.

Spotted a problem on this page? Tell us
What an Operating System Is: Privilege and System Calls · Computing, ages 19 to 20 · LightMySky