L4 microkernel family

From Free net encyclopedia

L4 is, collectively, a family of related computer programs. They are microkernels that are becoming well known in the computer industry for their excellent performance and small footprint. Originally L4 was a single product, a highly-tuned Intel i386 kernel designed and implemented by Jochen Liedtke. Since then the system has seen dramatic development in a number of directions, notably in producing a more platform-independent version known as Pistachio[1], as well as ports to a number of different hardware architectures.

The realization of drawbacks in design and performance of the Mach microkernel led a number of developers to re-examine the entire microkernel concept in the mid-1990s. Mach was adding considerable overhead to the inter-process communication (IPC) in order to support concepts that weren't really useful in anything but a Unix context. The IPC system itself was a classic example of a distributed cost. On a single-user system, like a cell phone for instance, permissions and rights checking was of considerably less importance. While Mach claimed to be a microkernel, it seemed that it actually contained far more than it needed to.

Jochen Liedtke set out to prove that a thinner IPC layer, careful attention to performance, and machine-specific (as opposed to platform independent) design could yield massive real-world performance improvements. Instead of Mach's complex IPC system, his L3 simply passed the message without any additional overhead. Security and rights were considered to be duties of other user space servers, if those services were needed at all. L3 also used a variety of mechanisms to physically pass the message, tuning each call to maximize use of the hardware support, like in registers. In contrast, Mach used a one-size-fits-all mechanism that sacrificed speed for portability. The result of these changes was a massive reduction in IPC overhead. On the same system where Mach required 114 microseconds for even the smallest of messages, L3 could send the same message for less than 10. The overall time for a syscall was less than half the time on Unix, as opposed to Mach where the same syscall took five times that of Unix. L3 was proven as a safe operating system for many years by its use by TÜV SÜD. After using L3, Liedtke came to realize that several other Mach concepts were also misplaced. The result was the even simpler L4, so simple that it was later shown that implementations could be highly portable.

It appears in retrospect that the vast majority of Mach's performance problems could only be solved by resorting to a fresh design. For instance, another major bottleneck in Mach compared to monokernels is that in a true "collection-of-servers" system the kernel had no real way to know how to effectively page memory. Developers using monokernels could, and did, spend considerable time trying to understand the exact nature of memory use in the kernel, and then tuned their system to take advantage of this knowledge. On a microkernel the developer had no idea what made up the system, and no way to closely monitor memory use except in specific cases.

Liedtke decided the solution to this problem was to simply remove paging from the kernel altogether, and allow each application to apply the sort of tuning formerly applied only to the monokernels. Under an L4 system the operating system (as opposed to the kernel) is expected to provide paging services, potentially in many varieties, allowing the developer to pick the one best suited to their workload. The kernel's role is reduced to knowing that such systems exist and providing a mechanism for supporting them. Under L4, this requires a total of three functions: grant, map and unmap.

In the end the philosophy of the design became minimalist; as the L4/MIPS authors stated, "A feature should be in the microkernel if and only if security requires that the feature be implemented in privileged mode." Mach focused on cross-platform portability, multi-processor support and a host of other "next big things".

An operating system based on L4 has to provide services that the older generation microkernels included internally. For instance, in order to implement a secure Unix-like system, servers will have to provide the rights management that Mach included in the kernel. Additionally, the messages will, in most cases, still have to be checked for validity. It remains unclear if the end-to-end performance of a "real world" operating system based on L4 will run significantly faster than one built on Mach. Tests of a Linux ported to run on top of L4 and another ported to run on Mach (MkLinux) and the basic Linux system itself showed clear performance gains with L4. Even in the best case MkLinux was 15% slower than the monokernel, whereas L4 was about 5-10% slower. Additional development of certain portions of the Linux system, not carried out for the testing, was likely to improve this to some degree.

Ongoing development

Liedtke's original version of L4 was built for speed. In order to wring out every bit of performance, many of the critical sections were written in assembly language. His work caused a minor revolution in operating system design circles. Soon it was being studied by a number of universities, and quickly by IBM, where Liedtke moved. At IBM a new version of L4 was created, Lemon Pip, followed by an effort to create a cross-platform version in [[C++]], Lime Pip.

L4 development was also picked up at the University of Karlsruhe, where they developed L4Ka::Hazelnut, a C++ version that was intended to be run on any 32-bit machine. They were trying to determine if the overhead of a high-level language like C++ would offset the ease of programming that such a system would offer. The effort was a success, performance was still excellent, and with its release the Lime Pip project at IBM was ended. Hazelnut was eventually completely re-written for portability, 64-bit support and better performance, resulting in L4Ka::Pistachio.

Development also took place at the University of New South Wales, where developers implemented L4 on several 64-bit platforms. Their work resulted in L4/MIPS and L4/Alpha, resulting in Liedtke's original version being retroactively named L4/x86. Like Liedtke's original kernels, the UNSW kernels were unportable and each implemented from scratch. With the release of the highly portable Pistachio, the UNSW group abandoned their own kernel in favour of producing highly-tuned ports of Pistachio.

Recently the UNSW group, at their new home at National ICT Australia (NICTA), created a new version of L4 called L4-embedded. As the name implies, this is aimed at use in commercial embedded systems, and consequently the implementation tradeoffs favour small memory footprints and aim to reduce complexity. There is also on-going work on a formalisation of the L4 API, on the formal proof of the correctness of the implementation, as well as frameworks for developing well-structured systems on top of L4.

Fiasco is a further development of the original L4 that includes hard real-time support, which is used as the basis of the DROPS operating system. For real-time use "fast" is not enough, so the Fiasco kernel is entirely re-entrant, allowing it to be interrupted at any time. Like other developments of the original L4, Fiasco is also written in C++ for readability and portability reasons.

Almost all development today appears to be on the Pistachio kernel. The University of New South Wales now uses Pistachio to continue their experiments in portability, and the Pistachio kernel is now offered on a wide variety of hardware. Other teams explore real-time support, rolling in Fiasco-like concepts. Development of the basic kernel also continues at the University of Karlsruhe, who are working towards a new "Version 4" API (which Pistachio currently implements in beta).

The GNU Hurd project is considering adopting the L4 microkernel in place of Mach (GNU Hurd/L4).[[2] Currently, a design which aims to address the short comings of Mach within the L4 framework exists and the developers are working on an implementation.

External links

es:L4 (microkernel) fr:L4 ja:L4 pl:L4 (informatyka) zh:L4微内核系列