|$ curl https://forge-ai.dev/api/markdown?path=docs/os
$cat docs/operating-systems-—-overview.md
updated Recently·25 min read·published

Operating Systems — Overview

OSComputer ScienceSystemsBeginner to Intermediate🎯Free Tools
Introduction

An operating system is the layer between your applications and the hardware. It manages the CPU, memory, storage, and devices so programs can run safely and efficiently. Understanding OS concepts makes you a better debugger, performance engineer, and systems designer.

The Kernel

The kernel is the core of the OS. It runs in privileged mode and handles the most sensitive tasks: process scheduling, memory allocation, device drivers, and file systems. User programs request kernel services through system calls.

os-stack.txt
TEXT
1Application
2
3
4User Space (your code, libraries, shell)
5───────────────────────────────────────
6Kernel Space (scheduler, memory manager, drivers)
7───────────────────────────────────────
8Hardware (CPU, RAM, disk, network)
System Calls

System calls are the API between user space and kernel space. Every time you open a file, send network data, or start a process, a system call happens behind the scenes.

CallPurpose
readRead bytes from a file descriptor
writeWrite bytes to a file descriptor
openOpen a file
closeClose a file descriptor
forkCreate a new process
execReplace process image
mmapMap files or memory into address space
socketCreate a network socket

info

Use strace -e open,read,write ./program on Linux to watch the system calls a program makes.
Processes & Threads

A process is an instance of a running program with its own memory space. A thread is a unit of execution within a process; threads share the same memory but have separate stacks and registers.

process-threads.txt
TEXT
1Process A
2├── Thread 1 (stack, registers)
3├── Thread 2 (stack, registers)
4└── Shared: code, heap, open files
Memory Management

Each process sees a private virtual address space. The OS maps virtual addresses to physical RAM (or swap on disk) using page tables. This isolation prevents processes from corrupting each other.

ConceptDescription
Virtual memoryPrivate address space per process
Physical memoryActual RAM chips
PageFixed-size chunk of memory (often 4 KB)
Page faultCPU interrupt when a page is missing or protected
SwapDisk space used when RAM is full
File Systems

File systems organize data on storage devices. They provide naming, directories, permissions, and durability. Common Linux file systems include ext4, XFS, Btrfs, and ZFS.

Next Steps