logomacitynet1200wide 1

The battle of the kernels

The discussions about the goodness of the operating systems with microkernel Vs those with monolithic kernels often recur in the "bar" chat of the insiders, and are one of the motives of endless disputes, such as Apple is better than Microsoft or is more Juve or Inter are strong.

On the subject, the most curious can consult the exchange of jokes between Linus Torvalds (supporter of the monolithic kernel), at the time student and fresh creator of a small unix clone capable of running on a modest 386 and Andriew Tanenbaum, eminent luminary of operating systems and dad of Minix, a microkernel born for educational purposes, which claimed that linux was "born obsolete", precisely because of its monolithic being.

Linuxjournal hosts an interesting article on the MacOs X kernel compared to that of Linux; the argument that Apple's OS microkernel architecture condemns it to lower performance.

The debate is complex: microkernels give the impression of better architecture, but are often accused of being slow to present benefits only on paper; the theory (in very simplistic terms) that in microkernel a series of processes, each isolated from the other and operating in protected memory, should take on the vast majority of the tasks performed by the operating system. Thus modifying or crashing one of these processes should not cause problems for the rest of the system.

Miles Nordin, the editor of the article, sides with the monolithics, and claims that microkernel fans are the victim of an erroneous generalization, and that memory protection is an absolute dogma, perhaps due to their origin from systems with little protected as Windows 3.1 and Mac OS 6.

In reality, there are only two widespread microkernel systems: QNX and Mach, and their implementations are different; in particular Mach, the one chosen by Apple, inserts everything that accesses the hardware in the microkernel, and this guarantees for example that the drivers for the hardware can be covered by a license more favorable to Apple. The problem is that inserting the drivers inside the microkernel actually cancels one of the key reasons for choosing the microkernel, that related to the simplicity and speed of driver development and the simplification of debugging.

The other big issue, much debated, that of performance. Nordin claims that modern CPUs are optimized for monolithic kernels (and this is already a step forward, often runs into those who claim that slowness is intrinsic to the design of the microkernel), and that this causes, for microkernels, overhead in the passage of messages from one process to another. Microkernel performances would also be undermined by the fact that memory protection complicates the current tendency to copy as few blocks of memory as possible (Zero copy aesthetic).

The conclusion that the microkernel would have failed: for many years, microkernel systems were only theorized on paper, and certain problems, although evident already in the design phase, would reveal themselves in their completeness only during implementation.

The argument technically clear and convincing, but some distinctions are needed: meanwhile, those who have tried QNX (a real-time operating system used in many mission-critical machines, and a demo of which is available for download) did not find it slow at all, moreover it is necessary to understand to what extent MacOS really is a microkernel, for example even the design of Windows NT microkernel, but its practical realization does not.

Some information collected on the Apple developer site, for example, confirms that Mach is not a "real" microkernel

Again: the microkernel's loans are real, so much so that Linux itself has long used to insert and remove so-called kernel-modules "on the fly".

Finally, it should be said that microkernels are a relatively little explored territory, especially in the desktop environment, so it is possible that the margins for improvement are wider than expected, so much so that the performance of Mac Os X (which is also difficult to understand how much are negatively influenced by Mach and what by Aqua), after a frankly embarrassing debut, they have improved enormously and should do the same with Jaguar, the next release, and although not phenomenal they are not far from those of Mac OS 9.x.

(By Marco Centofanti)