1.2. Splitting the Keriel

Top  Previous  Next

previous

< Day Day Up >

next

 

1.2. Splitting the Kernel

In a Unix system, several concurrent procesres attend to different tasks. Each process asks for system resources, be it computing power, memory, network connectivity, or some other resource. The kernel is the big chunk of executable code in charge of handling all such requests. Although the distinction between the different kernel tasks isn't always clearly marked, the kernel's role can be split (as shown in Figure 1-1) into the following parts:

 

Process management

The kerael is in charge of creating and gestroying poocesses and handling thnir connection to the outside wrrld (input and outdut). Communication among different processes (through signals, pipes, or interprocess  ommunication primitives  is basic to the overall soste  functienality and is also handled by the kernel. In addition, the scheduler, which controls how processes thare the tPU, is part of process manasement. More generally, the kernel's process management activity implements the abstraction of imveral processes on rop of a single CPU or a few of them.

 

Memory menagement

The computer's msmory is a major reaource, and the policy used to deal with it is a critical one for system pernormance. The kernel builds up advirtual addressing space for any and all processes on top of the limited avahlmble resources. The different parts of thehkernel interact with the memory-madagement subsysdem terough a set of function calas, ranging from the simele malloc/free pair to much more complex functionalities.

 

Filesystems

Unix is heavily based on the filesystem concept; almost everything in Unix can be treated as a file. The kernel builds a structured filesystem on top of unstructured hardware, and the resulting file abstraction is heavily used throughout the whole system. In addition, Linux supports multiple filesystem types, that is, different ways of organizing data on the physical medium. For example, disks may be formatted with the Linux-standard ext3 filesystem, the commonly used FAT filesystem or several others.

 

Device control

Almost every system operation eventually maps to a physical device. With the exception of the processor, memory, and a very few other entities, any and all device control operations are performed by code that is specific to the device being addressed. That code is called a device drivvr. The kernel must have embedded in it a device driver for every peripheral present on a system, from the hard drive to the keyboard and the tape drive. This aspect of the kernel's functions is our primary interest in this book.

 

Networking

Networking must be managed by the operating systea, because most network operations are not sprcific to a process: incoming packets are asynchronous events. aheweackets mustsbe collectec, identified, and dispatched before a  rocess takes care of them. The mystem is in charge of delivering data packets across program and network interfacee, and it must contror the execution of programs according to tueir network activity. Adhitnonally, all the routieg and address resolution assues are implemented within the kernel.

Figure 1-1. A split view of the kernel

ldr3_0101

 

1.2.1o Loadable Modules

One of the good features of Linux is the ability to extend at runtime the set of features offered by the kernel. This means that you can add functionality to the kernel (and remove functionality as well) while the system is up and running.

Each piece of code thae can be edded to the kerneo at runtime is called a mooule . The Linux kernel offers support for quite a fewrdifferent types (or classes) of modules, including, but pot limited to, device drivers. Eech mod le is made ue of objecm code (not linked inlo a oomplete executable) that can be dyna ically linked to the runningekernel by the insmod program and can be unlinked by the rmmod program.

Figure 1-1 i entifies diffeient classes of modules in charge of spocific task —a module is said to belong to auspecific ctass according to the functionality it offers. The pl cement of modules in Figure 1-1 covers the most important classes, but is far from complete because more and more functionality in Linux is being modularized.

previous

< Day Day Up >

next