Course contents · Lesson 2 of 19

What Is an Operating System? A Simple Explanation

Inside a Computer · Lesson 2 of 19 · 8 min Foundations

You open a browser, a music app and a chat app on your laptop. All three share the same processor and memory without getting in each other's way, and something is organising that. This lesson answers what is an operating system, what its core, the kernel, does, and why Linux runs most servers.

What an operating system does

An operating system (OS) is the software that manages a computer's hardware and lets other programs use it. Windows, macOS, Linux and Android are examples. It is copied from storage into RAM (random access memory) when you switch on (see lesson 1), and runs until you shut down. Its main jobs:

  • Runs programs: it loads them and shares the CPU (central processing unit) between them (lesson 3).
  • Manages memory: it gives each program its own part of RAM and stops others from reading it.
  • Handles files: it tracks where each file sits on the disk, so an app can ask for notes.txt by name.
  • Talks to hardware through drivers: a driver is software that controls one kind of device, such as a Wi-Fi chip or a printer.
  • Enforces security: it checks who you are at login, and what each user and program may do.

In the diagram, notice that no tenant reaches a resource directly: every request goes through the manager.

On the left, a building holds three tenants: a browser, a text editor and a game. Arrows labelled asks lead from each tenant to the manager in the middle, which is the operating system. Arrows labelled shares out lead from the manager to four shared resources: rooms are memory, power is CPU time, storage space is space on the disk, and walls and locks keep apps apart. A note says no tenant touches the wiring directly
The OS hands out memory, CPU time and disk space, and keeps apps apart.

The kernel: the part with full access

The kernel is the core of the OS: the program that controls the CPU, memory, disks and network for every other program, and the only part with full access to the hardware.

The processor itself enforces this. Ordinary programs run in a restricted user mode, where they cannot touch devices or other programs' memory directly. The kernel runs in a privileged kernel mode, where it can do anything. On Linux, most drivers are part of the kernel.

To read a file or use the network, an app makes a system call: a request to the kernel such as "open this file" or "start this program". The processor switches into kernel mode, the kernel checks the request, does the work and hands back the result. Linux offers a few hundred system calls.

The rest of the OS, such as the desktop, the settings app and the shell (the program that reads commands you type, lesson 4), runs in user mode like your own apps. The diagram stacks the layers.

Four stacked layers. At the top, user apps such as a browser, an editor and a game. Below them, system tools that come with the OS: the shell, a file manager and settings. Both run in restricted user mode. Two-way arrows labelled system calls lead from the apps and from the tools down to the kernel, the core of the OS, which runs in kernel mode with full access and handles memory, CPU time, files and drivers. Arrows labelled via drivers lead from the kernel to the hardware at the bottom: CPU, RAM, disk and network
Apps and system tools reach the hardware only by asking the kernel.

Saving a file, step by step

When you press Save in a text editor, the editor cannot write to the disk itself, so it asks the kernel with a system call. In the flowchart, notice the "no" branch: the kernel refuses a request that breaks the rules.

Flowchart. Step 1: the app asks to save notes.txt, which is a system call. Step 2, a decision: the kernel checks permissions to see whether this is allowed. If no, Permission denied goes back to the app and nothing is written. If yes, step 3: the disk driver puts the data on disk. Step 4: success is returned to the app, which shows Saved. A note says this is simplified: the disk write can finish slightly later
The kernel stands between every app and the disk, checking each request.

On Linux, that refusal usually shows up as "Permission denied" (lesson 6). One simplification: the kernel often reports success once your data is in RAM, and finishes the disk write a moment later. That is one reason to shut down properly rather than cut the power. Programs that must be certain, such as databases, ask the kernel to wait for the disk.

Why a Windows app will not run on a Mac

An app is built to ask one particular OS for help. A Windows app makes Windows system calls and relies on Windows libraries, ready-made code that ships with the OS. macOS and Linux offer different calls and libraries, and store programs in different file formats, so on their own they cannot run a Windows .exe file.

The processor matters too: a program built for Intel and AMD processors does not run directly on processors based on Arm designs, such as Apple silicon. So developers release a version for each OS, and translation layers such as Wine run some Windows apps on Linux and macOS. Web apps run almost anywhere because the browser itself is rebuilt for each OS.

Linux: a kernel plus tools

Strictly speaking, Linux is a kernel. Linus Torvalds started it in 1991, writing it from scratch to work like Unix, an operating system created at Bell Labs, a research centre, around 1970. Linux is open source: anyone may read, change and share its code.

A distribution packages the kernel with the tools around it: a shell, commands such as ls and cp, a package manager (an app store for software, lesson 11) and often a desktop. Ubuntu, Debian and Red Hat Enterprise Linux (RHEL) are well-known distributions; Ubuntu is built on Debian.

Most servers, the computers that answer other computers' requests, run Linux, and so do most cloud machines, the computers you rent from a provider. Debian and Ubuntu cost nothing to use. Linux runs well without a screen, is managed remotely with typed commands, and anyone can inspect or change it.

Where you meet each one

Android runs on the Linux kernel, adapted by Google, with Google's own app framework and touch interface in place of a distribution's tools.

macOS is Unix-based: its core, called Darwin, builds on BSD (Berkeley Software Distribution), a version of Unix. That is why everyday commands such as ls and cd also work in the macOS Terminal, though some options differ and Linux-only tools are missing.

Windows is a separate family with Microsoft's own kernel, not Unix: its Command Prompt uses dir where Linux and macOS use ls to list files. Windows can still run Linux through WSL 2 (Windows Subsystem for Linux), a real Linux kernel in a lightweight virtual machine, a computer simulated in software.

Check yourself

A game wants to read your game controller. Why does it ask the kernel instead of talking to the controller itself?

The game runs in user mode, where the processor blocks direct access to devices. The kernel does it through the controller's driver, and keeps other apps from interfering.

A Windows-only app will not start on a Linux laptop, although both have Intel processors. Why not?

The processor is only one part. The app makes Windows system calls, needs Windows libraries and comes in a Windows file format, none of which Linux provides.

An Android phone and a cloud server both run Linux, yet look nothing alike. How can both be Linux?

Linux is only the kernel underneath. What you see comes from the layers on top: Google's app framework on the phone, a distribution's command-line tools on the server.