2.2 The Kernel

2.2 The Kernel

You now know what the Linux directory structure looks like. Before going on to devices and filesystems, you must learn some higher-level concepts about the kernel.

The kernel of an operating system is the very core of a running system. It's a very special program that manages all processes, device drivers, and I/O. When the system boots, the kernel runs first, initializing hardware and internal data structures. After the kernel completes this stage, it loads and starts the init program.

The kernel also has many functions once the system boots. Process and device management are the most important. The idea is that although computers with one CPU run only one program at a time, the kernel can keep several programs in memory at the same time. Process and device management run together in a cycle like this:

  1. The kernel has control of the processor. There are several processes in memory.

  2. The kernel selects a process and finds out where that process was last running.

  3. The kernel relinquishes control of the processor to that process.

  4. That process runs for a few microseconds.

  5. When the time is up, a clock interrupt stops the process and gives control back to the kernel.

  6. The kernel takes care of any system work that it needs to do, such as reading to and from devices.

  7. Go to step 2.

This description of the kernel's work is somewhat simplified, but as you can see, there is nothing magic about the kernel. It is not a process; it is just a piece of code that runs every now and then between processes.

On Linux systems, the kernel is normally in a file called /vmlinuz or /boot/vmlinuz . A boot loader loads this file into memory and sets it in motion when the system boots. Details on to how to configure the boot loader and how to create a Linux kernel are in Chapters 4 and 10.

If you are interested in the detailed workings of a kernel, the classic textbook is Operating System Concepts [Silberschatz].

How Linux Works
How Linux Works: What Every Superuser Should Know
ISBN: 1593270356
EAN: 2147483647
Year: 2004
Pages: 189
Authors: Brian Ward

Similar book on Amazon

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