Chapter 2. MINIX kernel hacking: analysing microkernel's IPC

Table of Contents

Introduction: the MINIX which acted as the detonator of open source
The MINIX microkernel and the MINIX IPC
The installation of MINIX3 system
Installation in VirtualBox
The first MINIX kernel hacking
Analysis of MINIX3 IPC
A solution with modifying the PCB
Another solution by introducing a new system call

Abstract

In this chapter we have made a lifelong friend with a beautifully simple microkernel called MINIX. We solve an exercise of Tanenbaum and Woodhull's operating systems book,

  • first with the modification of a part of PCB (Process Control Block) defined in proc.h,

  • then with the creation of a new system call.

First of all we setup a MINIX system and we show how to compile the MINIX kernel.

„Re 2: your job is being a professor and researcher: That's one hell of a good excuse for some of the brain-damages of minix.”

—Linus Benedict Torvalds Linus-Tanenbaum vita

Introduction: the MINIX which acted as the detonator of open source

Eric Steven Raymond (esr) changed the term free software to open source in The Cathedral and the Bazaar in 1998. More than ten years back, the MINIX had been released in 1987, so obviously it was not open source.

GNU GPL

It may be noted that the first version of GNU GPL was released in 1989 and the first Linux had already been licensed under GNU GPL version 2, released in 1991.

At the beginning of the informatics profession, the C source codes of UNIX systems could have been used in university courses, but it lasted only a short period of time due to UNIXs had become a very valuable product quickly and then it was no longer possible to teach the operating systems in its C source form. The MINIX was born in this environment. The purpose of it was specifically to allow the usage of the source code of a UNIX-like operating system in education again.

From this aspect, the MINIX can be regarded as a pioneer of open source operating systems and, ultimately, we can say that the open source was brought into existence by the closing of the source code [OS3].

The MINIX microkernel and the MINIX IPC

The IPC (Inter-Process Communication) determines a communication method in which programs can exchange data with each other. There are several IPC mechanisms, from pipes through anonymous, local and network sockets to using shared memory (from these methods semaphore arrays and the shared memory will be used in the third case studies). The MINIX IPC is based on the message passing. The massage passing takes place between two appropriately synchronised (by the rendezvous principle) processes, so we would not buffer the messages [OS], [OS3], as shown in the following figures.

Figure 2.1. SEND and RECEIVE message passing primitives.

SEND and RECEIVE message passing primitives.

Figure 2.2. The sender is blocked while the receiver is not ready to receive.

The sender is blocked while the receiver is not ready to receive.

Figure 2.3. The receiver is blocked while the message is not being received.

The receiver is blocked while the message is not being received.