~/learn

Topics

Lecture notes and theory for the Systems Programming course.

Lecture notes and theory, organized by topic.

Introduction to Unix and Linux

What an operating system and a kernel are, where Unix and Linux came from, GNU, distributions, and the shell — the foundation for the course.

Unix File Systems

How a Unix system organizes files — the directory tree, file types, links, and the user/group permission model.

Compiling C/C++

How source code becomes an executable — the preprocess, compile, assemble, and link pipeline, libraries, memory layout, and make.

System Calls & Basic I/O

How programs ask the kernel to do work — system calls, the errno convention, file descriptors, and open/read/write/close.

Advanced File I/O

Beyond read/write — duplicating descriptors, seeking with lseek, sparse files and holes, and controlling files with fcntl.

Processes

The process model in Linux — process attributes and states, virtual memory, and creating processes with fork, exec, and wait.

Threads

Threads as lightweight units of execution that share a process's memory, and the POSIX threads (pthreads) API to create and join them.

Synchronization

Why concurrent threads corrupt shared data, and the primitives — mutexes, spinlocks, semaphores, and condition variables — that fix it.

Classical Sync Problems

Canonical concurrency puzzles — producer–consumer, readers–writers, and dining philosophers — and how synchronization primitives solve them.

Signals

Signals as asynchronous software interrupts — the common signals, sending them with kill, and handling them reliably with sigaction.

Pipes and FIFOs

Unix pipes as unidirectional byte streams — anonymous pipes for related processes and named pipes (FIFOs) for unrelated ones.

Shared Memory

The fastest IPC — mapping the same memory into multiple processes with mmap and POSIX shared memory, and why it needs explicit synchronization.

Networking

The networking fundamentals behind sockets — the OSI and TCP/IP models, MAC/IP/port addressing, TCP vs UDP, and DNS.

Sockets

The BSD socket API for network programming — domains and types, byte order, and the TCP and UDP client/server call sequences.

I/O Multiplexing

Serving many connections in one thread — non-blocking I/O and the select, poll, and epoll interfaces behind event-driven servers.