Skip to content

Picture an evening on a laptop that you share with another person. Each of you has your own account. You sign in to yours, start a music player that streams a song from the internet, and write a letter in a text editor. You click Save. The letter is stored, the song keeps playing, and when the other person signs in to their account, they cannot open your letter.

Yet the text editor was not written for your laptop’s storage drive, and the music player does not know your Wi-Fi hardware. Neither program knows the other exists, and still they shared one computer without getting in each other’s way. Something else did that work.

By the end of this lesson, you can name that something and say which of its jobs handled each step of your evening.

That something is the operating system, or OS: the software that manages the hardware and lets every other program use it safely. Ubuntu, the system this course uses, is an operating system built on Linux. Windows and macOS are other operating systems.

The programs you use, such as the text editor, are called applications; this course uses application and program for the same thing. The hardware has four parts that matter here:

  • The CPU (central processing unit, or processor) carries out the instructions of programs.
  • Memory, also called RAM, holds the programs that are running and the data they are working on.
  • Storage, a solid-state drive or a hard disk, keeps files, even when the power is off.
  • The network hardware, such as a Wi-Fi adapter, sends and receives data.

Applications do not use this hardware themselves. To save your letter, the text editor sends a request to the OS: “store this text in a file with this name”. The OS does the work and returns a result: saved, or an error saying why not. These requests are called system calls.

What an operating system does A text editor and a music player send requests to the operating system and receive results. Inside the operating system are users and permissions, scheduling, memory management, files and directories, network connections, and device drivers. Below it is the hardware: CPU, memory, storage, and network. Applications Text editor Music player requests and results Operating system Users and permissions Scheduling Memory management Files and directories Network connections Device drivers Hardware CPU Memory Storage Network
What an operating system does A text editor and a music player send requests to the operating system and receive results. Inside the operating system are users and permissions, scheduling, memory management, files and directories, network connections, and device drivers. Below it is the hardware: CPU, memory, storage, and network. Applications Text editor Music player requests and results Operating system Users and permissions Scheduling Memory management Files and directories Network connections Device drivers Hardware CPU Memory Storage Network
Simplified model. Applications send requests to the operating system and receive results. The operating system provides each service and is the only part that works with the hardware.

At the top, the text editor and the music player send requests and receive results. In the middle, the operating system provides its services: users and permissions, scheduling, memory management, files and directories, network connections, and device drivers. At the bottom is the hardware: CPU, memory, storage, and network. The rest of this lesson takes the services one at a time.

The diagram leaves out one fact: the OS is a program too. It sits in the same memory and runs on the same CPU as the applications, but the hardware gives it more control than any application, so it can protect them from each other. The part of the OS that receives system calls is called the kernel; lesson B01.3 explains it.

The song keeps playing while you type. Yet a CPU can run only a small number of programs at any one moment, and your laptop runs many more, most of them in the background. So the OS lets them take turns: it runs one program for a short time, then switches to another, so quickly that they all appear to run at once.

Deciding which program runs next, and for how long, is called scheduling.

While you type, your letter exists only in the text editor’s memory. The OS gives each running program its own part of memory and keeps the parts apart: when a program reads or writes memory, it reaches only its own part. This job is called memory management.

Guess first: the music player and the text editor run for the same user, on the same laptop, at the same time. Can the music player read the unsaved text of your letter?

Check your guess

No. Your unsaved letter is in the text editor’s memory, and the music player can reach only its own, even though both run for you. The OS can allow controlled exceptions, such as a debugging tool, but an ordinary program has no way in.

The same separation means that a program with an error can crash without overwriting the memory of other programs or of the OS.

Memory has one weakness. Guess first: the power fails while you are still typing, before you click Save. Is your letter there when you start the laptop again?

Check your guess

No. Memory keeps its contents only while it has power. Clicking Save is the step that copies your letter to storage, which keeps data without power. Some editors save a recovery copy on their own every few minutes; it survives because it is a file in storage.

This is also why a laptop’s description lists two sizes, such as 16 GB of memory and 512 GB of storage. They are different hardware with different jobs, so keep the two words apart.

When you click Save, the editor asks the OS to create a file: a named piece of data in storage, such as letter.txt. The file goes into a directory: a named place that holds files and other directories. Many graphical programs call a directory a folder; this course uses the word directory.

Storage itself has no idea of names or directories. The part of the OS called the file system decides where on the drive your letter goes, and keeps track of where every file is and what it is called.

The music player cannot send or receive data over the network on its own. It asks the OS to open a network connection to the server that has the song. The OS sends and receives the data through the network hardware, and hands each piece that arrives to the music player, not to the text editor.

Every model of Wi-Fi adapter and storage drive is controlled in its own way. The OS contains a device driver for each one: code that knows how to work with that specific device.

This is how the text editor saved to a drive it was never written for. Applications ask for general things, such as “save this file”. The OS turns those requests into the exact commands your hardware understands, through its drivers. So one text editor works on very different laptops.

The laptop has two user accounts, one for each of you. When you sign in, every program you start runs for your account.

Every file also belongs to an account; your letter belongs to yours. When a program asks to open a file, the OS compares the account the program runs for with the file’s permissions: which accounts may read it or change it. If the permissions do not allow it, the OS refuses.

The other person’s text editor runs for their account, which may not read your letter, so the OS refuses to open it. Module B11 shows how to read and change permissions.

Here is the evening again, with the service that handled each step:

What happened Service of the OS
The song kept playing while you typed Scheduling
The music player could not see your unsaved letter Memory management
Save turned the text in memory into letter.txt in a directory Files and directories
The song arrived from the internet and reached the music player Network connections
The editor saved to a storage drive it was never written for Device drivers
The other person could not open your letter Users and permissions

Neither application did any of this alone. Each one sent requests, and the operating system did the work.

The OS builds two different walls:

  • Between programs, in memory. Each running program has its own memory, even when all of them run for the same account.
  • Between accounts, on files. Permissions are checked against the account a program runs for, not against which program it is.

So the music player cannot read the letter you are still typing. Once the letter is saved, it usually can: the music player runs for your account, and your account may read the file. Some systems add limits for individual programs; later modules show them. This is why it matters which programs you run: each one works with all of your permissions.

Goal: Match the events of a different evening to the services of the operating system.

The same laptop, another evening. You are on a video call in a web browser. While you talk, a large download finishes in the background. During the call, you share a photo that is stored in a directory called Pictures in your account.

For each event, name the service of the OS that handles it. Some events involve more than one service.

  1. Your voice reaches the other person on the call.
  2. The video call keeps running smoothly while the download finishes.
  3. The browser opens the photo from Pictures.
  4. The downloaded file is still there the next day, after the laptop was switched off.

Expected: One or two service names from the diagram for each event.

Hint

Use the table under “Back to your evening”. For each event, ask what the browser needs: the CPU, a file, the network, or permission.

Solution
  1. Network connections, with the device driver for the network hardware.
  2. Scheduling. The browser and the download take turns on the CPU.
  3. Files and directories, and users and permissions: the OS finds the photo and checks that your account, which the browser runs for, may read it.
  4. Files and directories. The download is a file in storage, which keeps data without power.
  • The operating system manages the hardware for applications. Applications send it requests, called system calls, and get results back.
  • Scheduling lets programs take turns on the CPU. Memory management keeps each program’s memory apart.
  • The file system keeps named files in directories on storage. Memory loses its contents without power; storage does not.
  • Device drivers know each piece of hardware, so applications do not have to. Network connections deliver data to the right program.
  • Every program runs for a user account, and the OS checks a file’s permissions against that account.

Next, in Unix, GNU, and Linux, you find out where Linux comes from and how it relates to Unix and GNU.

  • Operating Systems: Three Easy Pieces, by Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau, a free textbook: the chapter Introduction to Operating Systems covers sharing the CPU, private memory, why memory loses data without power, the file system, device drivers, system calls, and protection between programs. The book’s home page lists the full chapters on each topic.
  • Ubuntu 24.04 manual pages: intro(2), what a system call is; sched(7), the scheduler; socket(2), how a program asks for a network connection.
  • Linux kernel documentation: Concepts overview (memory, including protection between processes), Overview of the Linux Virtual File System (one file interface for programs over different file systems), and Credentials in Linux (how the kernel checks who may access a file).