Kernel vs Operating System

Is it really obvious to you which is the difference in between a kernel and an operating system?
… because it looks to be like railways and trains (without railways trains can do nothing, but on the other hand only railways doesn’t help to anyone)

Just after few minutes of “googling”

“kernel is the fundamental part of an operating system. It is a piece of software responsible for providing secure access to the machine’s hardware to various computer programs. Since there are many programs, and access to the hardware is limited, the kernel is also responsible for deciding when and how long a program should be able to make use of a piece of hardware, in a technique called multiplexing. Accessing the hardware directly could also be very complex, so kernels usually implement a set of hardware abstractions. These abstractions are a way of hiding the complexity, and providing a clean and uniform interface to the underlying hardware, which makes it easier on application programmers.”

Well, the first thing that comes into my mind is the Linux example. The Linux kernel is is common for all Linux distributions, so when looking at this example the answer may seem obvious: kernel is “that thing” you can find here and Linux distributions you may find in different places, many of them appeared lately, but I will quote just the most notorious ones: RedHat, Mandriva, Ubuntu, Suse, Slackware, Debian and the list may continue.

What does the Linux Kernel contain? Some of the Linux distribuitions use to keep the sources as well, besides the binaries. Usually you can find them under /usr/src/linux and directory names are self-explanatory: init, mm(memory management), drivers, ipc (inter-process communication), modules, fs(file system), kernel (main kernel code), scripts … I have named just the most useful ones. Linux kernel is responsible for bringing to the user a “clean” bash command prompt. It is the software layer which sits closest to the hardware and it has to make sure that , before the user can start using the hardware resources, those are enabled, configured and are working properly. It brings the computer to life and another important aspect is that it executes only privileged code.

One of the very basic differences in between the two (OS and kernel) is that the second one runs only in privileged mode and the first one may integrate on top of the kernel code, user applications also.

Some things are mandatory to be done by the kernel, even if I heard about nanokernels which can delegate some of those activities to some higher layers: process management, memory management and files management (hardware management is usually handled by BIOS, but it depends, if you consider CPU and device management which are done by the kernel, you can say that basically the kernel manages hardware as well )

Kernels are considered to be basically of two types (this is where the notorious Tanenbaum-Torvalds debate comes from): microkernel and monolithic, even though many derivatives like hybrid, nanokernel or exokernel exists (I already wrote some words about Symbian OS nanokernel).

The picture below is very useful to have a clearer representation about the differences in between the two.

The main difference in between the two is that microkernels implement just a basic set of functionalities, like memory management, multi-tasking, ipc, rest of the things are executed in the user space and are referred as services. Examples of microkernel OSes are AIX (an IBM operating system on top of which MS-DOS was built), MINIX (Tanenbaum’s OS), Mach OS, don’t know for sure about MAC OS X, all I know is that until some release this was microkernel-based and then Apple switched to monolithic kernel. The advantage of this one conssits in its simplicity and modularity, but on the other hand is more prone to crashes.

The monolithic kernel runs all OS services in the same address space. The services are implemented as modules and are loaded dynamically by the kernel. Its biggest drawback is that a bug in one module can crash the entire system but on the other hand it is faster and more robust. In fact it won the battle for desktop PCs with its counterpart. Example of this type are many and very notorious: UNIX, Windows(except Windows NT), Linux, BSD.

Somehow, I think a monolithic kernel can be assimilated to an entire operating system. In this case my “Linux example” fails since Linux kernel is monolithic but I am striving to use it as model to distinguish in between kernal and other OS components. Windows case could be more helpful. It is a classical example of an unmodular OS. Everything starting from IPC or memory management to GUI is integrated into the kernel. It is a big challange to trace the boundaries in between  the kernel and rest of the operating system.

One very important aspect which was neglected here is about GUI’s (graphical user interfaces). Probably nowhere else thn on Linux this limit isn’t so visible (I am referring to the limit in between the kernel and different GUIs and the freedom of choice which reaches its heights on Linux). As far as I know Linux is currently the single OS where you can freely switch in between GUIs, I remember that on some distributions you are asked wheter you want to start KDE or GNOME.

Also when talking about GUIs it is hard to jump over a notorious trial in computers industry history: Apple vs Microsoft. It was somewhere in the late 80’s when Apple wanted to prevent Microsoft from using “their” GUI elements which Apple claimed to fall under patent laws. Finally, around 1994, Apple lost the trial due to the fact that they used in GUIs for MAC OS and Lisa unlicensed GUI elements developed by XEROX (historically being considered inventors of GUI).

I think you can sense those differences while making embedded OS development. There first thing to be done is to have an up and running kernel, then a file system needs to be attched, then different device drivers, then GUI part and so on …

Advertisements

3 Responses to Kernel vs Operating System

  1. Pingback: Kernel vs Operating System « Bazzarrr 2.0 | Drakz Free Online Service

  2. raips says:

    Seems like you had not find the actual points about the OS Kernel situation.

    As there is no such architecture as Hybrid. Unless kernel has a kernel running the kernel?

    There are two OS architectures. Monolithic and Server-Client (aka Microkernel).

    Monolithic is a OS architecture where the whole OS is running in one address space. In early years, it was single binary. But later it got modularity. So that some of the OS parts could be loaded and unloaded when demanded so. But still every module was working like they were never separated binaries. If the kernel image changes, then every module image is needed to change as well. The whole OS is the monolithic kernel. Like Linux, FreeBSD, NetBSD, OpenBSD, SunOS and HP-UX. They are all monolithic operating systems, aka monolithic kernels. The whole OS exist in the kernel space. Everything in user space is not part of the OS at all.

    Then there is the other totally different architecture, the Server-Client. What was designed few decades later of the monolithic to solve some of the stability problems.
    Idea was that the monolithic OS is sliced to parts. A very small (few thousands lines of code) microkernel and slices OS parts to separated protected process in user space or kernel space. The original idea was that every server is located to user space, but it is not different to Server-Client idea to have some of the servers in kernel space, but they are still separated from the microkernel. Module being in the kernel space along the microkernel does not make it part of the microkernel. The server is separated binary, but it is as well separated by architecture level that if the microkernel or any other module gets changed, the module does not need to be changed as long as the microkernel API/ABI stays same. It is easy to distribute the servers, even if there would be different microkernel (if just compatible).

    Exo- and Nano kernels are just even more pure ideas of the Server-Client architecture. While the Hybrid kernel is just pure marketing that “we made a new OS architecture where we still use microkernel but we just want to market that the OS is as fast as the monolithic but as stable and secure as 100% pure server-architecture OS”. Well, even Microsoft stopped to use their started “Hybrid” marketing and admits that NT is Server-Client architecture OS, just like the “Singularity” with SIP’s.

    The definition “every operating system needs a kernel” is not true. It only applies to Server-Client architectured OS’s, like NT, XNU, HURD, Dragon fly BSD, Minix and so on.
    The OS is microkernel+servers. While on monolithic kernel is the original OS. But because the Server-Client came later and it changed the rules so the kernel did not anymore have all the functions what were needed, the kernel was not anymore correct name for the OS.

    Other names for the software what we now call as OS, were “Kernel”, “Master Program”, “Supervisor”, “Controller”, “Core”, “Nucleous” and “Operating System”. The Kernel was the original definition for operating system, but because the Server-Client architecture came (microkernel+servers) the “kernel” did not apply anymore like it did with monolithic kernels (simply kernel).

    Now people are talking about monolithic and microkernels as they are kernels and OS is they + something. While they do not understand that the monolithic kernel is the OS alone. There is no fancy desktops, graphics or command lines. None of those works without the OS.

    • Sorry about not getting the actual points about the OS kernel situation. If you say that “there is no such architecture as Hybrid” what are those guys referring to when writing about this thing?
      Let’s take them one after the other …
      monolithic kernel .. here I think both of us we came to the same understanding. Even if I did not write it explicitely I agree that all the OS runs within a single address space, which is the privileged one (I think the picture in the post is relevant in this sense, also because explicitely shows that everything outside OS is “Application”).
      Then next … microkernel, this part I did not quite understood. What are you referring when saying ?

      The original idea was that every server is located to user space, but it is not different to Server-Client idea to have some of the servers in kernel space, but they are still separated from the microkernel. where is the “server” running, in user or privileged space?

      a very small microkernel which runs in the privileged mode and in a different address space than rest of the OS processes (device drivers, file system ..) .. this is clear, this I got it.

      The definition “every operating system needs a kernel” is not true. I read once again the post I did not find such definition, could you point me to the place where I said this?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: