Skip to content
academia.sh

Course Advanced

Systems Programming with C

Published Updated

By the end of this course

Start course

01

System Interfaces

File descriptors and the shared file offset, creating and waiting for processes, signal handling, inter-process communication through pipes, shared memory and sockets, and sharing under a lock in POSIX threads — each paired with the question of who sees a change.

  1. 01 File Descriptors Whether a pointer refers to the same memory location is measured by equality; whether a file descriptor shares the same open file description is measured by offset behavior instead — the descriptor itself is an integer and says nothing on its own.
  2. 02 Process Management fork splits a process in two and hands the child a copy of the memory at that moment; once the copy is made, the two sides are independent of each other — no change reaches the other side in either direction.
  3. 03 Signals A signal handler runs outside the main flow, at an unexpected point; the only safe form of sharing is a volatile sig_atomic_t flag, and if a signal arrives again while blocked it is delivered only once when it is unblocked.
  4. 04 Inter-Process Communication A pipe carries bytes once, and every byte read drops out of the stream; a mapping set up with mmap and MAP_SHARED shows the same page to two processes at once, and these two fall into two different classes within the same lesson.
  5. 05 POSIX Threads Two threads in the same process changing the same memory under a lock is not a handoff, consumed once like the bytes a pipe carries, but a continuously shared exchange.

02

Data Structures and Idioms

Linked structures and aliasing, ring buffers and queues, hash tables, object-like design with function tables, and idioms for cleaning up operating system resources from a single exit point.

  1. 01 Linked Structures A C implementation of a linked list and a binary search tree; measuring how changing a node through an alias and a shallow copy produce shared visibility, while a deep copy cuts it.
  2. 02 Ring Buffers and Queues A fixed-capacity ring buffer and a linked queue in which a value passes exactly once between a producer and a consumer; measuring, through equality, that a read value no longer stays in the buffer.
  3. 03 Hash Tables Measuring that reading a record from a hash table with separate chaining produces its own copy, without changing the record in the table; and how colliding keys chain in the same bucket.
  4. 04 Object-Like Design In object-like interfaces built with an opaque struct and function pointers embedded in the struct, measuring that two handles share the same object and that a method call does not change that sharing.
  5. 05 Resource Cleanup Idioms Measuring a resource that closes without ever reaching a reader, on the failure path of a function that opens several resources in sequence.

03

Project Infrastructure

Build systems with a dependency graph, producing static and dynamic libraries, isolated unit tests and mocking, debugging with breakpoints and watchpoints, and how optimization levels preserve observable behavior.

  1. 01 Build Systems Measures, by building the timestamp comparison in C itself, why a target whose dependency was never written still stays out of date under a rule-based build model.
  2. 02 Building Libraries Measures how whether a library is bound into the program by embedding or read at load time decides which value the program sees when the library's version changes.
  3. 03 Testing Frameworks Measures why a change made inside a forked child running a test never leaks into the next test, and why that isolation stops short of covering filesystem state.
  4. 04 Using a Debugger Measures, by modeling breakpoints and watchpoints in C, why a breakpoint never sees an intermediate value between steps, and why a watchpoint sees that same value.
  5. 05 Optimization Levels Uses the model of an optimizer deleting an unread write to cover the as-if rule, the guarantee volatile provides, and a closing tally of the course's fifteen lessons.

Final exam

Systems Programming with C — Final Exam

In preparation

This course's question bank is not complete yet. The exam opens here automatically once enough questions are added.

Start typing to search.

↑↓ ↵ Esc navigate · open · close