Table of Contents
Praktikum „Kernel Programming“
Since the early age of computers operating systems (OS) have been playing a vital role in the software stack. The operating system is a software layer at the bottom of the software stack that extracts a high level abstraction of the underlying hardware, implements resource management and offers a variety of services into the layers that sit on top of it. Although programs can run directly on top of the hardware this is a rare case that usually can been seen only in embedded systems. Programming exactly above the “bare metal” machine adds more complexity to the programmers and requires a better understanding of the hardware.
The modern operating systems consist of a program so called kernel. The main functionality of the kernel is to handle the Central Processing Unit (CPU), the memory accesses and the input/output (I/O) requests. The software that is implemented as part of the kernel run in the context so called kernel space whereas the software on top of it in the so called user space. This comes from the memory abstraction that the kernel provides to applications (in this context applications can be considered the software implemented on top of the kernel). Running in the kernel space gives programmers privileged access to the hardware that in many cases is restricted from the user space, thus several functionalities can be implemented only inside the kernel space. Moreover, since the kernel is at the bottom of the software stack, it can dramatically affect the performance of the applications in many cases.
Currently, one of the most widely used operating systems (especially in the server environments) is the Linux OS, that consist of the Linux kernel. The Linux kernel, initially written from Linus Torvalds, follows the principles found in the Unix-kernel and it is published under the GNU General Public License version 2 (GPLv2). In this software lab you will learn the basics for Linux kernel development. At the end of this course you should be able to write your own kernel module.
This software lab will be given in English.
This software lab is suitable for advance undergraduate and graduate students of the Computer Science department. It requires advanced knowledge C programming language. Moreover, familiarity with basic Linux (Unix) utilities such as ls, rm, grep, tar. Use of available text editors (e.g, Vim, emacs.). Experience with any major Linux distribution. Students of other departments are also welcome.
This software lab will be given in English.
Date and Time
In the first weeks of the lectures we will recap all the required knowledge for this software lab. Then we will introduce the basic concepts and principles of Linux Kernel programming. Later, the participants will have to present specific aspects of Linux Kernel programming. Short assignments will be given to students during the semester. At the end of the semester the students will also have to work on a short project.
- 14.10.15 – General information of the course.
- 21.10.15 – Introduction to C (pointers, structures, unions, memory allocation, function pointers, inline assembly) slides.pdf.
- 28.10.15 – Operating Systems Concepts (definition, history, types, process management, memory management, storage management) slides.pdf.
- 04.11.15 – Introduction to the Linux Kernel (role, parts, modules, system calls) slides.pdf.
- 11.11.15 – Building, running and monitoring the Linux kernel (source tree, configure, install, boot/init process, monitor tools) slides.pdf.
- 18.11.15 – Writing your first linux kernel module (build, load, unload, parameters, user VS. Kernel space programming) slides.pdf.
- 25.11.15 – Kernel Module Demo, Assignment 0 examination.
– Above presentations are licensed under the Creative Commons Attribution 4.0 International License.
– Students Presentations:
- 16.12.15 – Kernel Synchronization (Race conditions, Threads, Semaphores, Mutexes, Spinlocks, Atomic calls, Alternatives) Interupt handling (installing, Implementing, Top and Bottomn Halves) - Reentrant modules. - Struhs, Yiannopoulos 4)
- 06.01.16 – No lecture.
- 13.01.16 – No lecture.
- 27.01.16 – No lecture.
- 18.03.16 – Project Presentations.
- Linux Kernel Library (http://lkml.iu.edu/hypermail/linux/kernel/1511.0/01898.html)
- Students can work in teams of two maximum two persons. The team members should be announced in advance.
- For each presentation you have to deliver the slides along with the source code examples. Slides and source code will be published here.
- Each team should provide its own unique solution.
- Do not copy other teams solutions.
- You can submit your assignment after the deadline. However, you will have to pay a penalty of 10% assigments mark per day of delay.
- You can ask questions in the mailing list of the course or to the lecturers directly.
Programming in General
- C-Workshop / Tutorial: http://wr.informatik.uni-hamburg.de/_media/teaching/wintersemester_2011_2012/c-workshop.zip
- Git-Cheat-Sheet: https://training.github.com/kit/downloads/github-git-cheat-sheet.pdf
- Shell-Programming Bash-Intorduction: https://help.ubuntu.com/community/Beginners/BashScripting http://wiki.ubuntuusers.de/Shell/Bash-Skripting-Guide_f%C3%BCr_Anf%C3%A4nger
- Makefile tutorial: http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/
- GNU Make Manual: http://www.gnu.org/software/make/manual/make.html
- Linux Device Drivers, 3d edition, Sprache: Englisch, ISBN-10: 0596005903, ISBN-13: 978-0596005900, price: EUR 29,00
- Linux Kernel Development (3rd Edition), Sprache: Englisch, ASIN: B003V4ATI0, price: EUR 30,95
- Advanced Programming in the UNIX Environment, Second Edition, Sprache: Englisch, ISBN-10: 0321637739, ISBN-13: 978-0321637734, price: EUR 44,95
- Understanding the Linux Kernel, 3rd edition, Sprache: Englisch, ASIN: B00E28C248, price: EUR 73,00
- Essential Linux Device Drivers (Prentice Hall Open Source Software Development), Sprache: Englisch, ISBN-10: 132396556, ISBN-13: 978-0132396554, price: 36,95
- Modern Operating Systems (3rd Edition), Publisher: Prentice Hall; 3 edition (December 21, 2007), Language: English, ISBN-10: 0136006639, ISBN-13: 978-0136006633
- Linux Performance and Tuning Guidelines, An IBM Redpaper publication http://www.redbooks.ibm.com/abstracts/redp4285.html
- The C Programming Language, 2nd Edition, Publisher: Prentice Hall; 2 edition (April 1, 1988), Language: English, ISBN-10: 0131103628, ISBN-13: 978-0131103627
- Modern Operating Systems, 3rd Edition, Author: Andrew S. Tanenbaum, Sprache: Englisch, ISBN-10: 1292025778, ISBN-13: 978-1292025773
- Just for Fun: The Story of an Accidental Revolutionary, Publisher: HarperBusiness; Reprint edition (June 4, 2002), Language: English, ISBN-10: 0066620732, ISBN-13: 978-0066620732