Deep Dive — Study Catalog
19 parts · 180+ sections · interview-ready depth on networking, DPDK, memory, storage, virtualization, the C toolchain, threads/processes, and Unix file I/O.
Reference Books
| Code | Book | Focus |
|---|---|---|
LKD | Linux Kernel Development (3rd ed.) — Robert Love | Core concepts, scheduling, memory, sync |
ULK | Understanding the Linux Kernel (3rd ed.) — Bovet & Cesati | Deep internals, data structures, boot |
LKN | Linux Kernel Networking — Rami Rosen | Full network stack internals |
ULNI | Understanding Linux Network Internals — Benvenuti | sk_buff, protocols, drivers |
LDD | Linux Device Drivers (3rd ed.) — Corbet et al. | Drivers, PCI, block/char devices |
TCPIP | TCP/IP Illustrated Vol.1&2 — W. Richard Stevens | Protocol deep-dive |
DPDK | DPDK Programmer's Guide — DPDK Project | Official DPDK reference |
PPH | Is Parallel Programming Hard? — Paul E. McKenney | Locking, RCU, memory ordering |
PLKA | Professional Linux Kernel Architecture — Mauerer | Comprehensive architecture |
K&R | The C Programming Language (2nd ed.) — Kernighan & Ritchie | C language ground truth |
CSAPP | Computer Systems: A Programmer's Perspective — Bryant & O'Hallaron | Systems / linking / ABI / memory hierarchy |
APUE | Advanced Programming in the UNIX Environment — Stevens & Rago | POSIX APIs, signals, processes |
TLPI | The Linux Programming Interface — Michael Kerrisk | Definitive Linux syscall reference |
LSP | Linux System Programming (2nd ed.) — Robert Love | Practical syscall + glibc usage |
L&L | Linkers and Loaders — John R. Levine | ELF, relocation, dynamic linking |
EXPC | Expert C Programming: Deep C Secrets — Peter van der Linden | Pointers, declarations, gotchas |
MUEL | Modern Embedded Systems / Mastering Embedded Linux — Chris Simmonds | Cross-compilation, toolchain, sysroot |
PWPT | Programming with POSIX Threads — David R. Butenhof | pthread bible: mutex, cond var, cancel, TSD |
AOMP | The Art of Multiprocessor Programming — Herlihy & Shavit | Lock-free, wait-free, transactional memory theory |
Part I — System Boot & Initialization
ULK Ch.1 · LKD Ch.1
Part II — Memory Management
ULK Ch.2,8,9 · LKD Ch.12,15,16
- §2.1Physical Memory Layout (NUMA / Zones / struct page)
- §2.2Buddy Allocator
- §2.3Slab / Slub Allocator
- §2.4Virtual Memory & Paging (4-level PT, TLB, Huge Pages)
- §2.5Process Address Space (mm_struct, VMA, mmap, COW)
- §2.6Page Cache & Buffer Cache (LRU/MRU, writeback)
- §2.7Memory-Mapped I/O & DMA (ioremap, IOMMU)
Part III — Process Management & Scheduling
LKD Ch.3,4,5 · ULK Ch.3,6,11
- §3.1Process & Thread Data Structures (task_struct)
- §3.2Process Lifecycle (fork → exec → exit)
- §3.3CPU Scheduling (CFS, SCHED_FIFO, load balancing)
- §3.4Preemption & Context Switch
- §3.5Interrupts & Bottom Halves (IRQ → softirq → NAPI)
- §3.6Kernel Timers (jiffies, timer wheel, hrtimer, NO_HZ)
- §3.7Kernel Data Structures (list, hlist, rbtree, xarray, bitmap)
Part IV — System Calls & User-Kernel Interface
LKD Ch.5 · ULK Ch.10
- §4.1System Call Mechanism (syscall, vDSO)
- §4.2Key Networking Syscalls (socket, epoll, io_uring)
- §4.3ioctl & Netlink
- §4.4Sync / Async I/O (blocking, O_NONBLOCK, epoll, io_uring, sendfile)
- §4.5Signals
Part V — Interprocess Communication
LKD Ch.17 · ULK Ch.19
- §5.1Pipes & FIFOs
- §5.2POSIX IPC (msg queues, shared memory, semaphores)
- §5.3Futex (fast userspace mutex)
- §5.4Unix Domain Sockets
Part VI — Parallel Programming & Synchronization
PPH all · LKD Ch.9,10 · critical interview section
- §6.1Hardware Foundations (pipeline, store buffer, false sharing, NUMA)
- §6.2Cache Coherence Protocols (MESI / MOESI)
- §6.3Memory Barriers & Ordering (smp_mb, acquire/release, C11 model)
- §6.4Atomic Operations (CAS, fetch-add, ABA problem)
- §6.5Counting & Per-CPU Counters
- §6.6Locking Design Patterns (lockdep, ordering, granularity)
- §6.7Spinlock Internals (ticket → MCS → qspinlock)
- §6.8Sleeping Locks (mutex, rwsem, semaphore)
- §6.9Sequence Locks (seqlock_t)
- §6.10RCU Deep Dive (grace period, call_rcu, SRCU)
- §6.11Lock-Free & Wait-Free Algorithms (Treiber stack, MS queue, hazard ptrs)
- §6.12Per-CPU Data & Data Ownership
- §6.13Deferred Processing (refcount, RCU reclaim, workqueue)
- §6.14Parallel Design Patterns (batch, sharding, pipeline, map-reduce)
- §6.15Debugging (lockdep, KCSAN, TSan, perf lock)
- §6.16Linux Kernel Memory Model (LKMM, litmus tests)
Part VII — Network Stack Internals
LKN all · ULNI all · TCPIP Vol.1&2
- §7.1Socket Layer (struct socket → sock → tcp_sock)
- §7.2sk_buff — Core Data Structure (GSO, GRO, zero-copy)
- §7.3Network Device Layer (net_device, NAPI, TX/RX path)
- §7.4Traffic Control & QoS (Qdisc, HTB, cls_flower)
- §7.5IP Layer (ip_rcv, fragmentation, ICMP)
- §7.6Routing Subsystem (fib_table, LPM, fib_trie, policy routing)
- §7.7Neighbor Subsystem (ARP, NDP, proxy ARP, GARP)
- §7.8TCP/IP Deep Dive (state machine, CUBIC, BBR, SYN Cookie)
- §7.9UDP & Multicast socket
- §7.10Netfilter & NAT (5 hooks, conntrack, DNAT/SNAT)
- §7.11Network Bridge (FDB, MAC learning, STP)
- §7.12GRE & VXLAN Tunnels
- §7.13IPv6 (NDP, RA/RS, DHCPv6, extension headers)
- §7.14Multicast (IGMP, MLD, PIM-SM, RPF)
- §7.15DHCP Protocol & Proxy DHCP (DORA, DHCPv6)
- §7.16Routing Protocols (RIP, OSPF, BGP, BIRD)
Part VIII — Network Drivers & Hardware Interface
LDD Ch.17 · ULNI Ch.8,9 · DPDK docs
Part IX — DPDK (Userspace Networking) — Deep Dive
DPDKPG all · critical interview section
- §9.1Why DPDK: Kernel Bypass Architecture (UIO vs VFIO)
- §9.2DPDK Startup Flow (rte_eal_init 10 steps)
- §9.3PMD Poll Mode Driver (descriptor rings, DD bit, doorbell)
- §9.4NIC Multi-Queue, RSS & Flow Classification (rte_flow)
- §9.5Memory: Huge Pages, Mempool & Mbuf
- §9.6NUMA-Aware Programming
- §9.7Lock-Free Ring Buffer (rte_ring — CAS algorithm)
- §9.8Cache Optimization (alignment, prefetch, DDIO, WC)
- §9.9ACL & LPM Classification (DIR-24-8, rte_hash cuckoo)
- §9.10SR-IOV in DPDK (VF pass-through, VFIO)
- §9.11Hardware Offload (checksum, TSO, LRO, VXLAN offload)
- §9.12SIMD in DPDK (SSE4.2, AVX2, AVX-512)
- §9.13Virtio, vhost-user & vDPA
- §9.14Pipeline & Run-to-Completion Models
- §9.15DPDK Hot Upgrade (multi-process, shared memory)
- §9.16Session Management (fast path / slow path)
- §9.17QoS in DPDK (rte_meter, rte_sched, distributed rate limit)
- §9.18DPDK Bonding & Link Aggregation
- §9.19OVS-DPDK (EMC, dpcls, megaflow, VXLAN)
Part X — XDP (eXpress Data Path)
kernel docs · eBPF/XDP reference
Part XI — Storage & File Systems
LKD Ch.13,14 · EXT4 docs
- §11.1VFS (super_block, inode, dentry, address_space)
- §11.2ext4 File System (extents, JBD2, delayed alloc)
- §11.3Block Layer (struct bio, blk-mq, I/O schedulers, O_DIRECT)
- §11.4B+ Tree (split/merge, lock coupling)
- §11.5Page Cache Management (LRU/MRU, double-write buffer)
- §11.6Disk Free Space Management (bitmap, buddy)
- §11.7Coroutines & Cooperative Scheduling (async I/O + ucontext)
Part XII — Virtualization & Containers
LKD Ch.18 · KVM docs · LXC/Docker
- §12.1CPU Virtualization (KVM/VMX, VMCS, VMEXIT)
- §12.2Memory Virtualization (EPT, balloon, KSM)
- §12.3VM Live Migration (dirty page tracking, pre-copy)
- §12.4Containers: Namespace & Cgroup v2
- §12.5Container Networking — CNI (veth, VXLAN, Cilium)
- §12.6Storage Virtualization (virtio-blk, vhost-user-blk, NVMe PT)
Part XIII — Hardware Communication & PCIe
PCIe spec · DPDK docs · LDD Ch.15
Part XIV — Debugging & Profiling Tools
LKD Ch.18 · perf docs · kernel tracing
- §14.1Network Debugging (tcpdump, ss, iperf3, ethtool)
- §14.2System Call Tracing (strace, ltrace, perf trace)
- §14.3Performance Profiling (perf stat/record/top, flamegraph)
- §14.4Kernel Debugging (gdb+KGDB, crash, KASAN, OOPS)
- §14.5Kernel Tracing (ftrace, kprobe, eBPF/bcc, bpftrace)
- §14.6Memory Debugging (valgrind, kmemleak, /proc/slabinfo)
Part XV — Distributed Systems (Raft)
Ongaro & Ousterhout
Part XVI — Load Balancing & Consistent Hashing
Resume projects · DPDK LPM/ACL
Part XVII — C Standard Library, Toolchain & ABI
CSAPP · APUE · TLPI · Linkers and Loaders · Expert C · interview-critical
- §17.1C libc Landscape (glibc vs musl vs uClibc vs Bionic vs newlib vs dietlibc — size/perf/license trade-offs)
- §17.2User → Kernel Path: libc Wrapper → syscall Instruction → kernel handler (errno convention, INTERNAL_SYSCALL macros)
- §17.3vDSO & Pseudo Syscalls (clock_gettime/gettimeofday/time/getcpu run in user space — no ring switch; auxv AT_SYSINFO_EHDR)
- §17.4Userspace Memory Allocator (ptmalloc2 arenas/bins/fastbins/tcache; brk vs mmap threshold M_MMAP_THRESHOLD; fragmentation)
- §17.5Allocator Alternatives (jemalloc, tcmalloc, mimalloc, scudo) — per-thread cache, size classes, why DPDK uses rte_malloc instead
- §17.6stdio Buffering (full/line/unbuffered, FILE*, setvbuf, fflush — fork() double-flush pitfall)
- §17.7POSIX Thread Library (NPTL, pthread_create → clone(CLONE_VM|...), 1:1 model, futex-backed mutex, pthread_key TSD)
- §17.8Thread-Local Storage (__thread / _Thread_local, ELF .tdata/.tbss, TLS models GD/LD/IE/LE, FS/GS register)
- §17.9Dynamic Linker / Loader (ld.so, PLT/GOT, lazy binding via _dl_runtime_resolve, LD_PRELOAD, LD_LIBRARY_PATH, RPATH vs RUNPATH)
- §17.10Runtime Loading (dlopen/dlsym/dlclose, RTLD_LAZY vs RTLD_NOW, RTLD_GLOBAL, plugin pattern)
- §17.11ELF File Format (header, PHT vs SHT, segments LOAD/DYNAMIC/INTERP, sections .text/.rodata/.data/.bss/.init_array, symbol/relocation tables)
- §17.12C Compilation Pipeline (cpp preprocess → cc1 compile → as assemble → ld link; gcc -E/-S/-c/-o; -save-temps; intermediate .i/.s/.o)
- §17.13Static vs Dynamic Linking (.a archive ar/ranlib, .so, -static, ldconfig cache /etc/ld.so.cache, soname/version, symbol resolution order)
- §17.14Position Independent Code (PIC -fPIC for .so, PIE -fPIE for ASLR, GOT/PLT indirection cost, copy relocations)
- §17.15Cross Compilation (target triplet arch-vendor-os-libc e.g. aarch64-linux-gnu, --host/--build/--target, sysroot, multilib)
- §17.16Cross Toolchains (crosstool-NG, Buildroot, Yocto/OE, Linaro GCC; how to build a glibc/musl cross toolchain from scratch)
- §17.17Library Inspection Tools (ldd, ldconfig -p, nm, objdump -d/-h/-r, readelf -a/-d/-l, strings, file, strip, ar, c++filt, addr2line, size, ranlib)
- §17.18Runtime Tracing (strace -e trace=... syscalls, ltrace library calls, LD_DEBUG=symbols/bindings/files, perf trace)
- §17.19Calling Conventions / ABI (SysV AMD64: rdi/rsi/rdx/rcx/r8/r9 + xmm0–7, red zone 128B, stack 16-byte alignment; x86 cdecl/stdcall; ARM AAPCS r0–r3)
- §17.20C ↔ C++ ABI (Itanium C++ ABI, name mangling _ZN..., vtable/RTTI layout, extern "C", ABI breakage between GCC versions)
- §17.21errno & Reentrancy (errno is per-thread macro → *__errno_location(); _r reentrant variants; async-signal-safe set)
- §17.22Atomics & Memory Model (C11 <stdatomic.h>, atomic_*, memory_order_relaxed/acquire/release/seq_cst, libatomic fallback)
- §17.23glibc Internals (rtld bootstrap, hidden_def, IFUNC dispatch e.g. memcpy AVX/SSE, symbol versioning GLIBC_2.x, vtable hardening)
- §17.24Security Hardening (FORTIFY_SOURCE=2/3, -fstack-protector-strong canary, ASLR, RELRO partial/full, NX/DEP, CFI, _GLIBCXX_ASSERTIONS)
- §17.25Common C Libraries — System: libpthread, librt, libdl, libm, libresolv, libcrypt (now libxcrypt)
- §17.26Common C Libraries — Crypto/Net: OpenSSL (libssl/libcrypto), libcurl, c-ares, libpcap, libnl (netlink), libnftnl, libnfnetlink
- §17.27Common C Libraries — Event Loops: libev, libevent, libuv (cross-platform), libaio, liburing (io_uring)
- §17.28Common C Libraries — DPDK/Kernel-bypass: librte_eal/mempool/mbuf/ring/hash/lpm, libnuma, libhugetlbfs, libpci, liburcu
- §17.29Common C Libraries — eBPF: libbpf, libxdp, libelf, libdebuginfod, BCC (Python-bound)
- §17.30Common C Libraries — Compression: zlib, libbz2, liblzma, lz4, libzstd, snappy-c
- §17.31Common C Libraries — Serialization: protobuf-c, msgpack-c, libcjson, libxml2, libyaml
- §17.32Common C Libraries — Data Structures: glib (GLib), libavl, libcuckoo, judy arrays
- §17.33Sanitizers & Static Analysis (ASan/MSan/TSan/UBSan, valgrind memcheck/helgrind/cachegrind, clang-tidy, cppcheck, scan-build)
- §17.34Build Systems & Package Discovery (Make, CMake, Meson, autotools; pkg-config --cflags/--libs, .pc files)
Part XVIII — Threads, Processes & User-Space Synchronization
TLPI Ch.24-30 · APUE Ch.8,11,12 · Butenhof · interview-critical
- §18.1Process vs Thread vs Coroutine (memory model, fault isolation, switch cost, scheduling unit)
- §18.2fork() Semantics (COW, FD inheritance, mmap inheritance, atfork handlers, fork+threads pitfall)
- §18.3vfork vs fork vs clone() (CLONE_VM/FILES/SIGHAND/THREAD/NEWPID/NEWNS — building blocks of threads & containers)
- §18.4exec Family (execl/execv/execvp/execve, environment passing, FD_CLOEXEC, fexecve, exec + posix_spawn)
- §18.5Process Lifecycle (states R/S/D/Z/T/X, wait/waitpid/waitid, SIGCHLD, zombie/orphan, init/subreaper)
- §18.6Daemon Process Pattern (double-fork, setsid, chdir, umask, redirect std fds, PID file, syslog)
- §18.7Process Groups, Sessions & Job Control (setpgid, setsid, tcsetpgrp, controlling terminal, SIGHUP)
- §18.8Resource Limits & Accounting (setrlimit/prlimit, getrusage, RLIMIT_NOFILE/STACK/AS/CORE, ulimit)
- §18.9Privilege Management (uid/euid/suid/fsuid, setuid/seteuid, capabilities CAP_*, cap_set_proc)
- §18.10pthread Lifecycle (pthread_create/join/detach, pthread_attr_t — stack size, sched policy, contention scope)
- §18.11pthread Mutex (NORMAL/RECURSIVE/ERRORCHECK/ROBUST, PRIO_INHERIT, PROCESS_SHARED for shm)
- §18.12pthread Condition Variable (predicate loop, wait/signal/broadcast, spurious wakeup, lost-wakeup pitfall)
- §18.13pthread RWLock (reader/writer preference, recursive-read deadlock, when RCU is better)
- §18.14pthread Spinlock & Barrier (busy-wait when context switch is more expensive, PROCESS_SHARED)
- §18.15pthread Cancel & Cleanup (cancellation points, deferred vs async, pthread_cleanup_push/pop, RAII analog in C)
- §18.16pthread_once & Thread-Specific Data (pthread_once init, pthread_key_create + destructor on exit)
- §18.17Signal Handling in Multi-Threaded Programs (sigwait, pthread_sigmask, signalfd, async-signal-safe set)
- §18.18Producer-Consumer Patterns (bounded buffer, sem + mutex, blocking queue, SPSC lock-free ring)
- §18.19Reader-Writer Patterns (preferring readers vs writers, seqlock alternative, RCU alternative)
- §18.20Thread Pool Design (fixed/dynamic sizing, bounded queue, work stealing, graceful shutdown)
- §18.21Multi-Process Server Models (Apache prefork, Nginx master+worker, fork-per-connection, pipe dispatch)
- §18.22Multi-Thread Server Models (thread-per-connection, thread pool + epoll/io_uring, M:N hybrid)
- §18.23Concurrency Model Comparison (process / thread / coroutine / event-loop / actor — pros, cons, use cases)
- §18.24Deadlock Prevention (lock ordering, try-lock with backoff, hierarchical mutex, deadlock detection)
- §18.25Priority Inversion & PI Futex (classic Mars Pathfinder bug, PI mutex, ceiling protocol)
- §18.26Inter-Process Synchronization (PROCESS_SHARED mutex/sem in shm, POSIX named sem, fcntl/flock file lock, robust mutex on owner death)
- §18.27Userspace Coroutines & Fibers (ucontext makecontext/swapcontext, libco/libtask, stackful vs stackless, ABI cost)
- §18.28Modern Coroutine Models (Go M:N goroutines + scheduler, C++20 coroutines, Rust async/await — comparison to C)
Part XIX — File Descriptors, File I/O & Unix Plumbing
TLPI Ch.4-19,44-50,63 · APUE Ch.3,4,14,15,17 · interview-critical
- §19.1File Descriptor Model (per-process FD table → open file description → inode; ref-counting on dup/fork)
- §19.2open() Flags (O_RDONLY/WRONLY/RDWR, O_APPEND atomicity, O_CREAT|O_EXCL TOCTOU-safe create, O_NONBLOCK, O_DIRECT bypass page cache, O_SYNC/O_DSYNC, O_TMPFILE, O_PATH, O_CLOEXEC, O_NOFOLLOW)
- §19.3read/write Family (read/write short-count rules, pread/pwrite no-offset-race, readv/writev scatter-gather, copy_file_range in-kernel copy)
- §19.4lseek & Sparse Files (SEEK_SET/CUR/END, SEEK_HOLE/SEEK_DATA, fallocate/FALLOC_FL_PUNCH_HOLE)
- §19.5dup / dup2 / dup3 (FD aliasing, redirect stdout to a pipe, FD_CLOEXEC propagation rules, fork/exec interaction)
- §19.6Pipe Internals (pipe(2)/pipe2, 64 KB kernel ring, PIPE_BUF=4096 atomic write boundary, SIGPIPE/EPIPE on broken reader)
- §19.7Named Pipes / FIFOs (mkfifo, blocking until both ends opened, multi-writer atomicity, use cases vs Unix sockets)
- §19.8Zero-Copy Plumbing (sendfile fd→fd, splice pipe-mediated zero-copy, tee duplicate pipe data, vmsplice user pages → pipe)
- §19.9fcntl (F_GETFL/F_SETFL toggle O_NONBLOCK, F_DUPFD_CLOEXEC, F_SETPIPE_SZ resize pipe, F_NOTIFY directory changes — legacy)
- §19.10File Locking (BSD flock whole-file, fcntl record locks per-process pitfall, OFD locks F_OFD_SETLK per-FD safe, mandatory vs advisory, lockf)
- §19.11mmap & Memory-Mapped I/O (MAP_SHARED vs PRIVATE COW, MAP_ANONYMOUS, MAP_POPULATE prefault, MAP_HUGETLB, MAP_FIXED hazards, msync/madvise WILLNEED/DONTNEED/HUGEPAGE)
- §19.12Directory Operations (opendir/readdir/closedir, raw getdents64, scandir, telldir/seekdir/rewinddir; openat/AT_FDCWD safe relative ops)
- §19.13File Metadata (stat/fstat/lstat/statx, st_dev/st_ino identity, atime/mtime/ctime, relatime/noatime mount opts, nanosecond timestamps)
- §19.14Permissions & Ownership (chmod/fchmod/chown/fchown, umask inheritance, setuid/setgid/sticky bits, ACL setfacl/getfacl, file capabilities)
- §19.15Links & Path Operations (hard link vs symlink, readlink, rename atomicity guarantees, renameat2 RENAME_EXCHANGE/RENAME_NOREPLACE, unlink-while-open delayed delete)
- §19.16Filesystem Notification (inotify watch descriptors + epoll, fanotify content access / permission events, dnotify legacy, recursive watch design)
- §19.17Special Files (eventfd counter for IPC wakeups, signalfd synchronous signal receive, timerfd timer-as-FD, memfd_create + memfd seals — sealable shared memory)
- §19.18Async I/O (POSIX aio_* user-thread emulation, Linux native io_submit/io_getevents quirks, libaio O_DIRECT only, why everyone moved to io_uring)
- §19.19Filesystem Containment (chroot escapes, pivot_root for containers, openat O_PATH FD-rooted ops, mount namespaces interaction)
- §19.20Extended Attributes (user.* / security.* / system.* / trusted.* namespaces, getxattr/setxattr/listxattr, used by SELinux/Smack and file caps)
- §19.21stdio vs Raw FD (FILE* buffering full/line/none, fdopen/fileno/freopen, fork-double-flush, mixing fwrite+write breaks order)
- §19.22tty / pty (pseudo-terminal master/slave, openpty/forkpty, raw vs cooked mode, used by ssh/screen/tmux/Docker exec)
- §19.23/proc & /sys File Interfaces (counters via read, tunables via write, /proc/self/fd, /proc/PID/maps VMA dump, /sys/class/net devices)
- §19.24epoll Deep Dive (epoll_create1, ADD/MOD/DEL, EPOLLET edge-trigger drain rule, EPOLLONESHOT, EPOLLEXCLUSIVE thundering herd, vs select/poll O(n))
- §19.25io_uring Deep Dive (SQ/CQ shared rings, SQPOLL kernel-side polling, IORING_OP_* op set, fixed buffers/registered files, multishot, IOSQE_LINK chains)
Appendix — Key Kernel Data Structures
| Structure | Header | Purpose |
|---|---|---|
struct task_struct | linux/sched.h | Process descriptor |
struct mm_struct | linux/mm_types.h | Process address space |
struct page | linux/mm_types.h | Physical page frame |
struct sk_buff | linux/skbuff.h | Network packet |
struct sock | net/sock.h | Socket state |
struct net_device | linux/netdevice.h | Network interface |
struct Qdisc | net/sch_generic.h | Traffic control queue |
struct neighbour | net/neighbour.h | ARP/NDP entry |
struct rtable | net/route.h | IPv4 route cache entry |
struct nf_conn | net/netfilter/nf_conntrack.h | Connection track entry |
struct inode | linux/fs.h | File system inode |
struct bio | linux/bio.h | Block I/O unit |
struct vm_area_struct | linux/mm_types.h | VMA — memory region |
Appendix — C libc Implementations
| Implementation | Typical Use | Trade-off |
|---|---|---|
glibc | Desktop / server Linux (Debian, RHEL, Ubuntu) | Feature-complete, large (~10 MB), LGPL, IFUNC dispatch, NSS plugin |
musl | Alpine, static binaries, container images | Tiny (~600 KB), MIT, simpler malloc, stricter POSIX, slower DNS |
uClibc / uClibc-ng | Embedded MMU-less or tight MIPS/ARM systems | Configurable feature subset, smaller than glibc |
Bionic | Android | BSD-derived, no full POSIX, fortified, integrates with linker64 |
newlib | Bare-metal / RTOS (Cortex-M, RISC-V) | Provides libc without OS; you supply syscall stubs |
dietlibc | Static minimal binaries | Optimised for size, GPL, partial coverage |
picolibc | Embedded successor to newlib + AVR libc | Tiny, BSD-licensed, TLS-aware |
Cosmopolitan libc | Cross-OS portable executables (APE) | Single binary runs on Linux/Mac/Win/BSD |
Appendix — Toolchain & Library Inspection Tools
| Tool | Layer | What it answers |
|---|---|---|
file | ELF header | 32/64-bit? statically vs dynamically linked? stripped? |
ldd | Dynamic linker | Which .so files this binary loads, and from where |
ldconfig -p | ld.so cache | List all libraries the loader knows about |
readelf -a | ELF metadata | Sections, segments, dynamic tags, symbol versions, NEEDED |
objdump -d | Disassembly | Per-section disassembly, source interleave with -S |
objdump -h / -r | Sections / relocations | Section flags, relocation entries |
nm | Symbol table | Defined / undefined / weak symbols (T/U/W) |
strings | Raw bytes | Embedded literals, version banners, hidden paths |
strip | Section stripper | Remove debug / symbols to shrink binaries |
ar / ranlib | Static archive | Create / inspect / index .a libraries |
c++filt | Demangler | Decode Itanium-mangled C++ names like _ZN3foo3barEv |
addr2line | Debug info | Translate runtime address back to file:line |
size | Section sizing | text/data/bss bytes per object |
pkg-config | Build flags | Resolve --cflags / --libs from .pc files |
strace | Syscall trace | Every syscall a process makes (with -c, -e, -f) |
ltrace | Library trace | Every dynamic library call (printf, malloc...) |
LD_DEBUG=... | Loader trace | symbols / bindings / files / reloc — see ld.so resolve |
LD_PRELOAD | Symbol override | Inject a .so to replace functions (interposition) |
valgrind | Userspace VM | memcheck, helgrind (race), cachegrind, massif |
Appendix — Common C Libraries Cheat Sheet
| Library | Domain | Why it matters |
|---|---|---|
libpthread | Threads | POSIX threads, mutex, cond var (now folded into glibc) |
librt | Realtime POSIX | timer_create, shm_open, mq_open, clock_nanosleep |
libdl | Dynamic load | dlopen / dlsym / dlerror — runtime plugin loading |
libm | Math | sin/cos/exp/log; needs explicit -lm with gcc |
libcrypto / libssl | Crypto | OpenSSL — TLS, AES, RSA, EVP API |
libcurl | HTTP/FTP client | Multi-protocol transfer, easy + multi interface |
c-ares | Async DNS | Non-blocking DNS resolver used by curl, Node |
libpcap | Packet capture | BPF filter compile, AF_PACKET / pcap_next_ex |
libnl / libnl-3 | Netlink | Userspace ↔ kernel rtnetlink, nl80211, generic netlink |
libnftnl / libmnl | nftables / netlink | Modern Netfilter userspace |
libev / libevent | Event loop | epoll/kqueue abstraction, timers, signals |
libuv | Cross-platform async | Node.js core; epoll on Linux, IOCP on Windows |
liburing | io_uring API | User-friendly wrapper around io_uring SQ/CQ rings |
liburcu | Userspace RCU | Lock-free reads in user space (used by LTTng, DPDK) |
libnuma | NUMA bind | numa_alloc_onnode, numa_run_on_node, mempolicy |
libhugetlbfs | Huge pages | Back malloc with 2 MB / 1 GB pages transparently |
libbpf | eBPF userspace | Load BPF object, manage maps, CO-RE relocations |
libxdp | AF_XDP / XDP | UMEM, fill/completion ring helpers, multi-prog dispatch |
libelf / libdw | ELF parsing | Used by perf, BPF, debuggers, objcopy |
zlib / lz4 / zstd | Compression | deflate / fast / high-ratio compression |
protobuf-c / msgpack-c | Serialization | Wire format encode/decode for RPC and storage |
libcjson / jansson | JSON | Parse / build JSON with C structs |
libxml2 / libyaml | XML / YAML | Configuration parsing, SAX & DOM |
jemalloc / tcmalloc / mimalloc | Allocator | Drop-in malloc replacements with thread-cache |
GLib | Toolkit | GArray, GHashTable, GAsyncQueue, main loop (used by GTK, Qemu) |
DPDK librte_* | Kernel-bypass | EAL, mempool, mbuf, ring, hash, lpm, eventdev |
Appendix — C Compilation Pipeline & Cross-Build
| Stage | Tool | Input → Output | gcc flag |
|---|---|---|---|
| Preprocess | cpp | .c → .i (expand #include / #define / macros) | -E |
| Compile | cc1 | .i → .s (translate to target assembly) | -S |
| Assemble | as (binutils) | .s → .o (ELF relocatable object) | -c |
| Link | ld / collect2 | .o + .a + .so → ELF executable / shared object | (default) |
| Static archive | ar / ranlib | *.o → .a archive (just a bag of objects + index) | — |
| Shared library | gcc -shared -fPIC | *.o → .so (PIC, has DT_SONAME) | -shared -fPIC |
| Static linking | gcc -static | Pulls .a contents into final ELF; no ld.so needed | -static |
| Cross compile | <triplet>-gcc | Run on host, emit binaries for target ISA + libc | --sysroot=... |
| Strip | strip | Drop .symtab / .debug_* sections | — |
Appendix — vDSO Pseudo-Syscalls (no kernel switch)
| Symbol | Replaces | Why it can stay in user space |
|---|---|---|
__vdso_clock_gettime | clock_gettime(2) | Kernel publishes monotonic/realtime counters in a shared page; user reads TSC + offsets |
__vdso_gettimeofday | gettimeofday(2) | Same shared timekeeping page; arithmetic-only |
__vdso_time | time(2) | Reads cached unix time from shared page |
__vdso_getcpu | getcpu(2) | Reads CPU id from RDTSCP / TLS, no syscall |
__vdso_clock_getres | clock_getres(2) | Returns hardcoded resolution for known clock_id |