Exercises from the CS Primer Computer Systems track.
The course covers binary encoding, C programming, x86-64 assembly, CPU performance, and memory hierarchy. Exercises are organized by module below.
Low-level data encoding and binary format exercises in Python.
| Exercise | Description |
|---|---|
varint/ |
Protobuf variable-length integer encode/decode |
varint-extension/ |
Same, reimplemented as a Python C extension |
color-convert/ |
Convert CSS hex colors (#rrggbb) to rgb() format |
utf8-truncate/ |
Truncate a UTF-8 string at N bytes without splitting a codepoint |
image-rotate/ |
Parse a BMP file and rotate the image 90 degrees |
syn-flood/ |
Parse a .pcap network capture and detect SYN flood patterns |
C programming exercises covering data structures and the C standard library.
| Exercise | Description |
|---|---|
dynamic-array/ |
Generic resizable array (like Python's list) in C |
hashmap/ |
Hash table with separate chaining, djb2 and FNV-1a hash functions, and load-factor resize |
csapp/ |
CS:APP textbook exercises — unsigned integer casting and shift behavior |
c_KeC/ |
K&R The C Programming Language exercises |
x86-64 assembly language exercises. Each folder has a .asm source, a C test harness, and a Makefile.
| Exercise | Description |
|---|---|
hello-x64/ |
Hello world using raw syscalls (macOS and Linux) |
sum-to-n/ |
Compute 1+2+…+n using the closed-form formula |
matrix-access/ |
Row-major 2D array element addressing |
x64-pangram/ |
Detect if a string is a pangram using a bitmask |
binary-convert/ |
Convert a binary string (e.g. "1010") to an integer |
cone-volume/ |
Compute cone volume V = ⅓πr²h using SSE floating point |
x64-fib/ |
Recursive Fibonacci using the x86-64 calling convention |
Reference materials: inte_manual_assembly.pdf, x86_64_register_map.svg
CPU microarchitecture and memory hierarchy exercises.
| Exercise | Description |
|---|---|
grayscale/ |
BMP grayscale conversion — C baseline and compiler-generated assembly |
color-quantize/ |
SIMD-optimized color quantization with Google Benchmark harness |
fast-pangram/ |
Fast pangram detection using a 26-bit bitmask in C |
bogosum/ |
Ordered vs random memory access — cache hit/miss analysis |
pointer-chase/ |
Pointer chasing microbenchmark; measure data loading and statistical analysis |
Course by Oz Solberg.