Advent(2) -- The System-Call Advent Calendar

Welcome to the Advent(2), the Advent calendar of the Operating System Group at the Hamburg University of Technology. On every day of December, we will open a door and find a system-call, a concept or an interface of Linux. Behind the door, there is a short article and a small exercise, for which the solution is provided the following day.


System calls are commands that our programs send to the operating-system kernel to get things done. And there are a lot of system calls that we can choose from. In our programs, system calls look like normal function calls as the C library provides thin wrapper functions that pack the arguments, invoke the OS, and post-process the return code (errno(3)).

From your experience, it might be quite muddy to know whether a C-library functionis is a thin wrapper around a bare system call (like open(2)), a thick wrapper that provides additional user-space functionality (like fopen(3)), or a function that that does not involve the kernel (like atoi(3)). And most of the time, this distinction does not matter at all. However, in this Advent(2), we want to focus on the bare and naked OS interface and show you abstractions, interfaces, and concepts that are interesting, not-well know, or just plain useful. At the beginning, we will have a slow start, we will see things that you might alredy know, or at least believe to know.

For this project, we will often link man-pages(7) that contain the detailed description of the involved system calls. Read them! At least the DESCRIPTION section, as with more and more of those, you will get a deeper understanding of basic UNIX concepts. These manpages are organized in so-called "sections", where section 1 refers to command-line tools (e.g., cat(1)), section 2 to system-call wrappers (e.g., open(2)), and section 3 to C-library function (e.g., fopen(3), atoi(3)). While you can read those manual pages in your browser, the man(1) command-line tool is even more useful, as it is always at your fingertips when you work on the shell. Try it ($ in monotype indicates a shell prompt):

$ man 1 man
$ man 2 open
$ man 3 fopen

About the Advent

We will describe a system-call, a concept or an interface each day. Thereby, we will not stick to the POSIX standards, but we will enjoy the full depth of Linux specific interfaces! You can either just read and enjoy the articles (and the solution code) or you can work out the tasks by yourself. The most important part of this calendar is that we have some fun toghether and learn something about Linux.

What you need is a Linux shell (as we focus on Linux) with the gcc C compiler installed (apt-get install build-essential). The easiest way to get such an environment is to use SSH to log into you local university's computer pool. But also an Ubuntu installation in a virtual machine or the Windows Subsystem for Linux (WSL) are viable options. For some exercises, you will need a relatively recent Linux kernel (> 5.10) as we will explore some shiny new features.


On December 1st, we articles will appear on this site. To stay informed, subscribe to the mailinglist (link in the menu)!