Make operating system kernels small and lightweight

7.2 Make operating system kernels small and lightweight

This is one hot topic with Unix purists and has been the subject of many debates over the years. The Unix kernel consists of those routines that, among other things, manage its memory subsystems and interface with its peripheral devices. It seems that any time people want higher application performance, the first thing they suggest is placing its runtime routines in the kernel. This reduces the number of context switches among running applications at the expense of making the kernel larger and incompatible with other Unix kernels.

During an early stage of the X Window System's development, a strong disagreement arose over whether higher performance would result from embedding part of the X server in the Unix kernel. (The X server is the part of the X Window System that captures user input from the mouse and keyboard and renders graphic objects on the screen.) The X server ran in user space (i.e., outside the kernel), making it relatively portable as window systems go.

The put-it-in-the-kernel camp advocated taking advantage of the smaller number of context switches between the kernel and user space to improve performance. The fact that the kernel was growing rapidly was of no consequence, they reasoned, since modern Unix systems had much more available memory compared to earlier ones. Therefore, there would still be plenty of memory left for the applications to run.

The user-space-for-everything crowd, on the other hand, argued that the X server would no longer be portable. Anyone modifying the X server would then need to be a Unix kernel guru, in addition to a graphics software developer. To remain a competent Unix kernel guru, one would have to forgo much interest in the graphics aspects of the X server. Thus, the X server would suffer.

How did the two camps resolve their differences? The system itself did it for them. After an apparently successful attempt to implant the X server into the kernel, testers discovered that a bug in the server would cause not only the window system to crash, but the entire operating system as well. Since a system crash is considered even less desirable than an X server crash, most X server implementations today reside solely in user space. Chalk one up for the user-space-for-everything crowd.

By avoiding the temptation to put everything in the kernel, it is easier to keep the kernel small and lightweight. Small and lightweight kernels speed the activation of tasks in user space by reducing the number of data structures copied or modified when starting a task. This ultimately makes it easier for collections of small programs that do one thing well to operate efficiently. Fast activation of small unifunctional programs is critical to Unix performance.



Linux and the Unix Philosophy
Linux and the Unix Philosophy
ISBN: 1555582737
EAN: 2147483647
Year: 2005
Pages: 92
Authors: Mike Gancarz

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net