systems-programminglisted
Install: claude install-skill Tibsfox/gsd-skill-creator
# Systems Programming
Systems programming is programming where the machine's physical constraints -- memory, concurrency, I/O bandwidth, latency -- are not abstractions but design parameters. A web application can ignore cache lines; an operating system kernel cannot. This skill catalogs the concepts that distinguish systems programming from application programming, with emphasis on the mental models needed to reason about programs that interact directly with hardware and operating system primitives.
**Agent affinity:** hopper (compilers, language implementation, systems), turing (computability, machine models)
**Concept IDs:** code-abstraction, code-code-organization, code-debugging-strategies
## Part 1 -- Memory Management
### Stack vs Heap
**Stack.** LIFO allocation. Each function call pushes a frame; return pops it. Allocation and deallocation are free (pointer arithmetic). Size is bounded (typically 1-8 MB per thread). Perfect for local variables with known lifetimes.
**Heap.** Dynamic allocation. Memory is requested explicitly (malloc/new/Box::new) and freed explicitly or by a garbage collector. Slower than stack (allocator must find free space, manage fragmentation). Necessary for data whose size or lifetime is not known at compile time.
**The fundamental tradeoff.** Stack allocation is fast but inflexible (fixed size, LIFO lifetime). Heap allocation is flexible but slow (allocation overhead, fragmentation, potential leaks).
### Manual Memory Management (C)
*