Welcome to the Advent(2), the Advent calendar of the Institute of Operating Systems and Computer Networks at the TU Braunschweig. Every day of December, we will open a door and find a system call, a concept or an interface of Linux. Behind each 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 function 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 does not involve the kernel (like atoi(3)). 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-known, or just plain useful. At the beginning, we will have a slow start, we will see things that you might already know, or at least you believe to know.
For this project, we will often link man-pages(7) that contain the detailed descriptions of the involved system calls. Read them! At least the DESCRIPTION section. With more and more of those, you will get a deeper understanding of the basic UNIX concepts. These man pages 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 functions (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 at work with the shell. Try it ($
in monotype indicates a shell prompt):
$ man 1 man
$ man 2 open
$ man 3 fopen
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 these 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 together 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.
10
ipc 131 lines
[epoll_create(2), epoll_ctl(2), epoll_wait(2), pipe(7), splice(2)]
Last modified: 2023-12-01 15:52:27.445711, Last author: , Permalink: /p/advent
Technische Universität Braunschweig
Universitätsplatz 2
38106 Braunschweig
Postfach: 38092 Braunschweig
Telefon: +49 (0) 531 391-0