Computer Architecture & Systems (How the Machine Really Works)
Go beneath the language to the machine itself — the layer that separates a generic software engineer from a low-latency systems engineer.
Go beneath the language to the machine itself — the layer that separates a generic software engineer from a low-latency systems engineer. You learn how data is represented in bits, how C compiles to x86-64 assembly, how the CPU pipelines and predicts branches, how the cache and memory hierarchy actually determine performance, how threads and atomics work at the hardware level, and how your program talks to the operating system kernel. Every concept is hands-on: you read disassembly on Compiler Explorer, measure cache effects and branch misprediction, profile with perf, and kill false sharing with cache-line alignment. This is the shared systems spine of the Zero-to-Low-Level-Systems-Elite program — the body of knowledge that HFT low-latency, AI-chip/kernel, and robotics roles all assume, and where 'thinking in cache lines and nanoseconds' is built.
6 phases · 48 projects · v1.1.0
Target roles: Low-Latency / HFT Engineer, AI-Chip / Kernel Engineer (foundation), Systems / Performance Engineer, Embedded / Robotics Engineer (foundation)
Stack: C++17/20, x86-64 / GCC / Clang, Compiler Explorer, perf / Linux
PHASE 1 · 8 projects
Data, Numbers & Representation
See how the machine stores everything in bits: integers and two's complement, overflow, IEEE-754 floating point, endianness, and character encodings.
01 · featured
Bits, Bytes & Hexadecimal
Inspect the raw binary and hex representation of C++ fundamental types using sizeof, std::bitset, fixed-width cstdint types, and byte-level memory access.
C++17/20 · std::bitset · <cstdint> · reinterpret_cast
02 · featured
Integer Representation & Two's Complement
Encode and decode signed and unsigned integers in binary using two's complement, observe sign extension, and query type ranges with std::numeric_limits.
C++17/20 · std::bitset · std::numeric_limits · <cstdint>
03 · featured
Integer Overflow & Its Dangers
Explore unsigned wraparound vs signed undefined behavior, reproduce the unsigned-comparison trap and size-calculation vulnerability, and implement safe overflow-detecting arithmetic.
C++17/20 · __builtin_add_overflow · UndefinedBehaviorSanitizer · <limits>
04 · featured
Floating Point & IEEE-754
Decode the sign/exponent/mantissa bit layout of IEEE-754 floats, reproduce the 0.1+0.2 precision problem, inspect special values, and implement correct epsilon-based comparisons.
C++17/20 · std::numeric_limits · <cmath> · std::memcpy type-pun
05 · featured
Bit Fields, Flags & Packing
Apply all six bitwise operators to implement bitmask flag operations, model a hardware register with C++ bit-fields, and measure struct padding and alignment with sizeof and offsetof.
C++17/20 · std::bitset · alignas · offsetof
06 · featured
Endianness & Byte Order
Inspect multi-byte integer layout in memory, convert between host and network byte order using htonl/ntohl, type-pun safely with std::memcpy, and implement portable little/big-endian serialization.
C++17/20 · std::byte · std::memcpy · htonl/ntohl · <arpa/inet.h>
07 · featured
Character Encoding: ASCII & UTF-8
Expose the integer nature of char, print the ASCII table, manually decode UTF-8 byte sequences to Unicode code points, and implement a code-point iterator that correctly handles multi-byte characters.
C++17/20 · std::string · <cctype> · manual UTF-8 decoding
08 · featured
Read & Write a Binary Format
Design, write, and read a fixed 16-byte binary record format with magic number, little-endian integer fields, and an XOR checksum using std::fstream in binary mode, synthesizing all Phase 1 concepts.
C++17/20 · std::fstream · std::memcpy · little-endian serialization · XOR checksum
PHASE 2 · 8 projects
From C to the Machine: Assembly & Linking
Follow C all the way down: the compilation pipeline, x86-64 assembly, how variables/control-flow/functions map to instructions and the stack, and how linking resolves symbols.
01 · featured
The Compilation Pipeline
Walk a two-file C++ program through all four pipeline stages — preprocess, compile, assemble, link — stopping at each to read the intermediate file and inspect symbols with nm.
C++20 · g++ · nm · objdump · ELF
02 · featured
x86-64 Assembly Basics
Learn the x86-64 register file, Intel syntax, and the core instruction set by annotating compiler output on Compiler Explorer — turning assembly from noise into readable machine-level C++.
C++20 · g++ · x86-64 · Compiler Explorer · Intel syntax
03 · featured
How C++ Maps to Assembly
Compare -O0 and -O2 compiler output for local variables, arithmetic, dead code, and constant folding — making the compiler's translation rules and optimization license visible.
C++20 · g++ · Compiler Explorer · x86-64 · Intel syntax
04 · featured
Control Flow in Assembly
Trace how if/else, for/while loops, and switch statements compile to cmp, conditional jumps, loop labels, and jump tables — making the FLAGS register and branchy assembly readable.
C++20 · g++ · x86-64 · Compiler Explorer · Intel syntax
05 · featured
Functions, the Stack & Calling Conventions
Trace the System V AMD64 ABI from argument registers through stack frame layout, prologue/epilogue, call/ret mechanics, and the red zone — building a complete mental model of how every function call works at the hardware level.
C++20 · g++ · x86-64 · System V ABI · Compiler Explorer
06 · featured
Pointers, Arrays & Addressing Modes
Decode the x86-64 base+index*scale+displacement addressing formula by tracing how array indexing, struct field access, and pointer arithmetic each compile to a specific memory operand.
C++20 · g++ · x86-64 · Intel syntax · Compiler Explorer
07 · featured
Linking, Symbols & Libraries
Build a static and a dynamic library, inspect symbols with nm/objdump/readelf, trigger a linker error to understand ODR, and learn the difference between static (.a) and dynamic (.so) linking.
C++20 · g++ · ar · nm · readelf · ldd · c++filt · ELF
08 · featured
Reading Disassembly
Compile a complete C++ program, disassemble it with objdump -d -M intel, and produce a fully annotated walkthrough of dot_product and argmax — mapping every instruction back to the C++ source.
C++20 · g++ · objdump · c++filt · DWARF · x86-64
PHASE 3 · 8 projects
The Processor & Performance
Understand why code runs fast or slow: pipelining, branch prediction, instruction-level parallelism, the roofline model, profiling with perf, and compiler optimizations.
01 · featured
The CPU Pipeline
Build a series of C++ microbenchmarks that make pipeline throughput, latency, data hazards, and superscalar IPC visible and measurable.
C++20 · g++ · chrono · volatile-sink
02 · featured
Branch Prediction
Reproduce the classic sorted-vs-unsorted array benchmark, quantify the ~15-cycle misprediction penalty, and implement branchless alternatives using arithmetic masking and cmov.
C++20 · g++ · chrono · perf stat · volatile-sink
03 · featured
Instruction-Level Parallelism
Break single-accumulator dependency chains with multiple accumulators, measure the IPC improvement via perf stat, and apply the pattern to both integer and FP reduction loops.
C++20 · g++ · chrono · perf stat · fno-tree-vectorize
04 · featured
Profiling with perf
Build a three-bottleneck target program, profile it with perf stat and perf record, identify each hotspot by its counter signature, and generate a flamegraph to visualize the call stack.
C++20 · g++ · perf stat · perf record · perf report · FlameGraph
05 · featured
The Roofline Model
Measure your machine's peak memory bandwidth and peak FLOPs, calculate arithmetic intensity for three kernels, place them on a roofline diagram, and determine which optimizations help in each performance regime.
C++20 · g++ · chrono · STREAM benchmark
06 · featured
What the Compiler Does For You
Measure the performance impact of -O0 through -Ofast, observe constant folding and inlining with timing experiments, use __restrict__ to unblock auto-vectorization, and read generated assembly on Compiler Explorer.
C++20 · g++ · Compiler Explorer/Compiler Explorer · fopt-info-vec
07 · featured
Hand-Optimizing a Hot Path
Apply four targeted optimizations to a deliberately slow order-processing function — eliminating heap allocations, hoisting invariants, replacing branches with lookup tables, and transforming AoS to SoA — and document a measurement log for each step.
C++20 · g++ · chrono · perf stat
08 · featured
Optimize a Kernel End-to-End
Take a naive character-frequency histogram from 0.35 GB/s to 7.8 GB/s by applying four bottleneck-targeted optimizations in sequence, profiling with perf at each step, and producing a full optimization report.
C++20 · g++ · chrono · perf stat · perf record
PHASE 4 · 8 projects
The Memory Hierarchy & Caches
Master the layer that dominates real performance: latency numbers, how caches work, locality, the memory mountain, false sharing, virtual memory, and the heap.
01 · featured
The Memory Hierarchy & Latency Numbers
Build a pointer-chasing benchmark that measures access latency across L1/L2/L3/DRAM and internalise the canonical latency numbers that drive every systems-performance decision.
C++20 · chrono · g++
02 · featured
How Caches Work
Build a stride benchmark that exposes cache-set conflicts by exploiting tag/index/offset address geometry, and measure L1/L2/L3/DRAM hit latency directly.
C++20 · chrono · g++
03 · featured
Locality & Cache-Friendly Code
Measure the row-major vs column-major 2D traversal gap and fix a matrix-multiply loop order, explaining every speedup in cache-line terms.
C++20 · chrono · g++
04 · featured
The Memory Mountain
Build a 2D throughput table sweeping working-set size and stride to map L1/L2/L3/DRAM plateaus and identify the spatial- and temporal-locality ridges on the student's own machine.
C++20 · chrono · g++
05 · featured
Data Layout: AoS vs SoA
Benchmark AoS vs SoA particle layouts for a field-selective loop, measure the cache-utilisation speedup, and learn when each layout is correct using data-oriented design principles.
C++20 · chrono · g++
06 · featured
False Sharing & Cache-Line Alignment
Reproduce and measure a false-sharing slowdown with two threads, fix it with alignas(64) padding and per-thread local accumulation, and explain the MESI coherence mechanism behind the bug.
C++20 · std::thread · std::atomic · chrono · g++ · pthread
07 · featured
Virtual Memory & Paging
Measure the TLB miss cliff by striding through a 256 MB array in page-sized increments, identify TLB capacity on the student's machine, and explain paging, page faults, and huge pages.
C++20 · chrono · g++
08 · featured
Build a Cache-Aware Data Structure
Implement a cache-line-sized B-tree node (15 int32 keys per 64-byte node), benchmark it against sorted-array binary search and a linked list, and explain the full speedup using every principle from Phase 4.
C++20 · chrono · g++
PHASE 5 · 8 projects
Concurrency at the Hardware Level
Make multicore code correct and fast: OS threads and affinity, the C++ memory model, atomics and lock-free basics, contention, a lock-free SPSC queue, and SIMD.
01 · featured
Threads, Cores & Scheduling
Query hardware topology, measure context-switch cost, demonstrate oversubscription collapse, and pin threads to specific CPU cores using pthread_setaffinity_np.
C++20 · pthreads · Linux sched_setaffinity
02 · featured
The C++ Memory Model & Reordering
Observe compiler and hardware reordering, detect data races with ThreadSanitizer, and build the happens-before mental model that makes concurrent code provably correct.
C++20 · ThreadSanitizer · pthreads · std::atomic
03 · featured
Atomics & Read-Modify-Write
Build a correct atomic counter three ways, implement a CAS retry loop, construct a spinlock from std::atomic_flag, and benchmark atomic vs mutex performance.
C++20 · std::atomic · std::atomic_flag · pthreads
04 · featured
Memory Ordering: acquire/release/seq_cst
Build the broken and correct flag-plus-data handoff, benchmark seq_cst vs acquire/release vs relaxed, and explain operationally what each ordering permits the CPU and compiler to reorder.
C++20 · std::atomic · memory_order · pthreads
05 · featured
Locks, Contention & Their Cost
Measure single-mutex throughput collapse vs thread count, recover scaling with per-bucket fine-grained locks, and quantify cache-line bounce and spinlock vs blocking-mutex trade-offs.
C++20 · std::mutex · std::atomic_flag · futex · pthreads
06 · featured
A Lock-Free SPSC Ring Buffer
Build a correct single-producer/single-consumer ring buffer using acquire/release atomics, demonstrate cache-line separation of head and tail, and benchmark against a mutex queue.
C++20 · std::atomic · memory_order · pthreads · alignas
07 · featured
SIMD & Data Parallelism
Vectorize a float-array kernel using AVX2 intrinsics and auto-vectorization, measure scalar vs SIMD throughput, and understand alignment requirements and horizontal reduction.
C++20 · AVX2 · __m256 · _mm256_* · GCC -mavx2 -mfma
08 · featured
Measure Parallel Speedup & Amdahl's Law
Parallelize a histogram workload across N threads, measure speedup vs cores, diagnose false sharing and load imbalance, and fit Amdahl's Law to predict the serial-fraction ceiling.
C++20 · std::thread · std::atomic · pthreads · Amdahl's Law
PHASE 6 · 8 projects
The OS Interface & Low-Latency Systems
Cross into the kernel and engineer for nanoseconds: system calls, processes/threads, files and I/O, sockets, epoll event loops, and low-latency techniques — capped by a measured latency lab.
01 · featured
System Calls & the Kernel Boundary
Measure the cost of a mode switch by writing programs that call write(2) directly, watching every syscall with strace, and benchmarking batched vs. per-byte writes — then explain why HFT hot paths obsess over eliminating kernel crossings.
C++20 · POSIX · Linux · strace · clock_gettime
02 · featured
Processes vs Threads
Use fork(2) to create child processes and observe copy-on-write address-space isolation, communicate between processes with a pipe, benchmark process vs thread creation cost, and explain when each abstraction is the right tool for a latency-critical system.
C++20 · POSIX · Linux · fork(2) · waitpid(2) · pipe(2) · pthreads
03 · featured
Files & I/O
Use the POSIX open/read/write/close/mmap syscall family to read a 1 MiB file at multiple chunk sizes, measure the throughput gap between per-byte and batched reads, and then memory-map the same file to observe zero-copy access — connecting each strategy to the kernel page cache.
C++20 · POSIX · Linux · open(2) · read(2) · mmap(2) · fsync(2)
04 · featured
Signals & Asynchronous Events
Install signal handlers with sigaction(2) to implement graceful SIGINT/SIGTERM shutdown, demonstrate why printf is banned in signal handlers, observe EINTR from interrupted syscalls, and implement the self-pipe trick to integrate signals safely into a select-based event loop.
C++20 · POSIX · Linux · sigaction(2) · kill(2) · select(2) · self-pipe trick
05 · featured
Sockets & Networking Basics
Build a TCP echo server and client from raw POSIX syscalls (socket/bind/listen/accept/connect/send/recv), handle partial sends and receives correctly, measure loopback round-trip latency, and learn the socket options that matter for low-latency systems.
C++20 · POSIX · Linux · TCP/IP · socket(2) · send(2) · recv(2)
06 · featured
I/O Multiplexing with epoll
Build a single-threaded TCP echo server using epoll_create/epoll_ctl/epoll_wait that handles multiple simultaneous non-blocking clients, implement edge-triggered drain loops, and explain why the reactor pattern scales to 10,000 connections where blocking-per-connection does not.
C++20 · Linux · epoll(7) · POSIX · non-blocking sockets · accept4(2)
07 · featured
Low-Latency Engineering Techniques
Synthesize the HFT engineering toolkit: implement and benchmark busy-polling vs epoll wakeup latency, apply the no-alloc hot-path discipline and measure p99 improvement, pin threads to CPU cores, and explain kernel-bypass concepts (DPDK, a kernel-bypass NIC) — backed by a latency histogram reporting p50/p99/p99.9.
C++20 · Linux · POSIX · pthread_setaffinity_np · eventfd · clock_gettime · DPDK concepts
08 · featured
Latency Lab — A Measured, Cache-Aware Lock-Free Component (Track Capstone)
Build, measure, and package a lock-free SPSC ring buffer with std::atomic acquire/release ordering and alignas(64) cache-line isolation, instrument it with a latency histogram reporting p50/p99/p99.9, benchmark it head-to-head against a mutex baseline and a naive (false-sharing) variant, and package everything with CMake + GoogleTest — the portfolio artifact that closes the Computer Architecture & Systems track.
C++20 · CMake 3.14+ · GoogleTest (FetchContent) · std::atomic · alignas(64) · pthreads · clock_gettime
Next step
Request Computer Architecture & Systems (How the Machine Really Works)
An advisor reviews the fit and confirms terms in writing. A request is not an acceptance and nothing is charged until you agree.
