June 18, 2006
June 18, 2006
June 21, 2006
Computers in Education
11.1394.1 - 11.1394.10
Using Linux Kernel Modules for Operating Systems Class Projects
Instructors of operating systems classes have long desired to incorporate programming projects into the class that will give the students an appreciation for the source code of the kernel of a real operating system. Unfortunately, this lofty goal becomes difficult to effectively implement in practice. This paper reviews several approaches and environments for operating systems programming projects. A new approach involving Linux kernel modules and source code reading is described as a means to supplement other programming projects.
In an operating systems class, we want students to gain an understanding of the internal data structures and algorithms used in real operating systems. As such, operating systems classes always include a heavy lecture component to expound on such topics as common operating systems architectures, device and I/O management, process management, memory management, synchronization, and file system management. However, lectures alone are not able to illustrate these principles in action. Students need some form of personal exploration to investigate how the concepts and algorithms are implemented. The logical solution is that students should study the source code of real operating systems and modify or instrument the source code to allow for closer understanding.
Unfortunately, operating systems class projects which use real operating system kernel code present many challenges. First of all, not all operating systems have source code available. Only open source operating systems such as Linux, MINIX and the BSD variants have source code available. Secondly, the source code for a real operating system is huge and formidable. It is challenging for even experienced programmers to wade through the volume of code to find the code related to the implementation of some algorithm, modify the algorithm such that the operating system still works and provides interesting insights about the operating system design and implementation. For a beginning programmer, it would be more frustrating than instructive. Thirdly, it can be administratively difficult to allow students to modify the kernel of an operating system. The process of compiling and installing a new kernel to support the wide variety of hardware and options that modern operating systems support is difficult and time consuming. It requires root level privileges; and worst of all, it risks damaging the installed system.
Modern Linux systems support a mechanism called loadable kernel modules that offer an interesting alternative. Kernel modules effectively allow for an addition to a running kernel in real time. The code for the kernel module must include a few basic components to facilitate the loading and removing of the module, but can be a fairly small and simple program. An obvious advantage is that students only need to work on and modify a small amount of code, which is isolated from the kernel’s source code. When the module is loaded, it is linked to the executing kernel image, as if it were part of it from when the computer was first booted. Kernel modules cannot modify or replace existing functions in the kernel, but can add new functionality and can read and modify, if needed, any exported global variables and data structures. The ability to read the kernel’s global data makes them ideal for student projects that examine global data
Bower, T. (2006, June), Using Linux Kernel Modules For Operating Systems Class Projects Paper presented at 2006 Annual Conference & Exposition, Chicago, Illinois. 10.18260/1-2--508
ASEE holds the copyright on this document. It may be read by the public free of charge. Authors may archive their work on personal websites or in institutional repositories with the following citation: © 2006 American Society for Engineering Education. Other scholars may excerpt or quote from these materials with the same citation. When excerpting or quoting from Conference Proceedings, authors should, in addition to noting the ASEE copyright, list all the original authors and their institutions and name the host city of the conference. - Last updated April 1, 2015