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:
- Process Management: Creating, scheduling, and terminating processes. It provides the illusion of concurrent execution through time-slicing and manages inter-process communication. See Article - Process as virtualisation for details on process as a form of virtualisation.
- Memory Management: Allocating and deallocating memory space to processes, protecting memory regions, and enabling virtual memory through paging and swapping.
- File System Abstraction: Providing a uniform interface to storage devices through the Virtual File System (VFS). See Article - File, VFS (Virtual FileSystem), filesystem abstraction for more on filesystem abstraction.
- Security and Access Control: Enforcing user permissions, resource limits, and mandatory access controls. See Article - OS security functions (uid/gid, ulimit, apparmor, selinux) for details on OS security functions.
- Resource Isolation: Providing mechanisms to separate and constrain running processes. See Article - Lightweight OS virtualisation techniques (chroot, namespace) for lightweight OS virtualisation techniques and Article - Resource management (cgroup, quota) for resource management.
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).
Related Articles
- Pre OS era: Article - Pre OS era, necessity of operating systems
- Process: Article - Process as virtualisation
- VFS: Article - File, VFS (Virtual FileSystem), filesystem abstraction
- Security: Article - OS security functions (uid/gid, ulimit, apparmor, selinux)
- Isolation: Article - Lightweight OS virtualisation techniques (chroot, namespace)
- Resources: Article - Resource management (cgroup, quota)