Systems Programming - Fall 2022
Instructor:
Antonio Carzaniga
Assistants:
Mangipudi Shamiek, Arnaud Fauconnet,
Claudio Milanesi
Lecture schedule: Monday 10:30–12:30, Wednesday
10:30–12:30. 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 very
specific and sometimes 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. So, the first objective of this course is to learn C,
meaning programming as well as reading and understanding relatively
large C programs. Rather than studying the design of the language
per-se or its linguistic features, this course is intended to provide
a practice-oriented introduction to programming in C. This course
does not require any previous knowledge of C, although it requires
some elementary notions of computer programming.
The second objective of this course is to learn how to write
programs that interact with a non-trivial system. Once again, the
approach is pragmatic, and the learning path will be based on examples
and direct experimentation.
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.
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.