Systems Programming - Fall 2024
Instructor:
Antonio Carzaniga
Assistants:
Fabio Di Lauro,
Pasquale Polverino, Christian Lämmle, Ilia Zeller.
Lectures: Monday 11:00–12:30, Wednesday 11:00–12:30.
Exercise sessions: Wednesday 15:30–17:00.
See the
course weekly schedule or
the
third-semester Bachelor schedule for details and updates
Instructors' Office Hours: by appointment
Assistants' Office Hours: by appointment
Objectives
What is systems programming? In a way it is just
programming. But it is also more specific: it means developing
programs that interact with other programs or “systems,”
as opposed to human users. Systems require specific interactions,
usually with rigid formats. Systems also have non-trivial structures
and architectures, with specific performance characteristics that
might be crucially important for the programmer. Some systems might
also have non-traditional execution models that, effectively, change
the way we program. Examples of such systems are database systems,
networked systems, operating systems, specialized devices, special
purpose processors, or even general purpose architectures with non
trivial architectures (e.g., any non-trivial memory structure).
The primary language of systems programming is the C programming
language. C and C++ are also very important application
languages. This course is a practice-oriented introduction to
programming in C and, to a limited extent, C++. The goal is not only
to learn how to write good C programs, but also to understand their
execution model in depth. This course does not require any previous
knowledge of C, although it requires some elementary notions of
computer programming.
Contents
The course will cover:
- Basic features of the C language, including basic types, literals,
control structures, basic notion of expression operators and their
precedence, structures, functions, parameter semantics, arrays.
- Advanced language features, including a deeper understanding of
the memory model, structures and unions, pointers, memory
management, execution model.
- Elements of the C standard library, including file I/O, formatted
I/O, and memory allocation and deallocation.
- A brief introduction to C++.
- Multi-file projects as well the necessary notions related to the
language and to the build process, including symbols, extern
declarations, and their relations to compilation units and the
linker.
- Using make to manage the build process and other
non-trivial processes.
- A minimal practical introduction to symbolic debugging.
- System interfaces: network primitives, asynchronous I/O, signals.
Policies
See
this page for evaluation criteria and
general policies.
Useful Links
Additional information is available through the following links and
pages.
Lectures and Material
- Introduction to the Course: syllabus; what
is systems programming; why it is useful to know the C
programming language; getting started: a very first example; using
the compiler.
- Basics of C: Basic types, literals, minimal I/O,
basic expressions, control structures.
- Memory model: pointers, arrays, and strings,
basic use of pointers (e.g., in string processing); more I/O.
- Data Structures: Aggregate types; structures and
unions; enumerations; type definitions; initializers for structures
and arrays; nested structures, multidimensional arrays, and other
non-trivial types. Dynamic memory allocation.
- Basics of testing and debugging: debugging C
programs with a symbolic debugger. Using valgrind to detect
memory leaks and undefined behavior.
- Structure of a program: the main
function; defining functions; static variables; global variables;
scope rules.
- More details on the build process;
the pre-processor; multi-file projects; compilation units; symbols;
shared declarations; the pre-processor; the linkers; modularization
and information hiding in C.
- Short digression on make: basic usage; a
simple build activity; dependency graphs; complex build; other uses
and advanced features.
- More on using pointers; other
dynamic data structures; pointer arithmetic. Pointers and structures,
pointers and arrays. Pointers to functions.
- An in-depth look at expressions and
the execution model: operator precedence; type conversions; the
assignment statement; the execution model: evaluation order;
sequence points.
- Defining classes and objects in C.
Using pointers to functions: generic objects and virtual methods.
- Introduction to C++: classes, exceptions,
namespaces. standard library: strings, containers, basic algorithms.
Classes: definitions, methods, constructors, destructors, virtual
methods.