ECE 252: Systems Programming and Concurrency

Wojciech Golab

Estimated study time: 4 minutes

Table of contents

Sources and References

Equivalent UW courses — CS 350 (Operating Systems), CS 343 (Concurrent and Parallel Programming), CS 354 (legacy Operating Systems) Primary textbook — Kerrisk, Michael. The Linux Programming Interface. No Starch Press, 2010. ISBN 978-1-59327-220-3. (Recommended.) Supplementary references — W. Richard Stevens and Stephen A. Rago, Advanced Programming in the UNIX Environment, 3rd ed., Addison-Wesley, 2013; Robert Love, Linux System Programming, 2nd ed., O’Reilly, 2013.

Equivalent UW Courses

ECE 252 is the Computer Engineering department’s second-year crash course in Unix systems programming and concurrency. The system-call, process-and-thread, and IPC material corresponds to the front half of CS 350, although CS 350 then continues into kernel-side topics (scheduling, virtual memory implementation) that ECE 252 defers to ECE 350. The concurrency content — mutexes, semaphores, monitors, condition variables, classical synchronization problems — maps onto CS 343, which is CS’s dedicated concurrency course. CS 354 was the legacy version of CS 350 and covers similar ground. Roughly, ECE 252 is approximately the user-mode half of CS 350 combined with the introductory half of CS 343, viewed from a programmer’s rather than kernel-implementer’s perspective.

What This Course Adds Beyond the Equivalents

ECE 252 is explicitly a hands-on systems-programming course. The labs and assignments have students writing real C programs against the POSIX API — fork, process-image replacement, pipes, sockets, pthreads, semaphores, asynchronous I/O, cURL multi-handle, poll/select, aio, inotify. CS 343 tends to be more language-theoretic (monitors as a language construct, actor models, uC++, Go channels), and CS 350 students spend more time in the OS/161 kernel than on userland programming. The Linux-specific flavor — Kerrisk as the textbook — gives students deeper fluency with the actual Linux man-page interface than either CS course.

What ECE 252 omits compared with CS 350/343: no kernel implementation work, no page-replacement or file-system internals, no formal verification or model checking of concurrent code, and no coverage of distributed-memory parallelism (MPI, GPU) which CS 343 may touch on.

Topic Summary

C and the System-Call Interface

Brief refresher on C (pointers, memory layout, the stack/heap split) and the distinction between library calls and system calls. Error handling with errno, return-code conventions, and the strace mental model for “what actually hits the kernel.”

File I/O and File Systems

Open, read, write, lseek, close. File descriptors as per-process handles into a system-wide open-file table. Blocking vs. non-blocking modes, buffering, and a brief look at file-system organization so students understand what a path lookup costs.

Processes

Process creation via fork, program replacement, and parent waits. Process lifecycle, zombies, orphans, and signal delivery. Environment variables, file-descriptor inheritance, and copy-on-write semantics.

Inter-Process Communication

Pipes (named and unnamed), message queues, shared memory, and sockets (TCP and UDP) at the Berkeley-API level. Students build networked clients and servers as an assignment.

Threads and Mutual Exclusion

POSIX threads: pthread create, join, detach, and thread-local storage. Mutexes, race conditions, and the classic pattern

\[ \texttt{lock}; \quad x \mathrel{+{=}} 1; \quad \texttt{unlock} \]

for a thread-safe counter. Atomics and memory ordering at an introductory level.

Synchronization Primitives

Semaphores (counting and binary), condition variables, barriers, and reader–writer locks. Classical problems: producer–consumer with bounded buffer, dining philosophers, sleeping barber, readers–writers. Safety vs. liveness vocabulary.

Deadlock

The four Coffman conditions, resource-allocation graphs, and prevention/avoidance/detection trade-offs. Discussion of why real systems usually choose prevention through lock ordering.

Alternative I/O Models

Non-blocking I/O, poll and select multiplexing, the cURL multi-handle for concurrent HTTP, Linux aio for asynchronous file I/O, and inotify for file-system event notification. Ties the course back to event-driven architectures and motivates later async frameworks.

Back to top