Operating System

An operating system (OS) is the fundamental software layer that manages computer hardware resources and provides common services for computer programs. It acts as an intermediary between users and the computer hardware, abstracting the complexities of raw hardware into a usable interface.

What an OS Provides

The operating system is responsible for:

Historical Context

Before operating systems, programmers interacted directly with hardware through switches, punch cards, and assembly language. Each program had to manage its own I/O and memory. The development of OS concepts addressed the need for efficient hardware utilisation, program portability, and multi-user access.

The Kernel

At the heart of every OS is the kernel, the core component that runs with the highest privileges (ring 0 on x86). The kernel manages:

  • CPU scheduling
  • Memory allocation
  • Device drivers
  • System calls interface

User-space programs interact with the kernel through system calls, which are controlled entry points that transition the CPU from user mode to kernel mode.

User Space

Everything outside the kernel runs in user space with restricted privileges. This includes:

  • Shell and command-line interpreters
  • System utilities and daemons
  • Graphical interfaces
  • Applications

The separation between kernel and user space is fundamental to system stability and security. A bug in user space cannot directly corrupt the kernel (though privilege escalation vulnerabilities exist).

Major OS Families

The Unix philosophy has heavily influenced modern operating systems:

  • Linux: Open-source, Unix-like kernel used in servers, desktops, mobile (Android), and embedded systems.
  • BSD: Family of Unix-like systems including FreeBSD, OpenBSD, and NetBSD, known for their permissive licensing and focus on correctness and security.
  • Windows: Proprietary OS with a hybrid kernel design, dominant in desktop and enterprise environments.
  • macOS/iOS: Apple's Unix-based operating systems built on the XNU kernel (Mach + BSD).