Published on

Understanding MIcrokernel

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Open Course by Ferdian Sonatha , Padepokan Kanuragan Blankon Malang http://malang.di.blankon.in/opencourse/ Microkernel In computer science, a microkernel (also known as μ-kernel) is the near-minimum amount of software that can provide the mechanisms needed to implement an operating system (OS). These mechanisms include low-level address space management, thread management, andinter- process communication (IPC). If the hardware provides multiple rings or CPU modes, the microkernel is the only software executing at the most privileged level (generally referred to assupervisor or kernel mode).[citation needed] Traditional operating system functions, such asdevice drivers, protocol stacks and file systems, are removed from the microkernel to run inuser space.[citation needed] In source code size, microkernels tend to be under 10,000 lines of code, as a general rule. MINIX's kernel, for example has fewer than 6,000 lines of code. [1] Microkernels were developed in the 1980s as a response to changes in the computer world, and to several challenges adapting existing "mono-kernels" to these new systems. New device drivers, protocol stacks, file systems and other low-level systems were being developed all the time. This code was normally located in the monolithic kernel, and thus required considerable work and careful code management to work on. Microkernels were developed with the idea that all of these services would be implemented as user-space programs, like any other, allowing them to be worked on monolithically and started and stopped like any other program. This would not only allow these services to be more easily worked on, but also separated the kernel code to allow it to be finely tuned without worrying about unintended side effects. Moreover, it would allow entirely new operating systems to be "built up" on a common core, aiding OS research. Microkernels were a very hot topic in the 1980s when the first usable local area networks were being introduced. [citation needed] The same mechanisms that allowed the kernel to be distributed into user space also allowed the system to be distributed across network links. The first microkernels, notably Mach, proved to have disappointing performance, but the inherent advantages appeared so great that it was a major line of research into the late 1990s.[citation needed] However, during this time the speed of computers grew greatly in relation to networking systems, and the disadvantages in performance came to overwhelm the advantages in development terms. Many attempts were made to adapt the existing systems to have better performance, but the overhead was always considerable and most of these efforts required the user-space programs to be
  2. 2. Open Course by Ferdian Sonatha , Padepokan Kanuragan Blankon Malang http://malang.di.blankon.in/opencourse/ moved back into the kernel. By 2000, most large-scale (Mach-like) efforts had ended, although OpenStep used an adapted Mach kernel called XNU, which is now used in the OS known asDarwin, which is the open source part of Mac OS X. [2] As of 2012, the Mach-based GNU Hurd is also functional and its inclusion in testing versions of Arch Linux and Debian is in progress. Although major work on microkernels had largely ended, experimenters continued development. [citation needed] It has since been shown that many of the performance problems of earlier designs were not a fundamental requirement of the concept, but instead due to the designer's desire to use single-purpose systems to implement as many of these services as possible.[citation needed] Using a more pragmatic approach to the problem, including assembly code and relying on the processor to enforce concepts normally supported in software led to a new series of microkernels with dramatically improved performance. Microkernels are closely related to exokernels. [3] They also have much in common with hypervisors, [4] but the latter make no claim to minimality and are specialized to supporting virtual machines; indeed, the L4 microkernel frequently finds use in a hypervisor capacity. Introduction Early operating system kernels were rather small, partly because computer memory was limited. As the capability of computers grew, the number of devices the kernel had to control also grew. Through the early history of Unix, kernels were generally small, even though those kernels contained device drivers and file system managers. When address spaces increased from 16 to 32 bits, kernel design was no longer cramped by the hardware architecture, and kernels began to grow. The Berkeley Software Distribution (BSD) of Unix began the era of big kernels. In addition to operating a basic system consisting of the CPU, disks and printers, BSD started adding additional file systems, a complete TCP/IP networking system, and a number of "virtual" devices that allowed the existing programs to work invisibly over the network. This growth continued for many years, resulting in kernels with millions of lines of source code. As a result of this growth, kernels were more prone to bugs and became increasingly difficult to maintain. The microkernel was designed to address the increasing growth of kernels and the difficulties that came with them. In theory, the microkernel design allows for easier management of code due to its division into user space services. This also allows for increased security and stability resulting from the reduced amount of code running in kernel mode. For example, if a networking service crashed due to buffer overflow, only the networking service's memory would be corrupted, leaving the rest of the system still functional. Inter-process communication Inter-process communication (IPC) is any mechanism which allows separate processes to communicate with each other, usually by sending messages. Shared memory is strictly speaking also an inter-process communication mechanism, but the abbreviation IPC usually only refers to message passing, and it is the latter that is particularly relevant to microkernels. IPC allows the
  5. 5. Open Course by Ferdian Sonatha , Padepokan Kanuragan Blankon Malang http://malang.di.blankon.in/opencourse/ space. Recently, an increasing number of computers feature IOMMUs, many of which can be used to restrict a device's access to physical memory.[7] (IBM mainframes have had IO MMUs since the IBM System/360 Model 67 andSystem/370.) This also allows user-mode drivers to become untrusted. User-mode drivers actually predate microkernels. The Michigan Terminal System (MTS), in 1967, supported user space drivers (including its file system support), the first operating system to be designed with that capability. [8] Historically, drivers were less of a problem, as the number of devices was small and trusted anyway, so having them in the kernel simplified the design and avoided potential performance problems. This led to the traditional driver-in-the-kernel style of Unix,[9] Linux, and Windows before Windows XP. With the proliferation of various kinds of peripherals, the amount of driver code escalated and in modern operating systems dominates the kernel in code size. Essential components and minimality As a microkernel must allow building arbitrary operating system services on top, it must provide some core functionality. At a minimum, this includes:  some mechanisms for dealing with address spaces – this is required for managing memory protection;  some execution abstraction to manage CPU allocation – typically threads or scheduler activations; and  inter-process communication — required to invoke servers running in their own address spaces. This minimal design was pioneered by Brinch Hansen's Nucleus and the hypervisor of IBM's VM. It has since been formalised in Liedtke's minimality principle: A concept is tolerated inside the microkernel only if moving it outside the kernel, i.e., permitting competing implementations, would prevent the implementation of the system's required functionality. [10] Everything else can be done in a usermode program, although device drivers implemented as user programs may on some processor architectures require special privileges to access I/O hardware. Related to the minimality principle, and equally important for microkernel design, is the separation of mechanism and policy, it is what enables the construction of arbitrary systems on top of a minimal kernel. Any policy built into the kernel cannot be overwritten at user level and therefore limits the generality of the microkernel.[3] Policy implemented in user-level servers can be changed by replacing the servers (or letting the application choose between competing servers offering similar services). For efficiency, most microkernels contain schedulers and manage timers, in violation of the minimality principle and the principle of policy-mechanism separation. Start up (booting) of a microkernel-based system requires device drivers, which are not part of the kernel. Typically this means that they are packaged with the kernel in the boot image, and the
  6. 6. Open Course by Ferdian Sonatha , Padepokan Kanuragan Blankon Malang http://malang.di.blankon.in/opencourse/ kernel supports a bootstrap protocol that defines how the drivers are located and started; this is the traditional bootstrap procedure of L4 microkernels. Some microkernels simplify this by placing some key drivers inside the kernel (in violation of the minimality principle), LynxOS and the original Minix are examples. Some even include a file system in the kernel to simplify booting. A microkernel-based system may boot via multiboot compatible boot loader. Such systems usually load statically-linked servers to make an initial bootstrap or mount an OS image to continue bootstrapping. A key component of a microkernel is a good IPC system and virtual-memory-manager design that allows implementing page-fault handling and swapping in usermode servers in a safe way. Since all services are performed by usermode programs, efficient means of communication between programs are essential, far more so than in monolithic kernels. The design of the IPC system makes or breaks a microkernel. To be effective, the IPC system must not only have low overhead, but also interact well with CPU scheduling. Performance On most mainstream processors, obtaining a service is inherently more expensive in a microkernel-based system than a monolithic system.[3] In the monolithic system, the service is obtained by a single system call, which requires two mode switches (changes of the processor's ring or CPU mode). In the microkernel-based system, the service is obtained by sending an IPC message to a server, and obtaining the result in another IPC message from the server. This requires a context switch if the drivers are implemented as processes, or a function call if they are implemented as procedures. In addition, passing actual data to the server and back may incur extra copying overhead, while in a monolithic system the kernel can directly access the data in the client's buffers. Performance is therefore a potential issue in microkernel systems. Indeed, the experience of first- generation microkernels such as Mach and ChorusOS showed that systems based on them performed very poorly.[11] However, Jochen Liedtke showed that Mach's performance problems were the result of poor design and implementation, and specifically Mach's excessive page cache footprint.[10] Liedtke demonstrated with his own L4 microkernel that through careful design and implementation, and especially by following the minimality principle, IPC costs could be reduced by more than an order of magnitude compared to Mach. L4's IPC performance is still unbeaten across a range of architectures. [12][13][14] While these results demonstrate that the poor performance of systems based on first-generation microkernels is not representative for second-generation kernels such as L4, this constitutes no proof that microkernel-based systems can be built with good performance. It has been shown that a monolithic Linux server ported to L4 exhibits only a few percent overhead over native Linux. [15] However, such a single-server system exhibits few, if any, of the advantages microkernels are supposed to provide by structuring operating system functionality into separate servers. A number of commercial multi-server systems exist, in particular the real-time systems QNX and Integrity. No comprehensive comparison of performance relative to monolithic systems has been published for those multiserver systems. Furthermore, performance does not seem to be the overriding concern for those commercial systems, which instead emphasize
  7. 7. Open Course by Ferdian Sonatha , Padepokan Kanuragan Blankon Malang http://malang.di.blankon.in/opencourse/ reliably quick interrupt handling response times (QNX) and simplicity for the sake of robustness. An attempt to build a high-performance multiserver operating system was the IBM Sawmill Linux project. [16] However, this project was never completed. It has been shown in the meantime that user-level device drivers can come close to the performance of in-kernel drivers even for such high-throughput, high-interrupt devices as Gigabit Ethernet. [17] This seems to imply that high-performance multi-server systems are possible. Security The security benefits of microkernels have been frequently discussed. [18][19] In the context of security the minimality principle of microkernels is a direct consequence of the principle of least privilege, according to which all code should have only the privileges needed to provide required functionality. Minimality requires that a system's trusted computing base (TCB) should be kept minimal. As the kernel (the code that executes in the privileged mode of the hardware) is always part of the TCB, minimizing it is natural in a security-driven design. Consequently, microkernel designs have been used for systems designed for high-security applications, including KeyKOS, EROS and military systems. In fact common criteria(CC) at the highest assurance level (Evaluation Assurance Level (EAL) 7) has an explicit requirement that the target of evaluation be “simple”, an acknowledgment of the practical impossibility of establishing true trustworthiness for a complex system. Third generation Recent work on microkernels has been focusing on formal specifications of the kernel API, and formal proofs of security properties of the API. The first example of this is a mathematical proof of the confinement mechanisms in EROS, based on a simplified model of the EROS API.[20] More recently, a comprehensive set of machine-checked proofs has been performed of the properties of the protection model of seL4, a version of L4. [21] This has led to what is referred to as third-generation microkernels, [22] characterised by a security-oriented API with resource access controlled by capabilities, virtualization as a first-class concern, novel approaches to kernel resource management, [23] and a design goal of suitability for formal analysis, besides the usual goal of high performance. Examples are Coyotos, seL4, Nova, [24][25] and Fiasco.OC. [24][26] In the case of seL4, complete formal verification of the implementation has been achieved,[22] i.e. a mathematical proof that the kernel's implementation is consistent with its formal specification. This provides a guarantee that the properties proved about the API actually hold for the real kernel, a degree of assurance which goes beyond even CC EAL7. Nanokernel The term nanokernel or picokernel historically referred to: 1. A kernel where the total amount of kernel code, i.e. code executing in the privileged mode of the hardware, is very small. The term picokernel was sometimes used to further emphasize small size. The term nanokernel was coined by Jonathan S. Shapiro in the
  8. 8. Open Course by Ferdian Sonatha , Padepokan Kanuragan Blankon Malang http://malang.di.blankon.in/opencourse/ paper The KeyKOS NanoKernel Architecture. It was a sardonic response to Mach, which claimed to be a microkernel while being monolithic, essentially unstructured, and slower than the systems it sought to replace. Subsequent reuse of and response to the term, including the picokernel coinage, suggest that the point was largely missed. Both nanokernel and picokernel have subsequently come to have the same meaning expressed by the term microkernel. 2. A virtualization layer underneath an operating system; this is more correctly referred to as a hypervisor. 3. A hardware abstraction layer that forms the lowest-level part of a kernel, sometimes used to provide real-time functionality to normal OS's, like Adeos. There is also at least one case where the term nanokernel is used to refer not to a small kernel, but one that supports a nanosecond clock resolution.[27] See also  Kernel (computer science)  Exokernel, a research kernel architecture with a more minimalist approach to kernel technology.  Hybrid kernel  Monolithic kernel  Loadable kernel module  Trusted computing base References 1. "The MINIX 3 Operating System". minix3.org. Archived from the original on 2012-01-20. 2. "Porting UNIX/Linux Applications to Mac OS X". Apple. Retrieved 26 April 2011. 3. ^ : a b c Liedtke, Jochen (September 1996). "Towards Real Microkernels".Communications of the ACM 39 (9): 70–77. doi:10.1145/234215.234473. 4. Heiser, Gernot; Uhlig, Volkmar and LeVasseur, Joshua (January 2006). "Are Virtual-Machine Monitors Microkernels Done Right?" (PDF). ACM SIGOPS Operating Systems Review (ACM) 40 (1): 95–99. doi:10.1145/1113361.1113363. 5. Liedtke, Jochen (December 1993). "Improving IPC by kernel design". 14th ACM Symposium on Operating System Principles. Asheville, NC, USA. pp. 175–88.CiteSeerX: 6. http://www.qnx.com/download/download/8107/QNX_High_Availability_Toolkit.pdf[dead link] QNX High Availability Toolkit 7. Wong, William (2007-04-27). "I/O, I/O, It's Off to Virtual Work We Go". Electronic Design. Retrieved 2009-06-08.
  9. 9. Open Course by Ferdian Sonatha , Padepokan Kanuragan Blankon Malang http://malang.di.blankon.in/opencourse/ 8. Alexander, Michael T. (1971). "Organization and Features of the Michigan Terminal System". Proceedings of the November 16–18, 1971, fall joint computer conference40: 589– 591. doi:10.1145/1478873.1478951. 9. Lions, John (1977-08-01). Lions' Commentary on UNIX 6th Edition, with Source Code. Peer- To-Peer Communications. ISBN 978-1-57398-013-5. 10. ^ :a b Liedtke, Jochen (December 1995). "On µ-Kernel Construction". 15th ACM symposium on Operating Systems Principles. pp. 237–250.doi:10.1145/224056.224075. 11. Chen, Bradley; Bershad, Brian (December 1993). "The Impact of Operating System Structure on Memory System Performance". 14th ACM Symposium on Operating System Principles. Asheville, NC, USA. pp. 120–33. doi:10.1145/168619.168629. 12. Liedtke, Jochen; Elphinstone, Kevin; Schönberg, Sebastian; Härtig, Hermann;Heiser, Gernot; Islam, Nayeem; Jaeger, Trent (May 1997). "Achieved IPC performance (still the foundation for extensibility)". 6th Workshop on Hot Topics in Operating Systems. Cape Cod, MA, USA: IEEE. pp. 28–31. 13. Gray, Charles; Chapman, Matthew; Chubb, Peter; Mosberger-Tang, David; Heiser, Gernot (April 2005). "Itanium—a system implementor's tale". USENIX Annual Technical Conference. Annaheim, CA, USA. pp. 264–278. 14. van Schaik, Carl; Heiser, Gernot (January 2007). "High-performance microkernels and virtualisation on ARM and segmented architectures". 1st International Workshop on Microkernels for Embedded Systems. Sydney, Australia: NICTA. pp. 11–21. Retrieved 2007- 04-01. 15. Härtig, Hermann; Hohmuth, Michael; Liedtke, Jochen; Schönberg, Sebastian (October 1997). "The performance of µ-kernel-based systems". Proceedings of the sixteenth ACM symposium on Operating systems principles: 66–77.doi:10.1145/268998.266660. ISBN 0- 89791-916-5. 16. Gefflaut, Alain; Jaeger, Trent; Park, Yoonho; Liedtke, Jochen; Elphinstone, Kevin J.; Uhlig, Volkmar; Tidswell, Jonathon E.; Deller, Luke; Reuther, Lars (2000). "The Sawmill multiserver approach". 9th ACM SIGOPS European Worshop. Kolding, Denmark. pp. 109–114. 17. Leslie, Ben; Chubb, Peter; FitzRoy-Dale, Nicholas; Götz, Stefan; Gray, Charles; Macpherson, Luke; Potts, Daniel; Shen, Yueting; Elphinstone, Kevin; Heiser, Gernot(September 2005). "User-level device drivers: achieved performance". Journal of Computer Science and Technology 20 (5): 654–664. doi:10.1007/s11390-005-0654-4. 18. Tanenbaum, Andrew S., Tanenbaum-Torvalds debate, part II 19. Tanenbaum, A., Herder, J. and Bos, H. (May 2006).
  10. 10. Open Course by Ferdian Sonatha , Padepokan Kanuragan Blankon Malang http://malang.di.blankon.in/opencourse/ 20. Shapiro, Jonathan S.; Weber, Samuel. "Verifying the EROS Confinement Mechanism". IEEE Conference on Security and Privacy. 21. Elkaduwe, Dhammika; Klein, Gerwin; Elphinstone, Kevin (2007). Verified Protection Model of the seL4 Microkernel. submitted for publication. 22. b Klein, Gerwin; Elphinstone, Kevin; Heiser, Gernot; Andronick, June; Cock, David; Derrin, Philip; Elkaduwe, Dhammika; Engelhardt, Kai; Kolanski, Rafal; Norrish, Michael; Sewell, Thomas; Tuch, Harvey; Winwood, Simon (October 2009). "seL4: Formal verification of an OS kernel". 22nd ACM Symposium on Operating System Principles. Big Sky, MT, USA. 23. Elkaduwe, Dhammika; Derrin, Philip; Elphinstone, Kevin (April 2008). "Kernel design for isolation and assurance of physical memory". 1st Workshop on Isolation and Integration in Embedded Systems. Glasgow, UK. doi:10.1145/1435458. 24. ^ :a b "TUD Home: Operating Systems: Research: Microkernel & Hypervisor". Faculty of Computer Science. Technische Universität Dresden. 12 August 2010. Retrieved 5 November 2011. 25. Steinberg, Udo; Kauer, Bernhard (April 2010). "NOVA: A Microhypervisor-Based Secure Virtualization Architecture". Eurosys 2010. Paris, France. pp. 209–222. 26. Lackorzynski, Adam; Warg, Alexander (March 2009). "Taming Subsystems – Capabilities as Universal Resource Access Control in L4". IIES'09: Second Workshop on Isolation and Integration in Embedded Systems. Nuremberg, Germany. 27. http://www.eecis.udel.edu/~mills/database/papers/nano/nano2.pdf Further reading  scientific articles about microkernels (on CiteSeer), including:  Dan Hildebrand (1992). "An Architectural Overview of QNX". Proceedings of the Workshop on Micro-kernels and Other Kernel Architectures: 113– 126. ISBN 1-880446-42-1. – the basic QNX reference.  Tanenbaum, A., Herder, J. and Bos, H. (May 2006). "Can We Make Operating Systems Reliable and Secure?". Computer 39 (5): 44– 51. doi:10.1109/MC.2006.156. -the basic reliable reference.  Black, D.L., Golub, D.B., Julin, D.P., Rashid, R.F., Draves, R.P., Dean, R.W., Forin, A., Barrera, J., Tokuda, H., Malan, G., and Bohman, D. (March 1992). "Microkernel Operating System Architecture and Mach". J. of Information Processing 14 (4). – the basic Mach reference.  MicroKernel page from the Portland Pattern Repository  The Tanenbaum–Torvalds debate
  11. 11. Open Course by Ferdian Sonatha , Padepokan Kanuragan Blankon Malang http://malang.di.blankon.in/opencourse/  The Tanenbaum-Torvalds Debate, 1992.01.29  Tanenbaum, A. S. "Can We Make Operating Systems Reliable and Secure?".  Torvalds, L. Linus Torvalds about the microkernels again, 2006.05.09  Shapiro, J. "Debunking Linus's Latest".  Tanenbaum, A. S. "Tanenbaum-Torvalds Debate: Part II".