Presentation: Internal Structure of Minix

Overview

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

Background Information

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.

Minix Layered 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
  • Scheduling 
  • 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.

Conclusion

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.

References

Advertisements
  1. #1 by niks on February 20, 2008 - 3:22 pm

    yaah. its excellent stuff!!

  2. #2 by Tanesh Kumar on December 29, 2010 - 9:16 pm

    Really very helpful and excellent information given.

  3. #3 by nizar dwi on April 25, 2017 - 1:23 pm

    thank you, it was really helpful

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: