The operating system as referee

Unit 3 of 5 in How computers and the internet work.

You will be able to explain what an operating system does for programs and what a system call is.

Lesson

What the operating system is for

An operating system is the software that makes the machine easy to use and makes sure it runs correctly and efficiently. Its main technique is virtualization: it takes a physical resource such as the processor, memory or a disk and turns it into a more general, easier-to-use virtual form.

Many programs run at once and share the processor, memory and disks. Because of that, the operating system is also called a resource manager. It decides who gets what and keeps one program from stepping on another.

System calls: how a program asks for something

A program cannot touch the disk or the network directly. It asks the operating system, through a small, fixed set of requests called system calls. The Linux manual describes the system call as the fundamental interface between an application and the Linux kernel.

Programs usually do not make these calls directly. They go through wrapper functions in a library, so opening a file looks like an ordinary function call. This is why tools that watch system calls, like the one in this unit's lab, can show you what a program really does without reading its source.

Processes

A running copy of a program is a process. On Linux, fork creates a new process by duplicating the calling one. The new process is the child, the original is the parent, and they run in separate memory spaces. At the moment of the fork the two have the same contents, and later writes by one do not affect the other.

Almost every command you run in a terminal starts as a new process made this way, which is why the next class spends time on processes and signals.

Why this matters for defenders

If programs can only reach files, networks and devices by asking the operating system, then the operating system is the place to watch and to enforce rules. Logs, permissions and sandboxes all rely on that single doorway.

Key points

Sources

Lecture

What security engineers actually do: A short talk on the job that sits on top of these ideas, so you can see where the foundations lead.

Practice in the labs

Watch one program's system calls without reading its code. You will control processes in depth in the next class.

Knowledge check

  1. Why is the operating system called a resource manager? Answer: Many programs share the processor, memory and disks, and it decides who gets what. Virtualization lets many programs share the CPU, memory and devices, so the OS acts as a manager of those shared resources.
  2. What is a system call? Answer: The fundamental interface between an application and the kernel. The Linux manual describes the system call as the fundamental interface between an application and the Linux kernel.
  3. After fork, what is true of the parent and child process? Answer: They run in separate memory spaces that start with the same content. fork duplicates the caller; the child and parent have separate memory spaces with the same content at that moment, and writes by one do not affect the other.

Back to the syllabus or see all classes.

Related