LightMySky

What an Operating System Is: Privilege and System Calls

An operating system exists because programs cannot be trusted with the hardware directly. The processor runs in two modes, ordinary code cannot touch devices, and a system call is the one controlled doorway from a program into the kernel.

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
  • Name three things a program in user mode is not allowed to do
  • Explain why a library call and a system call cost different amounts

1 · Read

With many cores running many programs at once, something must stay in charge of the whole machine. The operating system owns the memory, the disk, and every device, and it stands between your apps and the hardware so one buggy program cannot wreck the rest.

Try it together

When your program wants to read a file, it cannot grab the disk itself. It traps into the kernel, the processor switches to kernel mode, the kernel checks the request and fetches the data, then it returns the result and drops back to user mode.

Some actions are privileged, for the kernel only. Touching hardware devices directly, changing shared settings like the system clock, and grabbing memory or time meant for others are all off limits to ordinary code. The layer above the hardware owns these powers, and programs above it only get them by asking.

A library call is a plain jump to code already inside your program, so it is cheap. A system call traps into the kernel and back, which disturbs the processor and costs more. That is also why a fresh machine gets its operating system before anything else.

Programs live in user mode and reach the hardware only through system calls, which trap into the kernel and return.

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