What Is an Operating System?

The OS as resource manager and abstraction layer — kernel vs user space, kernel architectures, the boot process, and what happens when the machine starts.

Beginner 4 min readLesson 1 of 16 Interview Q&A

An operating system is the software layer between applications and hardware. It does two jobs:

  1. Referee (resource manager) — shares the CPU, memory, disks and network fairly and safely among many programs and users.
  2. Illusionist (abstraction provider) — turns messy hardware into clean abstractions: processes instead of CPU cores, virtual memory instead of physical RAM, files instead of disk blocks, sockets instead of network cards.
Applicationsbrowser, editor, database, your programSystem librarieslibc, language runtimesSystem call interfaceopen · read · write · fork · mmap …Kernelscheduler · memory manager · file systems · network stack · driversHardwareCPU · RAM · disks · NICs · devices

The core abstractions

Hardware realityOS abstractionLesson
A few CPU coresMany concurrently running processes and threadsProcesses, Threads
Limited physical RAM, sharedA private, huge virtual address space per processPaging & virtual memory
Disk blocksFiles and directoriesFile systems
Network hardwareSocketsNetworks
Countless device typesUniform interfaces (read/write, "everything is a file")I/O systems

Kernel mode and user mode

The CPU has privilege levels. The kernel runs in kernel mode (ring 0 on x86) and may do anything: touch any memory, talk to devices, change page tables. Applications run in user mode (ring 3), where privileged instructions fault.

Programs cross into the kernel only through controlled entry points:

  • System calls — the program asks for a service (read a file, create a process).
  • Exceptions — the program did something that needs handling (page fault, divide by zero).
  • Interrupts — a device or timer needs attention.

That boundary is what keeps a buggy app from crashing the machine or reading another user's data. Details: System calls & the kernel.

Kernel architectures

DesignIdeaProsConsExamples
MonolithicEverything (FS, drivers, networking) runs in kernel spaceFast: direct function callsA driver bug can crash the whole systemLinux, traditional Unix
MicrokernelOnly the essentials (IPC, scheduling, memory) in the kernel; the rest are user-space serversIsolation, reliabilityIPC overheadseL4, QNX, MINIX 3
HybridA monolithic core with some microkernel ideasA compromiseComplexityWindows NT, macOS XNU
UnikernelThe app and a minimal OS compiled into one imageTiny, fast bootSingle app, harder to debugMirageOS, Unikraft

Linux mitigates the monolithic downside with loadable kernel modules (drivers loaded at runtime) and, increasingly, safe extension mechanisms like eBPF.

How a computer boots

  1. Firmware (UEFI, formerly BIOS) runs from flash on power-on: it tests hardware (POST) and finds a boot device.
  2. The bootloader (GRUB, systemd-boot, Windows Boot Manager) loads the kernel image and an initial RAM disk into memory.
  3. The kernel initialises: sets up memory management and page tables, detects hardware, starts drivers, mounts the root filesystem.
  4. The kernel starts the first user process, init (PID 1 — systemd on most Linux distributions).
  5. init starts services (networking, logging, the login manager, the GUI) and the system is ready.

What the OS does all day

  • Schedules which thread runs on each core, switching hundreds or thousands of times a second (CPU scheduling).
  • Handles page faults, mapping memory lazily as programs touch it.
  • Services system calls for files, network, time, memory and processes.
  • Handles interrupts from network cards, disks, keyboards and timers.
  • Enforces security: users and permissions, process isolation, capabilities, sandboxes.
  • Keeps accounts: CPU time, memory use, open files, resource limits (cgroups).
Key takeaways
  • The OS manages resources and provides abstractions: processes, virtual memory, files, sockets.
  • The kernel runs in privileged mode; apps enter it via system calls, exceptions and interrupts.
  • Monolithic kernels are fast; microkernels isolate components; most real systems are hybrids.
  • Boot: firmware → bootloader → kernel → init (PID 1) → services.
Interview questions
QWhy do we need separate user and kernel modes?easy

Protection. If any program could execute privileged instructions or access any memory, one buggy or malicious program could corrupt the kernel or other processes. Hardware-enforced modes force programs to go through the kernel's checked interfaces.

QMonolithic vs microkernel — which is better?medium

It's a trade-off. Monolithic kernels avoid IPC overhead and are simpler to make fast; microkernels isolate failures and have a smaller trusted code base (seL4 is formally verified). Linux shows a monolithic kernel can be reliable in practice, while microkernels dominate safety-critical embedded systems.