What Is the Kernel?


The easy answer is, "the kernel is the file /bsd."

That's probably not what you really wanted to know! You'll hear many different definitions of kernel. While everybody knows it's important, many people don't really know what the kernel actually does. The following definition isn't complete, but it's good enough for our purposes, and it's simple to understand:

The kernel is the interface between the hardware and user software.

The kernel allows you to write data to disk drives and to the network. The kernel gives instructions to the CPU and shuffles bits into memory chips. When you open a web page, your web browser asks the kernel to fetch data for it. The kernel provides a reasonably simple interface to the hardware through system calls. (If you're truly interested in the interfaces that the kernel provides, the man pages in section 2 describe all the system calls, the kernel interface provided for user-level software.)

For what might seem to be a simple task, the kernel's responsibilities are actually quite difficult. To start with, different pieces of hardware will provide their resources in varying ways. Even hardware with similar functions (e.g., network cards) can have very different hardware interfaces. The kernel has to cope with this through a variety of device drivers. Without this device driver, the kernel simply won't know how to transfer information to or from the card. The way your kernel investigates some hardware during the boot sequence defines how the hardware behaves, so you have to control that. Some network cards will identify themselves in a friendly manner, while others will lock up hard if sent the wrong sort of query. Also, different programs expect to access the system hardware in a variety of ways. For example, your kernel controls memory usage. If you have a program that demands that memory be allocated in a way your kernel doesn't support, you will have problems with that program.

The kernel is the first program to run when the system is booted. When you watch your system boot, those messages you see before init(8) starts are all from the kernel and are displayed in a different color than those displayed by init(8). The kernel manages all other processes, starting with init(8) and going from there.




Absolute Openbsd(c) Unix for the Practical Paranoid
Absolute OpenBSD: Unix for the Practical Paranoid
ISBN: 1886411999
EAN: 2147483647
Year: 2005
Pages: 298

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