Friday, 14 March 2008

A simple overview of Linux architecture

I guess most users don't care about the architecture of their operating system, and why should they?

I'm just one of those people who has to know, it helps me sleep, its just the way I am. Now I know more on this topic, a lot of the advice given online, and my interaction with Linux does start to make more sense. So I thought I would try to give a simple overview here.

As I mentioned before, to use Linux we use a distribution, which consist of the Linux kernel and a whole bunch of other open source software. Linux is a layer of software underneath layers of other software that are required to help it provide the nice graphical user interface the you point and click in. The picture below show this in a nice concise model.
This picture is from Coops Weblog under a creative commons license the original is here

The Linux kernel runs all the time, it interfaces with and manages all access to the machines hardware. The other key task of the kernel is to manage what programs are allowed to run and how they are run. When you see the computer doing more than one thing at a time it's the kernel which is sharing the processor's time between those programs. Users never interact with the kernel directly.

The CLI (command line interpreter) or Shell provides a means for communicating with the machine and controlling what its doing. The command shell running on top of the kernel provides the minimum working system that users can interact with. When you start up the machine there are scripts that run in the command shell, which start off the programs to create the desktop environment that you use. As a desktop user you will rarely if ever have to use the command shell, except perhaps to make changes to the configuration that the GUI (graphical user interface) has not been designed to make.

Often when Linux is used as a server, to run websites or database for instance, the Console will suffice, and the higher layers of the system need not be loaded. Also if a desktop system has become broken, its possible for a more expert user to start the system in console mode, and use the command line tools available there to fix the system.

The X Window System (often referred to as X11), is the software that provides the basic graphical interface capabilities that are required to draw windows on the screen and interact with a mouse. There are various alternate programs available to suit different hardware, which have different resource requirements and capabilities, such as screen resolution and memory requirements.

The Window Manager is what makes the windows look and behave the way we see them. They manage the buttons frames and basic window behaviors; (maximising, minimising, window labels, creating dialogue boxes etc. It is possible to use a system at this level with out additional layers of software, however thats not typical on a modern installation.

The Desktop provides a rich user experience on top of the facilities provided by the window manager. This encompasses things such as the menus, tool bars, help systems, and an increasing number of other additional support services. There are two main Desktop options available KDE and Gnome. The major distributions offer one or both of these. Ubuntu uses the Gnome desktop, but is also available in the Kubuntu KDE desktop flavour.

So why all the layers (onion boy)? Each of these layers of software communicate with each other in well defined standard ways. So as long as the software used in each of the layers sticks to the rules, different programs can be used in any layer. This is one of the key strengths of Linux; through careful choice of sofware in each layer, its possible to create a Linux system that will run on a pocket sized mobile phone, or one that Dreamworks studios can use to make the next Shreck movie (oh please no! not a Shreck IV), or even more than 75% of the worlds top 500 supercomputers (just thought I ought to include this stat. even though they probably not running the GUI for the most part).

How's that compare to Windows? Windows has a kernel which is similar in function to the Linux kernel, but the layers above that are not so well defined. Although windows comes in a number of flavours and a wide variety of ways to pay for it, if you are not happy with the way that it works, well it kind of tough. You can't choose a different window manager that better suits your purposes, you get what's been chosen for you. You can't even write an improvement you need, since its all proprietary there's no way to know how all the programs inside Windows talk to each other. That said, to be fair, XP is pretty good on a current PC, even if Vista is a resource hungry monster, and there's a Windows version that competes in the Phone arena.

The web has masses of information about Linux here are some links I've found if you want to look a little further into this stuff.

Linux kernel - Wikipedia article
Shell / CLI
X11 - Wikipedia article
Window Managers

No comments: