OS fundamentals
An operating system turns shared hardware into controlled resources for programs. Without a protected boundary, one process can overwrite another process or keep every other task from running. We will move from the user program through the kernel to the hardware and compare the kernel designs that place services on that path.
#Section 1OS responsibilities and operating modes
Finch has 1,000 open connections but only 2 cores, so a program cannot simply claim a core, a memory address, or a device forever. An operating system is the privileged software that allocates those resources and presents stable operations to less trusted programs. It schedules execution, translates addresses, names files, moves device data and checks permissions. The word OS is broader than kernel. Shells, libraries, services and utilities are part of the working system, while the kernel is the privileged core that enforces the hardware boundary.
Kernel abstractions still have costs: a descriptor uses a table entry and an idle socket uses memory. Readiness separates waiting connections from actual executing work.
Resource management answers who runs, where bytes live and which device receives a request. Isolation keeps those answers local to each process or container. Protection fails if a user process can write a page-table entry or program a device without a kernel check.
OS types
Multiprogramming keeps programs available while others wait. Multitasking switches among runnable tasks. Multiprocessing adds simultaneous processors or cores; multithreading adds shared-process execution contexts.
A single core can multitask without parallel execution. Time-sharing emphasizes response, batch processing emphasizes queued throughput, and real-time contracts add deadlines. Distributed coordination adds machine boundaries rather than removing them automatically.
The distinction matters when a claim says “the server handles 1,000 connections at once.” It may mean 1,000 descriptors exist, 20 descriptors are ready, or 2 callbacks are executing. Those are different counts with different memory and CPU costs. The OS turns the workload into states and queues before any performance claim is meaningful.
#Section 2Kernel architectures
A faulty driver can damage shared privileged state or fail inside a separate service, depending on its placement. A monolithic kernel places many services in one privileged address space. Linux is broadly monolithic but supports loadable modules, so “monolithic” does not mean every feature is compiled into one immutable binary. A microkernel keeps the privileged core small and moves more services into isolated processes that communicate through messages. A hybrid kernel combines choices, retaining some services in privileged space for performance while using separate boundaries elsewhere.
Isolated services add communication and scheduling costs but bound some failures. In-kernel services access shared state directly, while their bugs can damage that shared privilege. Modules change deployment units, not necessarily isolation.
History explains why no design won universally. Early systems valued direct hardware control, while later systems needed drivers, portability and stronger fault boundaries. Modern operating systems also use hardware virtualization, sandboxing and namespaces, so a production system can combine monolithic kernel services with many user-space isolation layers.
#Section 3System calls and controlled entry
When Finch calls read, the application does not receive permission to inspect arbitrary RAM. The call enters a kernel-controlled path with arguments that the kernel validates. User space is the less privileged execution environment for applications and libraries. Kernel space is the privileged environment where the OS can configure page tables, service devices and change scheduling state.
The processor enforces privilege state. Kernel entry validates descriptors, pointers, lengths, and authority before returning a result or error. A normal function call changes execution position without necessarily changing privilege.
The boundary is not a security guarantee by itself. A kernel bug, a confused-deputy interface or a leaked capability can still expose data. Isolation requires page permissions, address-space separation, identity checks and careful device access. The useful mental model is an actor with authority, not a magical wall.
A privileged instruction is one the processor restricts to kernel mode, such as changing address-translation controls or configuring interrupt delivery. The exact list depends on the architecture. Linux’s system-call ABI and entry instructions vary by architecture, so a portable explanation should describe the contract rather than claim one universal opcode.
#Section 4Interrupts, exceptions and traps
A packet can arrive while Finch executes an unrelated instruction. The CPU needs a way to enter the kernel without waiting for that program to call a library. An interrupt reports an asynchronous event, such as device completion or a timer tick. An exception arises from the current instruction, such as an illegal access or division error. A trap is a synchronous entry used for purposes such as a deliberate system call or debugging; exact terminology varies by architecture.
An event handler updates kernel state and can make a waiter runnable. Returning to the interrupted code and scheduling another task are separate decisions.
A packet arrival changes socket state, not core capacity. Identify its buffer and connection, keep interrupt work bounded, and let the scheduled application perform its own processing.