SyntaxPilot
Courses/CS Fundamentals for Placements/Lesson 16

CS Fundamentals for Placements · Lesson 16 of 90 · 18 min

OS structure, system calls and booting

monolithic kernellayered OSmicrokernelmodular kernel and loadable kernel moduleshybrid kernelexokernelsystem call interfacecategories of system callsAPI vs ABIPOSIXlibc wrapperboot processBIOSUEFI

These are the notes for CS Fundamentals for Placements, episode 16. In episode 15 you invented the operating system: the kernel, user mode and kernel mode, and system calls. Today you answer three new questions. How is a kernel of millions of lines organised, so one bug does not sink everything? (monolithic, layered, microkernel, modular, hybrid and exokernel designs.) How are hundreds of system calls organised, and how does a call actually reach the kernel? (categories of system calls, the system call interface, the libc wrapper, API vs ABI, POSIX.) And when you press the power button, who starts the kernel itself? (firmware, BIOS, UEFI, POST, MBR vs GPT, the bootloader GRUB, kernel initialisation, init/systemd as PID 1.) Every term is explained in plain words the first time it appears, and there is a full glossary at the end. All outputs below are real: the C programs were compiled with gcc -O2 (gcc 13.3) and run on Linux x86-64 on 30 October 2026.

A quick refresher. The kernel is the core of the OS that runs in kernel mode (full control of the hardware); ordinary programs run in user mode. A system call is a program's request to the kernel; it enters the kernel through a trap instruction (on x86-64 it is literally called syscall). A register is a tiny storage slot inside the CPU, such as rax or rdi. A process is a running program, and every process has a process id (PID).

The five problems

Problem What it teaches
One driver bug kills the kernel Device driver, monolithic kernel, layered OS, microkernel, IPC
A new driver without a rebuild Loadable kernel module (LKM), modular kernel, hybrid kernel, exokernel, library OS
Hundreds of system calls The six categories of system calls
How a call reaches the kernel Libc wrapper, system call number and table, system call interface, errno, API vs ABI, POSIX
Who starts the kernel? Firmware, BIOS, UEFI, POST, partition, MBR vs GPT, bootloader, GRUB, kernel initialisation, init, systemd, PID 1

Problem 1: one driver bug kills the kernel (kernel designs)

The kernel has to do a lot:

  • the scheduler decides which program runs next on the CPU;
  • the memory manager decides which program gets which part of RAM;
  • file systems turn file names (notes.txt) into blocks on the disk;
  • device drivers: a device driver is the code that knows how to talk to one kind of device (this SSD, that Wi-Fi card, this keyboard). There are thousands of them;
  • networking sends and receives packets.

That is millions of lines of code. The obvious arrangement: put it all in one big program, all in kernel mode, all sharing one memory. A toy version, where main plays the kernel and starts two drivers, and the disk driver has a bug:

#include <stdio.h>

void disk_driver(void) {
    int *sector = NULL;          // a bug in one driver
    printf("disk: starting\n");
    fflush(stdout);
    *sector = 42;                // writes to address 0
}

void keyboard_driver(void) {
    printf("keyboard: ready\n");
}

int main() {                     // one big kernel program
    printf("kernel: booting\n");
    disk_driver();
    keyboard_driver();
    printf("kernel: all drivers up\n");
    return 0;
}

Output (the SyntaxPilot compiler shows Runtime Error (SIGSEGV)):

kernel: booting
disk: starting
Segmentation fault

The keyboard driver never started. One bug in one driver took the whole "kernel" down. In a real computer this is a kernel panic: the kernel finds an error it cannot recover from and stops the whole machine. (NULL is the address 0; writing there is illegal, so the CPU raises a fault. fflush(stdout) pushes the earlier line out before the crash.)

Monolithic kernel

What we built is a monolithic kernel. Monolithic means "one single block", like a statue carved from one stone: every part of the OS (scheduler, memory manager, file systems, all drivers, networking) runs together in kernel mode as one program in one address space.

Monolithic kernel
Good fast: parts call each other as plain function calls, no mode switches
Bad one bug anywhere can crash everything; every part can read and corrupt every other part's memory
Bad hard to change: adding or fixing a part means rebuilding the whole kernel
Examples classic UNIX; Linux is monolithic at heart (plus modules, Problem 2)

Real-life example: how to organise a hospital

Hospital Kernel design
One doctor does everything; if the doctor falls sick, the hospital stops Monolithic: one program, fast but fragile
Floors: reception → wards → operation theatre; each floor only uses the floor below Layered: layer N only uses layer N−1
A tiny front desk, specialists in separate rooms; one specialist sick, the others keep working Microkernel: drivers and file systems as separate user-mode servers
Visiting doctors called in only when needed Modular: loadable kernel modules

Layered OS

A layered OS splits the system into layers stacked on top of each other. Layer 0 is the hardware, the top layer is the user interface, and each layer only uses services of the layer directly below it.

  • Good: each layer can be built and tested on its own (test layer 1 with only layer 0 below it, then layer 2, and so on).
  • Bad: every request has to pass through every layer in between, so it is slow; and it is hard to decide the order (the memory manager needs the disk driver, but the disk driver needs memory buffers: which goes lower?).

Microkernel

A microkernel keeps only the bare minimum in kernel mode: passing messages between programs, basic scheduling and basic memory management. Everything else (device drivers, file systems, networking) runs as ordinary user-mode programs called servers.

  • To read a file, your program sends a message to the file server, which sends a message to the disk driver server, and the replies come back the same way. Passing messages between processes is called inter-process communication (IPC).
  • Good: a crashing driver is just one crashing user program. It cannot corrupt the kernel, and it can be restarted. MINIX 3 is a microkernel that can automatically restart a crashed driver without affecting running processes.
  • Bad: every request becomes several messages, and every message crosses between user mode and kernel mode, which costs time. Microkernels are usually slower than monolithic kernels.
Monolithic Microkernel
What runs in kernel mode everything only IPC, basic scheduling, basic memory
Drivers and file systems inside the kernel user-mode servers
How parts talk function calls messages (IPC)
Speed fast slower (more mode switches)
A driver crash can crash the whole system stays inside one server; restart it
Size of kernel-mode code large small, easier to verify
Example Linux, classic UNIX MINIX 3

Problem 2: a new driver without a rebuild (modules, hybrid, exokernel)

You buy a new Wi-Fi adapter. With a pure monolithic kernel you would rebuild the kernel and reboot just to add its driver.

Modular kernel and loadable kernel modules

The fix: a core kernel that is always loaded, plus pieces you can add while it runs. A loadable kernel module (LKM) is a piece of kernel code (usually a driver or a file system) that can be loaded into the running kernel and removed later, without a reboot. A kernel built this way is a modular kernel.

  • On Linux, lsmod shows the status of the modules loaded right now (it formats the file /proc/modules); modprobe or insmod load one, rmmod removes one.
  • Plug in a USB device and its driver module is loaded automatically.
  • Careful: a module runs in kernel mode inside the kernel's memory. A buggy module can still crash everything. Modules add flexibility, not safety. Linux is monolithic + loadable modules, not a microkernel.

(The sandbox that runs the SyntaxPilot compiler boots its kernel with module loading switched off, so /proc/modules does not exist there; on a normal Linux laptop lsmod lists dozens of modules.)

Hybrid kernel

A hybrid kernel mixes the two ideas: it starts from a microkernel design (separate components that talk by messages), but keeps important services such as the file system and many drivers inside kernel mode for speed. Apple's XNU kernel (macOS, iOS) describes itself as "a hybrid kernel combining the Mach kernel developed at Carnegie Mellon University with components from FreeBSD".

Exokernel and library OS

An exokernel goes the other way from monolithic: the kernel does almost nothing except protect the hardware. It hands out raw pieces (disk blocks, memory pages, CPU time) and checks who owns what. Each application links a library operating system (library OS), a library that decides how to use those raw pieces (its own file layout, its own memory policy). Maximum control and speed for the application, much more work for its programmer. Exokernels are mainly a research design.

Design In kernel mode Strength Weakness
Monolithic everything speed one bug crashes all; rebuild to change
Layered layers 0..N clean, testable slow, hard to order layers
Microkernel IPC + basics reliability, small kernel message overhead
Modular core + loaded modules flexibility modules can still crash it
Hybrid microkernel core + key services balance complexity
Exokernel protection only app control apps must manage resources

Problem 3: hundreds of system calls (categories)

Linux has hundreds of system calls. Instead of memorising them, group them by purpose. This program makes calls from five groups:

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>

int main() {
    // 1. process control
    printf("my pid: %d\n", getpid());
    // 2. file management
    int fd = open("diary.txt", O_CREAT | O_WRONLY, 0644);
    write(fd, "dear diary", 10);
    close(fd);
    // 3. device management
    printf("input is a terminal? %d\n", isatty(0));
    // 4. information maintenance
    printf("seconds since 1970: %ld\n", (long) time(NULL));
    // 5. communication
    int p[2];  char buf[6] = {0};
    pipe(p);
    write(p[1], "hello", 5);
    read(p[0], buf, 5);
    printf("through the pipe: %s\n", buf);
    return 0;
}

Output (the pid and the seconds differ on every run):

my pid: 1857
input is a terminal? 0
seconds since 1970: 1793356484
through the pipe: hello
  • open returns a file descriptor (a small number that names the open file); O_CREAT | O_WRONLY means "create it if missing, open for writing"; 0644 are its permissions (owner read/write, others read).
  • isatty(0) asks "is file descriptor 0, standard input, a terminal device?" It prints 0 (no) because the compiler feeds input from a box, not a keyboard.
  • time(NULL) returns the seconds since 1 January 1970 (UTC), the Unix epoch.
  • pipe(p) creates a pipe: a one-way channel with a write end p[1] and a read end p[0].

The six categories

Category What for Examples (UNIX)
Process control create, run, end, wait for processes fork, exec, exit, wait, getpid
File management create, open, read, write, close, delete files open, read, write, close, unlink
Device management request, release, read, write and control devices ioctl, read/write on a device
Information maintenance get or set system and process information getpid, time, uname
Communication let processes exchange data pipe, shmget (shared memory), socket
Protection control who may access what chmod, chown, umask

ioctl means input/output control: it sends a device a special command that is not a plain read or write (for example, "what is this terminal's window size?"). chmod changes a file's permission bits. Some books merge protection into information maintenance and list five categories.

Problem 4: how a call reaches the kernel (wrapper, API vs ABI, POSIX)

Real-life example: the railway enquiry counter

At the counter In the computer
You ask in plain words: "open missing.txt" you call open("missing.txt", O_RDONLY), a function in the C library (libc), the wrapper
The clerk fills a form: counter no. 2, details in fixed boxes the wrapper puts the system call number (2) in register rax, the arguments in rdi, rsi, ..., then runs the trap
The back office looks up counter 2 in a table the kernel's system call table maps number 2 to the open handler
The reply is translated for you the kernel returns −2; the wrapper returns −1 and stores 2 in errno
  • libc (the C standard library, on Linux usually glibc) is the library behind printf, open, malloc.
  • A wrapper is a small library function that wraps a raw system call in a friendly C function.
  • The system call interface is the doorway into the kernel: the set of numbered calls plus the table that maps each number to its handler.
  • errno ("error number") is a variable that libc sets after a failed call; 2 means ENOENT, "No such file or directory".

The program below makes the same request twice: once through the wrapper, once with inline assembly that runs the syscall instruction itself (x86-64 Linux only):

#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/syscall.h>

int main() {
    // API: the libc wrapper open()
    int r1 = open("missing.txt", O_RDONLY);
    printf("wrapper: %d, errno %d\n", r1, errno);

    // ABI: the raw trap. rax = call number, rdi/rsi = arguments
    long r2;
    __asm__ volatile ("syscall" : "=a"(r2)
        : "a"(SYS_open), "D"("missing.txt"), "S"(O_RDONLY)
        : "rcx", "r11", "memory");
    printf("raw kernel: %ld\n", r2);
    printf("SYS_open is call number %d\n", SYS_open);
    return 0;
}

Output:

wrapper: -1, errno 2
raw kernel: -2
SYS_open is call number 2

The kernel itself returns minus the error number (−2). The wrapper turns that into the C convention: return −1 and set errno = 2. In the __asm__ line, "a" means register rax, "D" means rdi, "S" means rsi; rcx and r11 are listed because the syscall instruction overwrites them.

API vs ABI

API (application programming interface) ABI (application binary interface)
Level source code machine code (binary)
Promises function names, argument types, return types system call numbers, which registers hold which argument, sizes of types, how functions are called
Example int open(const char *path, int flags) open = call 2; path in rdi; result in rax; int = 4 bytes
Real-life a restaurant menu: names of dishes the shape of a plug and socket
If it stays the same your code still compiles an old compiled program still runs, no recompiling

Moving the same code to a new CPU keeps the API but changes the ABI, so you recompile. Linux keeps its system call ABI stable, which is why a program compiled years ago still runs on a new kernel.

POSIX

If every OS had a different API, you would rewrite programs for each one. POSIX, the Portable Operating System Interface, is a family of standards specified by the IEEE Computer Society. It defines a common API (functions like open, read, write, fork, pipe), a command-line shell, and common utilities. Code written to POSIX compiles on Linux, macOS, the BSDs and other UNIX-like systems. Windows has its own native API (the Windows API), so POSIX code needs a compatibility layer there.

Problem 5: who starts the kernel? (booting)

The kernel is stored on the disk. Reading the disk needs drivers, which are part of the OS. And RAM (episode 8) forgets everything when the power is off, so at power on memory is empty. Who loads the loader?

The fix is firmware: software stored permanently in a chip on the motherboard (flash memory, a kind of EEPROM, keeps its contents without power). When power arrives, the CPU is built to start running instructions from a fixed address, and the firmware is mapped exactly there.

Real-life example: opening a shop in the morning

Shop Boot step
The watchman arrives first and checks lights, alarm, shutters firmware (BIOS or UEFI) runs POST
He checks the register: "the manager's key is in drawer 1" the firmware finds the boot disk and reads its partition table (MBR or GPT)
He calls the manager, who knows the shop the firmware starts the bootloader (GRUB), which loads the kernel
The manager opens the counters, staff take their posts the kernel initialises and starts PID 1 (systemd), which starts everything else

The boot process, step by step

  1. Power on. The power supply stabilises; the CPU starts executing the firmware.
  2. Firmware. BIOS (Basic Input/Output System) on older PCs, or UEFI (Unified Extensible Firmware Interface) on modern ones. UEFI is "an interface between a platform and an operating system".
  3. POST (power-on self-test): the firmware checks that the CPU, memory and basic devices work. If something essential is missing (for example no RAM), it beeps or shows an error and stops.
  4. Find the boot device in the boot order (SSD, USB stick, network) and read its partition table. A partition is a separate section of a disk, like rooms in a flat (for example one for Windows, one for Linux).
  5. Bootloader. A boot loader is "the first software program that runs when a computer starts" (GRUB manual): its job is to load the kernel. GRUB, the GRand Unified Bootloader, is common on Linux. It can show a menu of operating systems or kernels, loads the chosen kernel (and usually an initial RAM disk with early drivers) into RAM, passes it a kernel command line (options such as which disk holds the root file system), and jumps to it.
  6. Kernel initialisation. The kernel sets up memory management and interrupt handling, starts the scheduler, detects devices and loads their drivers, and mounts the root file system (the main file system, /).
  7. PID 1. The kernel starts the first user-mode program, with process id 1, called init. On many Linux systems that is systemd, "a system and service manager for Linux operating systems. When run as first process on boot (as PID 1), it acts as init system that brings up and maintains userspace services." It starts services (network, logging, the display manager) and finally the login screen. Every other process descends from PID 1.

BIOS + MBR vs UEFI + GPT

BIOS + MBR (legacy) UEFI + GPT (modern)
Firmware BIOS, a 1980s PC design, 16-bit start-up UEFI, a modern firmware interface
Where boot code lives the MBR: the first 512-byte sector of the disk an ordinary file on a small FAT-formatted EFI system partition
Partition table MBR, room for 4 primary partitions GPT (GUID Partition Table), part of the UEFI standard, typically 128 entries
Block addresses 32-bit → at most 2³² × 512 bytes = 2 TiB with 512-byte sectors 64-bit → effectively no limit
Safety copy one copy of the table a backup GPT header at the last block of the disk
Extras — Secure Boot: checks the bootloader's digital signature before running it

MBR means master boot record. GUID means globally unique identifier, a 128-bit ID given to each partition (and disk) in GPT. TiB (tebibyte) = 2⁴⁰ bytes, the binary cousin of TB (episode 1's KB vs KiB).

Ask the running kernel about its boot

On Linux, /proc is not stored on any disk: the kernel generates its files on the fly, so reading a file in /proc is asking the kernel a question.

#include <stdio.h>

int main() {
    char name[64] = "";
    FILE *f = fopen("/proc/1/comm", "r");     // process number 1
    fgets(name, sizeof name, f);
    printf("PID 1 here is: %s", name);

    double up;
    f = fopen("/proc/uptime", "r");           // seconds since the kernel booted
    fscanf(f, "%lf", &up);
    printf("kernel booted %.0f seconds ago\n", up);
    return 0;
}

Output in the SyntaxPilot compiler's sandbox (the seconds differ on every run):

PID 1 here is: process_api
kernel booted 891 seconds ago

The compiler runs inside a small sandbox whose launcher told the kernel to start its own starter program as PID 1. On a typical Linux desktop the first line would print systemd. Whatever it is, PID 1 is the first user-mode program and the ancestor of all others.

Common mistakes (and the real output)

Mistake Real output Why Fix
A driver writes through a NULL pointer Segmentation fault in a monolithic kernel, the bug runs inside the kernel microkernel servers, or careful (and tested) drivers
Reading errno after a raw syscall instruction raw kernel: -2 (and errno unchanged) the kernel returns -errno; only libc wrappers set errno use the wrapper and check errno, or negate the raw result
Forgetting O_CREAT when opening a new file open returns -1, errno 2 without O_CREAT, a missing file is an error open(name, O_CREAT \| O_WRONLY, 0644)
"Loadable modules make Linux a microkernel" (interview: wrong) modules still run in kernel mode Linux = monolithic + loadable modules
"The BIOS loads the kernel directly" (interview: wrong) firmware starts a bootloader first firmware → bootloader (GRUB) → kernel → init (PID 1)
"API and ABI are the same thing" (interview: wrong) API = source contract; ABI = binary contract same API → recompile works; same ABI → old binary runs

Mini project: trace a boot and a system call on your own Linux machine

  1. Run systemd-analyze to see how long firmware, the bootloader, the kernel and user space took at the last boot, and systemd-analyze blame for the slowest services.
  2. Run cat /proc/cmdline to see the kernel command line your bootloader passed.
  3. Run lsmod | head to see loaded kernel modules, and ps -p 1 -o comm= to see your PID 1.
  4. Run [ -d /sys/firmware/efi ] && echo UEFI || echo BIOS to find out whether you booted with UEFI or legacy BIOS.
  5. Compile the five-category program above and run it under strace -f ./a.out to see each system call by name.

Practice

1. Change the raw syscall so it opens a file that exists. What does it return?

Solution

Create the file first, then open it with the raw trap. It returns a file descriptor, usually 3 (0, 1 and 2 are standard input, output and error):

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/syscall.h>

int main() {
    int fd = open("diary.txt", O_CREAT | O_WRONLY, 0644);
    close(fd);
    long r;
    __asm__ volatile ("syscall" : "=a"(r)
        : "a"(SYS_open), "D"("diary.txt"), "S"(O_RDONLY)
        : "rcx", "r11", "memory");
    printf("raw open returned fd %ld\n", r);

    printf("chmod returned %d\n", chmod("diary.txt", 0600));
    struct stat st;
    stat("diary.txt", &st);
    printf("permissions now %o\n", st.st_mode & 0777);
    return 0;
}

Output:

raw open returned fd 3
chmod returned 0
permissions now 600

2. Add a protection-category call: make diary.txt readable and writable only by its owner.

Solution

chmod("diary.txt", 0600), shown in the program above: it returns 0 on success, and stat confirms the permissions are now 600 (owner read + write, nobody else).

3. Write the boot chain from memory.

Solution

Power on → firmware (BIOS or UEFI) → POST → find the boot disk, read the partition table (MBR or GPT) → bootloader (GRUB) loads the kernel (+ initial RAM disk) → kernel initialisation (memory, interrupts, scheduler, drivers, mount root) → PID 1 (init/systemd) → services → login screen.

4. Classify: Linux, MINIX 3, XNU.

Solution

Linux: monolithic with loadable kernel modules. MINIX 3: microkernel. XNU: hybrid (Mach microkernel + FreeBSD components).

5. A disk has 512-byte sectors and an MBR partition table. Why can't it use more than 2 TiB?

Solution

MBR stores sector numbers in 32 bits, so it can name at most 2³² sectors. 2³² × 512 bytes = 2³² × 2⁹ = 2⁴¹ bytes = 2 TiB. GPT uses 64-bit block numbers.

6. Which category: (a) fork, (b) chown, (c) socket, (d) uname, (e) unlink, (f) ioctl?

Solution

(a) process control, (b) protection, (c) communication, (d) information maintenance, (e) file management, (f) device management.

Quick quiz

A disk driver crashes. Every other part of the OS keeps running, and the driver is restarted. Which design is this?

A. Monolithic kernel B. Microkernel C. Monolithic + modules D. Batch OS

Answer

B. Only a microkernel runs drivers as separate user-mode servers, so a crash stays inside one server and it can be restarted. A module runs inside the kernel, so it would crash everything.

Interview questions

  1. Monolithic vs microkernel? Monolithic: all OS services in kernel mode in one address space, fast, but one bug can crash all. Microkernel: only IPC, basic scheduling and memory in kernel mode; drivers and file systems are user-mode servers; more reliable, slower due to message passing.
  2. Is Linux a microkernel? No. It is monolithic with loadable kernel modules.
  3. What is a loadable kernel module? Kernel code (a driver, a file system) loaded into or removed from the running kernel without a reboot; it still runs in kernel mode.
  4. What is a hybrid kernel? Example? A microkernel-style design that keeps key services in kernel mode for speed. Apple's XNU (Mach + FreeBSD).
  5. What is an exokernel? A minimal kernel that only protects and allocates raw hardware; applications manage resources through a library OS.
  6. Advantages and disadvantages of a layered OS? Easy to build, debug and verify layer by layer; slow (calls pass through many layers) and hard to order layers.
  7. List the categories of system calls with examples. Process control (fork, exit, wait), file management (open, read, write, close), device management (ioctl), information maintenance (getpid, time), communication (pipe, socket, shared memory), protection (chmod, chown).
  8. How are parameters passed to a system call? In registers (Linux x86-64: number in rax, arguments in rdi, rsi, rdx, r10, r8, r9), or in a memory block whose address is passed in a register, or on the stack.
  9. API vs ABI? API: source-level contract (names, arguments, types). ABI: binary-level contract (call numbers, registers, type sizes, calling convention). A stable ABI lets old binaries run unchanged.
  10. What is POSIX and why does it matter? The Portable Operating System Interface, IEEE standards for a common OS API, shell and utilities, so code is portable across UNIX-like systems.
  11. What happens when you press the power button? Firmware (BIOS/UEFI) → POST → boot device and partition table → bootloader (GRUB) → kernel init → PID 1 (init/systemd) → services → login.
  12. BIOS vs UEFI? MBR vs GPT? BIOS: legacy, boots from the 512-byte MBR, 4 primary partitions, 2 TiB limit. UEFI: modern, boots a bootloader file from the EFI system partition, uses GPT (64-bit addresses, many partitions, backup header), supports Secure Boot.
  13. What is PID 1 and why is it special? The first user-mode process the kernel starts (init/systemd); it starts all services and adopts orphaned processes.

Glossary

Term Meaning in plain words Example
Device driver Kernel code that knows how to talk to one kind of device the SSD driver
Scheduler Kernel part that picks which program runs next on the CPU Linux's scheduler
Memory manager Kernel part that hands out RAM to programs gives a process its pages
File system Code that turns file names into blocks on a disk ext4
Kernel panic The kernel hits an error it can't recover from and stops the machine a crashing in-kernel driver
Monolithic kernel All OS services in kernel mode as one program Linux, classic UNIX
Layered OS OS built as layers; each uses only the one below layer 0 = hardware
Microkernel Minimal kernel (IPC, basic scheduling, memory); everything else in user-mode servers MINIX 3
Server (microkernel) A user-mode program providing an OS service a file server
IPC Inter-process communication: processes exchanging messages or data microkernel messages
Loadable kernel module (LKM) Kernel code loaded or removed while the kernel runs a Wi-Fi driver module
Modular kernel A core kernel extended by loadable modules Linux
lsmod Linux command listing loaded modules (from /proc/modules) lsmod \| head
Hybrid kernel Microkernel design with key services kept in kernel mode XNU
Exokernel Kernel that only protects and allocates raw hardware MIT research kernels
Library OS A library that manages resources for one application on an exokernel app-specific file layout
System call categories Process control, file, device, information, communication, protection fork, open, ioctl, time, pipe, chmod
File descriptor Small number naming an open file open returned 3
Pipe One-way channel between a write end and a read end pipe(p)
ioctl Input/output control: a device-specific command get terminal size
Unix epoch 00:00:00 UTC on 1 January 1970, time zero for time() time(NULL)
libc The C standard library glibc on Linux
Wrapper A library function that makes a system call for you open()
System call number The number that identifies a system call open = 2 on x86-64 Linux
System call table Kernel table mapping numbers to handlers entry 2 → open handler
System call interface The numbered doorway into the kernel plus its table the syscall instruction + table
errno Variable where libc stores the last error number 2 = ENOENT
ENOENT Error 2: "No such file or directory" opening missing.txt
Register Tiny storage slot inside the CPU rax, rdi
Inline assembly CPU instructions written inside C code __asm__ volatile ("syscall" ...)
API Application programming interface: a source-level contract int open(const char*, int)
ABI Application binary interface: a machine-level contract call 2, path in rdi
Calling convention Rules for which registers carry arguments and results x86-64 System V
POSIX Portable Operating System Interface, IEEE standard OS API fork, pipe
Boot / booting Starting the computer up to a running OS power button → login
Firmware Software stored permanently in a chip on the motherboard BIOS, UEFI
BIOS Basic Input/Output System, legacy PC firmware old PCs
UEFI Unified Extensible Firmware Interface, modern firmware modern laptops
POST Power-on self-test: firmware's hardware check beeps if RAM is missing
Partition A separate section of a disk the EFI system partition
Partition table The list of a disk's partitions MBR or GPT
MBR Master boot record: first 512-byte sector, boot code + 4-entry table legacy disks
GPT GUID Partition Table: 64-bit, many partitions, backup copy modern disks
GUID Globally unique identifier, a 128-bit ID a partition's GUID
TiB Tebibyte, 2⁴⁰ bytes MBR's 2 TiB limit
EFI system partition Small FAT partition holding UEFI bootloader files /boot/efi
Secure Boot UEFI feature that checks a bootloader's signature blocks unsigned bootloaders
Bootloader First software that runs at start-up; loads the kernel GRUB
GRUB GRand Unified Bootloader the Linux boot menu
Kernel command line Options the bootloader passes to the kernel root=/dev/sda2
Initial RAM disk A small temporary file system with early drivers initramfs
Kernel initialisation Kernel setting up memory, interrupts, scheduler, drivers, root file system after GRUB
Root file system The main file system, mounted at / your Linux partition
init The first user-mode process, PID 1 systemd
systemd A system and service manager; init on many Linux systems PID 1 on many distros
PID 1 Process id 1, ancestor of all processes /proc/1/comm
/proc Virtual folder whose files the kernel generates on the fly /proc/uptime

Summary

  • A monolithic kernel runs everything in kernel mode: fast, but one driver bug crashes everything (our segmentation fault). A layered OS is clean but slow. A microkernel keeps only IPC and basics in the kernel and runs drivers as user-mode servers: reliable, but message passing costs time.
  • Loadable kernel modules let a monolithic kernel add drivers at run time (Linux), but modules still run in kernel mode. Hybrid kernels (XNU) mix the ideas; exokernels only protect hardware and let a library OS do the rest.
  • System calls fall into six categories: process control, file management, device management, information maintenance, communication, protection.
  • A call goes through a libc wrapper, which loads the system call number and arguments into registers and traps; the kernel's system call table finds the handler. The raw kernel returns -errno; the wrapper returns −1 and sets errno.
  • The API is the source-level contract, the ABI the binary one; POSIX standardises the API across UNIX-like systems.
  • Boot: firmware (BIOS/UEFI) → POST → partition table (MBR/GPT) → bootloader (GRUB) → kernel initialisation → PID 1 (init/systemd) → login.

Next episode: processes: what a running program looks like in memory (text, data, BSS, heap, stack), the PCB, process states, schedulers and context switching.