Learning Resources
This module is populated from the local chunked books in library/raw/semester-04-systems-programming/books and a small number of carefully chosen external references. Use this page as a source map, not as an instruction to read everything.
Source Stack
| Book | Role | How to use it in this module |
|---|---|---|
| The C Programming Language (K&R) | Primary teaching source for pointers, arrays, structs | Default escalation for any pointer, array-pointer, or struct topic |
| Computer Organization and Design (Patterson & Hennessy) | Primary teaching source for representation and call conventions | Use for signed numbers, IEEE 754, procedure calling conventions, and memory addressing |
| CODE (Petzold) | Selective first-principles support | Use when you want bits, bytes, and two's complement explained from scratch |
| SICP | Peripheral | Rarely needed here; useful if you want a meta-view of abstraction but not operationally required |
| Computer Systems: A Programmer's Perspective (CSAPP) | Local support | Use it when you want a second systems-level pass on representation, memory, and machine-level consequences after K&R and Patterson |
Resource Map by Cluster
Cluster 1: Bits, Bytes, and Representation
| Need | Best local chunk | Why |
|---|---|---|
| bits and bytes from scratch | CODE: Bit by Bit by Bit | Best first-principles introduction to binary |
| hexadecimal notation | CODE: Bytes and Hexadecimal | Short, clear motivation for hex |
| bitwise operators in C | K&R: Bitwise Operators | Canonical operator rundown |
| signed vs unsigned integers | COD: Signed and Unsigned Numbers | Tightest treatment of two's complement in hardware context |
| two's complement worked mechanics | CODE: But What About Subtraction | Step-by-step subtraction via two's complement |
| IEEE 754 | COD: Floating Point | Best single-stop explanation of the format |
Cluster 2: Pointers and Addresses
| Need | Best local chunk | Why |
|---|---|---|
| what a pointer is | K&R: Pointers and Addresses | Tight, canonical first treatment |
| pointer arguments | K&R: Pointers and Function Arguments | Why C passes by value and how pointers undo that |
| pointer arithmetic and arrays | K&R: Address Arithmetic | The section that makes pointer arithmetic click |
| arrays versus pointers (hardware view) | COD: Arrays versus Pointers | What the compiler actually does |
| pointers to pointers, argv | K&R: Pointer Arrays, Pointers to Pointers | Canonical explanation via argv |
| function pointers | K&R: Pointers to Functions | The reference for dispatch tables and qsort |
Cluster 3: Memory Layout
| Need | Best local chunk | Why |
|---|---|---|
| what program loading looks like | COD: Translating and Starting a Program (Part 5) | Covers how segments end up in memory |
| procedure calling convention | COD: Supporting Procedures in Computer Hardware | Best single chapter on call/return mechanics |
| frames in a real example | COD: A C Sort Example | Walks through a full C function in assembly |
| memory as an assemblage | CODE: An Assemblage of Memory | Hardware view of RAM as addressable bytes |
| toy storage allocator | K&R: Example - A Storage Allocator | The classic small malloc / free implementation |
Cluster 4: Memory Errors and Safety
| Need | Best local chunk or resource | Why |
|---|---|---|
| overflow risks in C | K&R: Character Pointers and Functions | Where unsafe string idioms appear |
| self-referential structures | K&R: Self-Referential Structures | Sets up common UAF patterns (linked lists) |
| ASan documentation | Clang AddressSanitizer | Authoritative reference |
| Valgrind Memcheck | Valgrind Memcheck manual | Authoritative reference |
| CWE classifications | CWE Memory Safety Category | Good to know the vocabulary |
Cluster 5: Structs, Alignment, and Endianness
| Need | Best local chunk | Why |
|---|---|---|
| struct basics | K&R: Basics of Structures | Canonical introduction |
| arrays of structs, pointers to structs | K&R: Arrays of Structures | Tied together with layout reasoning |
| bit fields | K&R: Bit Fields | Language-level reference |
| hardware addressing | COD: MIPS Addressing for 32-Bit Immediates and Addresses | Gives the underlying reason for endianness and alignment |
External Resources (Validated)
These are read-only, freely available, and stable. Use when the local chunks do not suffice.
- cppreference: C language reference - the single best language reference; pointers, types, and operators pages are all relevant.
- What Every Programmer Should Know About Memory (Drepper) - long paper on memory hierarchy; read selectively, not front-to-back.
- What Every Computer Scientist Should Know About Floating-Point Arithmetic (Goldberg) - definitive floating-point paper.
- Beej's Guide to C Programming - accessible alternate explanation of pointers, arrays, and memory.
- The Lost Art of Structure Packing (Raymond) - short, readable guide to padding and reordering.
- Bit Twiddling Hacks (Anderson) - the single best collection of bit-manipulation idioms.
- GNU C Library: Memory Allocation - reference semantics for
malloc/free/realloc. - Linux man-pages: proc(5), htonl(3), mmap(2), malloc(3) - authoritative man pages for the Linux tools referenced in practice.
Exercise Support Chunks
Use these when the concept pages are understood but fluency is weak:
- K&R: Pointers and Arrays (revisited)
- K&R: Command-Line Arguments
- K&R: Complicated Declarations
- K&R: Pointers to Structures
- K&R: Unions
- COD: Floating Point (Parts 2-4)
- CODE: But What About Subtraction (Part 2-3)
Use Rules
- If you are stuck on syntax or a pointer idiom, go to K&R first.
- If you are stuck on a representation question, go to COD or CODE first.
- For tool questions (ASan, Valgrind, clang --analyze), go straight to the official documentation.
- Open one chunk for one concept gap; do not wander through a whole chapter sequence by default.
- If rereading is not fixing the problem, stop and draw the memory diagram in your own hand before reading more.