Systems Libraries & Runtimes — Expanded Project Guides

Systems Libraries & Runtimes — Expanded Project Guides

Phase 2 — Advanced Systems Track B

This track is about building the infrastructure that other software depends on. You’ll learn to write code that’s fast, correct across platforms, and doesn’t invoke undefined behavior.

About This Learning Path

These expanded project guides transform the original project specifications into comprehensive learning resources. Each project includes:

  • Deep Theoretical Foundation: Comprehensive explanations of underlying concepts
  • Complete Project Specification: Clear deliverables and acceptance criteria
  • Solution Architecture: Design patterns and component relationships (without spoiling the implementation)
  • Phased Implementation Guide: Step-by-step approach to build incrementally
  • Testing Strategy: How to verify your implementation works correctly
  • Common Pitfalls: Mistakes to avoid and debugging tips
  • Extensions & Challenges: Ways to go deeper after completing the core project
  • Self-Assessment Checklist: Verify your understanding before moving on

Core Concept Map

Concept What You Must Understand
Memory Allocators Free lists, fragmentation, arena vs general-purpose, metadata overhead
Threading Primitives Mutexes, atomics, memory ordering, lock-free algorithms
Async Runtimes Event loops, futures/promises, IO multiplexing (epoll/kqueue), schedulers
ABI Details Calling conventions, struct layout, symbol visibility, name mangling
Platform Differences POSIX vs Windows syscalls, endianness, feature detection
Performance Tuning Cache lines, branch prediction, SIMD, profiling
Undefined Behavior Strict aliasing, alignment, integer overflow, pointer provenance
API Design Ergonomics vs zero-cost, error handling, versioning

Projects in This Track

P01: Custom Memory Allocator

Language: C | Difficulty: Advanced | Focus: Memory Management

Build a production-ready memory allocator that can replace malloc in real programs. Learn why general-purpose allocators are slow, how jemalloc achieves scalability, and master the tradeoffs between speed, fragmentation, and thread safety.

Key Skills: Free lists, size classes, coalescing, thread-local caches, LD_PRELOAD deployment


P02: Work-Stealing Thread Pool

Language: C++ | Difficulty: Advanced | Focus: Concurrency & Parallelism

Implement a high-performance thread pool with work-stealing scheduling similar to Rayon or Go’s runtime. Master atomic operations, memory ordering, and cache-aware programming through building lock-free data structures.

Key Skills: Chase-Lev deque, atomics, false sharing avoidance, worker scheduling


P03: Mini Async Runtime

Language: Rust or C | Difficulty: Master | Focus: Asynchronous I/O

Build a single-threaded async runtime capable of handling thousands of concurrent connections. Demystify async/await by implementing the event loop, futures, and reactor pattern from scratch.

Key Skills: epoll/kqueue, futures, wakers, non-blocking I/O, C10K problem


P04: Cross-Platform Syscall Abstraction Library

Language: C | Difficulty: Advanced | Focus: Portability & ABI

Create a library that wraps platform-specific syscalls into a unified API, similar to libuv or Rust’s std. Discover why “POSIX” doesn’t mean identical and master the art of cross-platform development.

Key Skills: File descriptors vs HANDLEs, fork/exec vs CreateProcess, struct layout, feature detection


P05: High-Performance String Search Library

Language: C with SIMD | Difficulty: Expert | Focus: Low-Level Optimization

Build a SIMD-accelerated string search library that rivals ripgrep’s core. Learn why algorithm textbooks don’t teach what makes real tools fast, and master the art of feeding data to modern CPUs efficiently.

Key Skills: SSE/AVX2 intrinsics, CPU feature detection, cache-aware programming, UTF-8 handling


Suggested Learning Path

┌─────────────────────────────────────────────────────────────────────┐
│                     LEARNING PROGRESSION                             │
├─────────────────────────────────────────────────────────────────────┤
│                                                                       │
│  [P01: Memory Allocator]  ──────┐                                    │
│  Foundation: Memory management   │                                    │
│                                  │                                    │
│  [P02: Thread Pool]       ──────┼──→  [P03: Async Runtime]           │
│  Foundation: Concurrency        │      Combines threading + I/O       │
│                                  │                                    │
│  [P04: Cross-Platform]    ──────┘                                    │
│  Foundation: System interfaces                                        │
│                                                                       │
│  [P05: String Search]                                                │
│  Capstone: Performance optimization                                   │
│                                                                       │
└─────────────────────────────────────────────────────────────────────┘

Recommended Order:

  1. Start with P01 (Memory Allocator) or P04 (Cross-Platform) — foundational concepts
  2. Progress to P02 (Thread Pool) — builds on memory and introduces concurrency
  3. Tackle P03 (Async Runtime) — synthesizes threading and system I/O knowledge
  4. Finish with P05 (String Search) — capstone project applying all optimization skills

Prerequisites

Before starting this track, you should be comfortable with:

  • C Programming: Pointers, memory management, structs, function pointers
  • Systems Basics: Virtual memory, processes, file descriptors
  • Command Line: gcc/clang compilation, gdb debugging, make/cmake
  • Basic Threading: Creating threads, mutexes (will be deepened in projects)

Essential Books for This Track

Book Focus Areas
“Computer Systems: A Programmer’s Perspective” - Bryant & O’Hallaron Memory, caching, linking, virtual memory
“C Interfaces and Implementations” - David Hanson API design, memory management patterns
“Advanced Programming in the UNIX Environment” - Stevens & Rago POSIX system calls, process control
“Rust Atomics and Locks” - Mara Bos Memory ordering, lock-free programming
“The Linux Programming Interface” - Michael Kerrisk Deep Linux systems programming
“Modern X86 Assembly Language Programming” - Kusswurm SIMD, CPU architecture

These projects will transform you from someone who uses system libraries to someone who understands how they work at the deepest level.