Operating Systems โ Overview
Overviewโ
An operating system's job is to let multiple programs safely share one machine's hardware โ CPU, RAM, storage, and I/O devices โ without those programs having to coordinate with each other directly or trust each other at all. It does this by inserting itself as a privileged layer between hardware and applications: the kernel runs in a special CPU mode with full hardware access, while ordinary programs run in a restricted mode and must ask the kernel (via system calls) to do anything that touches shared hardware.
Core Conceptsโ
| Term | Meaning |
|---|---|
| Kernel space / user space | CPU privilege levels: kernel mode has unrestricted hardware access; user mode is restricted and isolated per process. |
| System call (syscall) | A controlled entry point that lets a user-mode program request a kernel-mode operation (read a file, allocate memory, send a network packet). |
| Process | A running program: its own address space, open files, and execution state, isolated from other processes by the kernel. |
| Thread | An independent unit of execution within a process, sharing that process's memory with other threads in it. |
| Context switch | The kernel saving one process/thread's CPU state and loading another's, so multiple things appear to run "at once" on limited CPU cores. |
Architecture / Mechanismโ
In This Sectionโ
- Processes & Threads โ the process control block, what a context switch actually saves and restores, and 1:1 kernel threads vs. green threads.
- Scheduling โ FCFS, SJF, Round Robin, priority scheduling, multilevel feedback queues, and how Linux's CFS approximates fairness in practice.
- Memory Management โ demand paging, page replacement (FIFO, LRU, Clock), Bรฉlรกdy's anomaly, and thrashing.
- Concurrency & Synchronization โ race conditions, mutexes vs. semaphores, deadlock and the four Coffman conditions.
- Inter-Process Communication โ pipes, message queues, shared memory, sockets, and signals.
Why It Mattersโ
- CPU & Processor Architecture: the scheduler decides which process/thread runs on which core, directly interacting with the multicore concepts covered there.
- Memory Hierarchy & RAM: virtual memory (an OS + hardware collaboration) is what lets every process believe it has its own private, contiguous address space.
- Computer Networks: the OS's network stack is what turns raw packets from a network card into the sockets applications actually use.