The Polymathic Engineer

The Polymathic Engineer

How the Operating System Manage the Hardware

A Complete Guide to understand what happens when a program runs on your computer.

Franco Fernando's avatar
Franco Fernando
Nov 21, 2025
∙ Paid

Hi Friends,

Welcome to the 149th issue of the Polymathic Engineer newsletter.

When you run a program on your laptop, a lot of things happen in the background. Even a simple task, such as printing "Hello, World!" to the screen, requires significant effort from both hardware and software. Processors, memory systems, storage devices, and the operating system that controls them work together to make it possible.

The raw computing power comes from the hardware. Processors execute instructions, memory stores data and programs, and different I/O devices let computers talk to the outside world.

Instead, the operating system hides the complexity of the hardware beneath beautiful abstractions. It utilizes concepts such as processes, virtual memory, and files to turn a complex collection of hardware into a base for running programs.

As a developer, it is important that you know how the hardware is organized and how the operating system interacts with these components.

You don't have to learn this just for school, but because it has a significant impact on your work. It changes the way you write code, solves performance issues, and enables you to make informed architectural choices.

In this article, we will explore how hardware parts are organized and interconnected, and examine the fundamental abstractions that operating systems provide. By the end, you will have a good understanding of what happens from the time you press "Enter" on the "Hello, World!" program until the text shows up on your screen.

The outline will be as follows:

  • Hardware Components and Organization

  • The Memory Hierarchy and Performance

  • Operating System Abstractions

  • Process Management

  • Virtual Memory Management

  • File System Abstraction


Project-based learning is the best way to develop technical skills. CodeCrafters is an excellent platform for practicing exciting projects, such as building your version of Redis, Kafka, DNS server, SQLite, or Git from scratch.

Sign up, and become a better software engineer.


Hardware Components and Organization

A computer system consists of several hardware components that work together. Even if there are many computer systems, they all have a similar look and feel and share the same core parts. Here are the main ones:

  1. System buses are like highways in your computer. They use electrical impulses to transmit information from one part to another. Information travels in segments called "words." Most computers today use either 4-byte words (32-bit systems) or 8-byte words (64-bit systems). The word size is a critical parameter, as it affects the amount of data the computer can handle at once.

  2. I/O devices connect your computer to the outside world. Some common examples are a keyboard and a mouse for input, a display screen for output, and disk drives for storing data and programs. Each I/O device connects to the system through either a controller or an adapter. Controllers are built into the motherboard. Adapters are separate cards that plug into slots. Both do the same job: they move data between the I/O bus and the device.

  3. Main memory is where your computer stores programs and data while they're being used. It is a temporary storage that gets cleared when you shut down the machine. From a physical point of view, main memory is made of DRAM chips. From a programmer's view, it works like a huge array of bytes. Every byte has its own address, which starts at 0. In general, machine instructions that make up a program can have a variable number of bytes. Data types take up different amounts of space. On a typical 64-bit Linux system, short integers take 2 bytes, integers and floats 4 bytes, long integers and doubles take 8 bytes.

  4. The processor is the brain of your computer. It reads instructions from memory and executes them one by one. One of the most important parts of a processor is the program counter (PC), which is a word-sized storage device or register. At any point in time, it contains the address of the next machine-language instruction in main memory to execute. The processor follows a simple cycle: it reads an instruction from memory, figures out what the bits in the instruction mean, does a simple task that the instruction tells it to do, and then moves on to the next instruction. There are only a limited number of simple operations, and they all involve the main memory, registers, and the arithmetic/logic unit (ALU). As we've seen with the PC, registers are small memory units that can store words. Each one has its own name. The ALU computes new data and address values. Simple operations that the CPU may perform in response to an instruction include copying data from memory to a register (load), copying data from a register to memory (store), operating on data in registers (doing math or logic on it), or jumping to the next instruction.

The Memory Hierarchy and Performance

As we have seen in the previous paragraph, computer systems use a variety of storage devices that have distinct speeds and costs. This is what software engineers refer to as the processor-memory gap.

Larger storage devices are generally slower than smaller ones, and faster devices tend to be more expensive than slower ones. The differences are enormous.

Consider a typical system. Even though a disk drive has 1,000 times more space than main memory, it takes 10,000,000 times longer for the processor to read a word from disk than from memory. That is a huge change in speed.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 Franco Fernando
Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture