Linux Training

Linux training for private, public & voluntary sector.

0800 024 8425

City LinUX Training Courses

Section 2.
Architecture
.


"..of course, Linus didn’t sit down in a vacuum and suddenly type in the Linux source code.... He had my book.... But the code was his. The proof of this is that he messed the design up."

Andrew Tanenbaum.

2. Linux architecture.

The Linux kernel includes true multitasking, virtual memory, shared libraries, shared copy on write executables, memory management and TCP/IP networking.

2.1. The kernel.

When I first began studying UNIX the proud boast was that the kernel consisted of around 10,000 lines of C code and the hardware code represented around 1000 lines of assembler. It was this compact size and the use of a high level language that gave UNIX its flexibility. By making the necessary changes to the hardware code in assembler, UNIX could be relatively easily recompiled for very different hardware platforms.

Linux has, in common with many other operating systems and software applications, undergone substantial code bloat.

In 2011 the Linux Foundation kernel development study put the number of files used in building the kernel at 37,000, with 17 million lines of code.

Fortunately, although the kernel remains monolithic, unlike many other operating systems, you don’t need to keep it all. Many of the kernel virtual devices are in the form of loadable modules, which can either be loaded at boot time or later, on demand. In addition, it is a relatively simple task, to rebuild the kernel using only those static modules that are actually needed in your system. The kernel can be slimmed down substantially with significant performance gains.

The kernel runs in a highly privileged mode and supervises the privileges of all other processes.

Prior to kernel 2.2 there was a simple bifurcation between processes that ran with the effective user id 0 and which were then privileged and those processes which ran with a non zero id and were therefore unprivileged.

Starting with kernel 2.2 Linux divides privileges formerly associated with the superusers into units known as capabilities which can be enabled and disabled independently.

It is the flexibility of the kernel that allows it to be modified for such a large range of devices.

Image imgs/sa101-2.png

Figure 1 - UNIX/Linux Architecture

Image imgs/sa101-3.png

Figure 2 - System Kernel

2.2. User programs.

Most users’ contact with what they think of as the OS, is confined to the the huge raft of software tools that come as standard with most distributions of UNIX and Linux.

These software tools (and other applications) communicate with the kernel through the system call interface. Many of them were written before Linus wrote the Linux kernel and were intended to be part of the GNU Hurd operating system.

2.3. Exercises.

Andrew Tanenbaum believes that Linus made fundamental errors in his design of Linux. Do some on-line research and discover the key arguments over the differences between Minix and Linux architecture.

Study the commands in the table of tools below. Experiment with using each of them on the command line and read the associated man pages.

2.4. Tools:

Image imgs/sa101-4.png


The layout and associated style sheets for this page are taken from the World Wide Web Consortium and used here under the W3C software licence.