Operating Systems
What Is an Operating System?
Section titled “What Is an Operating System?”An operating system (OS) is the software layer that manages computer hardware and provides services to applications. It’s the intermediary between you (or your software) and the hardware.
An OS has two main parts:
- Kernel - the core: manages hardware, processes, memory, and I/O
- Userspace - the environment where applications and user interactions happen
The Kernel
Section titled “The Kernel”The kernel is the heart of the OS. It runs with full hardware access and handles:
| Responsibility | Description |
|---|---|
| Process management | Creates, schedules, and terminates processes |
| Memory management | Allocates RAM to processes, manages virtual memory |
| I/O management | Coordinates all input/output between software and devices |
| File system | Manages how data is stored and retrieved from storage |
Kernel Mode vs User Mode
Section titled “Kernel Mode vs User Mode”- Kernel mode: Direct hardware access - only the kernel runs here
- User mode: Restricted access - all applications run here and make system calls to request kernel services
Processes
Section titled “Processes”A program is an application stored on disk (e.g., Chrome).
A process is a running instance of that program - it has allocated memory and CPU time.
- You can have multiple processes from the same program (e.g., many browser tabs)
- The kernel uses time slices to rapidly switch the CPU between processes - creating the illusion of parallelism on a single core
Process States
Section titled “Process States”NEW → READY → RUNNING → (WAITING / TERMINATED)The kernel’s scheduler decides which process runs next based on priority and fairness algorithms.
Memory Management
Section titled “Memory Management”RAM & Virtual Memory
Section titled “RAM & Virtual Memory”Processes need RAM to run. When physical RAM fills up, the OS uses virtual memory - a combination of RAM and disk space:
- Least-recently-used memory pages are written to a swap partition/file on disk
- When needed again, they’re loaded back into RAM
This allows the OS to run more processes than physical RAM alone could support - at the cost of speed (disk is much slower than RAM).
Block Storage
Section titled “Block Storage”Files are stored on disk in data blocks - fixed-size chunks. This allows:
- Faster random access (no need to read a file sequentially from start to end)
- Efficient space reuse when files are deleted
File Systems
Section titled “File Systems”The file system defines how data is organized on storage.
| OS | Default File System |
|---|---|
| Windows | NTFS |
| macOS | APFS |
| Linux | ext4 (most common) |
Key concepts:
- File extension: Indicates file type (
.exe,.pdf,.txt) - used by the OS to determine how to open it - Metadata: Information about the file - name, size, timestamps, permissions
- File managers: Finder (macOS), File Explorer (Windows), Nautilus (Ubuntu)
I/O Management
Section titled “I/O Management”I/O (Input/Output) covers everything that communicates with the CPU:
- Input devices: Keyboard, mouse, microphone, webcam
- Output devices: Monitor, speakers, printer
- Both: Hard drives, USB drives, SSDs, network cards
The kernel uses device drivers - software that knows how to talk to specific hardware - to abstract hardware differences from applications.
Shells
Section titled “Shells”A shell is a program that takes text commands and sends them to the OS to execute. Two major types:
CLI (Command-Line Interface)
Section titled “CLI (Command-Line Interface)”Text-based. Powerful, scriptable, efficient for automation.
- Linux:
bash,zsh,fish - Windows:
cmd.exe, PowerShell
GUI (Graphical User Interface)
Section titled “GUI (Graphical User Interface)”Visual windows, icons, and menus. More approachable for general users.
- Windows Explorer, macOS Finder, GNOME
System Logs
Section titled “System Logs”Logs are files that record system events - like a diary for the OS.
| OS | Log location |
|---|---|
| Linux/macOS | /var/log/ |
| Windows | Event Viewer (eventvwr) |
Common logs:
- System log: hardware, driver events
- Application log: app crashes and errors
- Security log: login attempts, access events
Logs are your best friend when troubleshooting - always check them before guessing.
Major OS Types
Section titled “Major OS Types”| OS | Primary Use |
|---|---|
| Windows | Enterprise desktops, consumer PCs |
| macOS | Apple hardware, creative/dev professionals |
| Linux | Servers, cloud, developers, embedded systems |
| Chrome OS | Chromebooks - cloud-centric, lightweight, secure |
| Android / iOS | Mobile - based on Linux and Darwin respectively |
Virtual Machines
Section titled “Virtual Machines”A virtual machine (VM) is a software emulation of a physical computer. It runs a complete OS inside another OS.
Use cases:
- Testing software in isolation
- Running multiple OS environments on one machine
- Creating identical, reproducible system images for deployment