School of Electrical Engineering & Computer Science

Unique Features of Design and Implementation of the MTX Operating System

1. This book is self-contained. It includes all the foundation and background information for studying operating systems. These include CPU and I/O operations, virtual and physical addresses, program development, linking C programs with assembly code, execution image, function call conventions and run-time stack usage. When discussing device drivers it explains the principle of operations of each device before showing the actual driver design and implementation. When discussing file systems it explains the various levels of file operations before showing the implementation of a complete file system. When working with PCs in 32-bit protected mode it also explains the protected mode operations in detail.

2. Chapter 3 provides a complete coverage on operating systems booting, which is lacking in other books. In addition to the booting principle, it shows how to write booter programs to boot up real operating systems, such as Linux, from a variety of bootable devices. All the booters used in this book are developed in this chapter. They are comparable to GRUB and isolinux of Linux distributions in performance.

3. This book shows the design and implementation of a complete operating system in incremental steps. First, it develops a simple kernel for process management. Next, it extends the simple kernel to support user mode processes and implement system calls. Then it adds memory management, process scheduling, device drivers, file system and user interface to the system, making it a complete operating system. The book’s evolutional style helps the reader better understand the material.

4. The book begins to develop MTX in the simple environment of 16-bit real mode. It uses a process life-cycle model to illustrate the principle of process execution and context switching. The same principle is used throughout the book to create process execution images, independent of the memory management hardware of the system. The design and implementation of MTX cover the entire spectrum of the Intel x86 based PC architectures, from 16-bit real mode to 32-bit protected mode and eventually to SMP. Despite the architectural differences, it demonstrates that the same design principle and implementation technique can be applied to all cases.

5. Rather than discussing only the concepts of threads, this book extends the process model to implement threads support in the MTX kernel. Moreover, it demonstrates threads applications by concurrent programs and shows how to synchronize threads executions to prevent race conditions.

6. Chapter 6 covers process synchronization in the general model of concurrent processes. It shows how to implement process synchronizing tools and use them in both OS kernel design and concurrent programming. MTX uses a mixture of process synchronizing tools, which are chosen to best suit the needs. In uniprocessor (UP) mode, it uses sleep/wakeup for process management, but it uses semaphores in device drivers and file system for better efficiency, which also allows for a smooth transition from UP to SMP. In addition, it applies some of the classical process synchronization problems to OS design. As a case in point, it uses the producer-consumer problem as a model for pipes and it applies the reader-writer problem to I/O buffer management in SMP to improve concurrency.

7. Chapter 8 covers interrupt processing and process scheduling. It presents a general framework for interrupt-driven device drivers design. It explains why interrupt handlers should not sleep or become blocked. It discusses the goals, polices and algorithms of process scheduling in detail, and it demonstrates the effects of different scheduling algorithms by sample systems.

8. Chapter 9 presents a unified treatment of interrupts and signal processing, which helps clarify the intended roles and proper usage of signals. It implements signal handling in the MTX kernel and demonstrates the principle and applications of signal catchers.

9. It explains the hierarchical relations of file operations in an OS, from user space to kernel space down to the device driver level. Then it shows the implementation of a Linux compatible EXT2 file system in detail.

10. Chapter 12 covers I/O buffer management. It discusses the I/O buffer management algorithm of Unix and points out its shortcomings. Then it shows how to design new algorithms to improve the buffer cache performance. Most materials presented in this chapter are new and original.

11. It shows how to develop user interface for an operating system. This includes an init program for system startup, a login program for users to login and a simple sh for command execution. It also shows how to use system calls to develop other user mode programs.

12. Chapter 14 extends the real mode MTX to 32-bit protected mode. First, it explains protected mode operations in detail. These include segmentation, paging and exception processing. Then it shows how to extend MTX to protected mode systematically. In line with the book’s evolutional style and also to illustrate the capabilities of the memory management hardware, it presents three different versions of MTX in protected mode: MTX32.1 uses segmentation, MTX32.2 uses static paging and PMTX uses dynamic paging.

13. Chapter 15 on SMP is most unique. It shows how to configure SMP-compliant systems for SMP operations. It extends the conventional process synchronizing mechanisms, such as sleep/ wakeup and semaphores, to suit the SMP environment. It presents a general methodology for SMP kernel design and shows how to apply the principle to adapt the UP PMTX kernel for SMP. Then it focuses on the design of parallel algorithms for SMP to improve both concurrency and efficiency. The SMP_MTX kernel uses parallel algorithms in process management, resource management, pipes and I/O buffer management. This novel approach to SMP is new and original. Moreover, it also shows a SMP MTX in 16-bit real mode, which is probably the only real mode SMP system in existence.

14. It compares monolithic kernel and microkernel based OS design and demonstrates a hybrid system, which incorporates the strength of both approaches.

15. Throughout the book, it uses complete working sample systems to demonstrate the design principles and implementation techniques.