This is a presentation of the Internal Structure of Minix and it is not intended to go into details of how the structure is implemented, the various techniques employed etc. So basically, the presentation should make sense to any lay person who wants to have an appreciation of the structure of Minix without concern for the nity gritty of computer science theories and practices. I think that is a fair amount of assurance that there will be no code or anything apparently geeky in this presentation. My apologies to those looking for geeky materials. 🙂
Objectives of this Presentation
- Discuss architectural Design: Micro-Kernel design of Minix and Its implications
- Show Internal Structure of Minix: show the various layers and their general function
Minix is an open source Unix like operating system that has been designed and implemented with the aim of being an education tool. It was designed by Andrew S. Tanenbaum and in order to achieve its objective of being an education tool, Minix is modular and the available source code is well commented. The Minix kernel has about 4000 lines of code.
Minix has a had a great history in the academic community and it holds the honor of being the inspiration behind the Linux kernel, the poster child of open source. When Linus Torvalds started working on the Linux kernel he used a Minix system hence Linux and Minix share a lot in design as well as drivers in those early days. However there is a significant difference in design between Linux and Minix: the former is implemented using the monolithic structure while Minix uses a micro-kernel architecture.
Design & Architecture
The Minix operating system implements a layered, micro-kernel architecture as showed in the diagram above. The Unit’s main text talks about five different structures of operating systems: monolithic, layered, virtual machine, exokernels and client/server. Minix combines two of these structures: the layered structure and client/server structure.
The layered system structure breaks the system into a number of layers which implement specific functions. In such a setup, typically the higher level layers relay on the services provided by the lower level layers. Minix has four layers, each with a specific and well defined function.
In a micro-kernel architecture most of the key functions of the operating system are implemented as servers that run separately from the core kernel. This design makes the operating system module and extensible since additional services can be developed and improved without much changes to the kernel. Key services provided by a Micro-Kernel: address space management, thread management, inter-process communication and timer management.
Structure of Minix
Disclaimer: this part of the presentation is not exhaustive
Minix 3 is structured into four layers as follows:
Layer 1: Kernel
This layer provides the lowest level services that are needed to run the system. These include management of interrupts, traps, scheduling and communication. The lowest part of this layer that details with interrupts is written in assembly language while the rest of it is written in C.
This layer does the following:
- Manage interrupts and Traps
- Saving and restoring registers
- Providing Services to the next layer
- Messaging and communication services
Layer 2: Device Drivers
Input/Output devices that are found in this layer are such peripherals like disks, keyboards, printers, CD drivers etc.
Layer 3: Server Processes
This layer provides services that are used by all programs that are running in layer 4. Processes in this layer can access the services of the device driver layer but programs in Layer 4 cannot have direct access to Layer 2 processes.
Example of some of these services include: File system, reincarnation server, network server, information server, memory manager, process manager etc. In a typically layered approached, the servers provide services to processes/programs that run in layer 4 while consuming services from the lower layers.
Layer 4: User Processes
This forms the userland section of the Minix operating system in which user programs are executed. These programs relay on the services that are provided by the lower level services. Programs that are typically found in this layer include daemons of various types, shells, commands and any other program that the user may want to run.
The layer 4 processes have the least privileges to access resources and typically gets to privileged resources through the lower level processes. For example, a user can execute the ping command which requires the use of the networking server process. The ping command, does not call the networking server process directly. Instead it goes through the file system server process.
Merits of the Architecture
- Modularity: the system is well structured and the relationship between the various components is equally well defined.
- Security: the combination of the layered system structure and micro-kernel design makes for a architecture that allows for better incorporation of security. Layers 2 – Layer 3 run in User mode while only layer 1, runs in Kernel mode which has all the privileges needed to access any part of the system.
- Extensibility: in order to have a functional system, one needs the kernel setup as well as the key services that are needed to start off. All the other functions can be added as and when needed. This makes it simpler to extend and/or specialize the function of the system.
- Performance & Stability: most problems that cause instability on a computer system are a result of poor designed and/or poorly compiled drivers and user programs. The micro kernel architecture allows these programs to be executed and implemented independent of the core components of the operating system, which means that a failure in any of those programs is not catastrophic to the system. The system is able to maintain uptime, despite errors.
Demerits of the Architecture
- Complexity: the architecture is complex and hence makes it harder to design in the first place and to evolve as time moves on. The computer industry is probably amongst the fastest moving industry of the global economy and as such there is a real need to adjust to new developments in hardware as well as innovations in software.
- Communications and Messaging: the architecture needs fast and efficient communications architecture so as to ensure faster communication between the various processes that are running in their individual address spaces as well as with varied security levels. A poor communications implement would negatively impact on the performance of the system.
The design and architecture is good for its intended purpose of being an education tool. It allows students to appreciate the design and implementation of an operating system. However, this goal may not be a true reflect of a what a real world, enterprise grade operating system looks like and how it is implemented. The sheer number of processes that are started when a general purpose operating system boots indicates that while the principles largely remain the same as those demonstrated by Minix, there is a much more complex implementation and design effort going into producing operating systems like Linux, Windows, Solaris and other variants of Unix.
The debate about monolithic vs micro-kernel OS design has been going on for sometime but this debate is also becoming more important in this day and age where virtualization and multi-core processors are increasingly main stream. Questions like how a monolithic design can efficiently take advantage of multi-core processors will become important. But it is also necessary to address the tools that used to produce these programs: at the moment, there is poor support for parallel programming.
- Minx 3 Home Page
- http://en.wikipedia.org/wiki/Minix (check out the external links here)
- GNU Hurd Micro Kernel
- Operating System Design and Implementation, Third Edition – Andrew S. Tanenbaum