Linux Kernel Architecture

(Jacob Rumans) #1

Kernel Activities


Chapter 13 demonstrated that system execution time can be split into two large and different parts:
kernel mode and user mode. In this chapter, we investigate the various kernel activities and reach
the conclusion that a finer-grained differentiation is required.


System calls are not the only way of switching between user and system mode. As is evident from
the preceding chapters, all platforms supported by Linux employ the concept ofinterruptsto intro-
duce periodic interruptions for a variety of reasons. Two types of interrupt are distinguished:


❑ Hardware Interrupts— Are produced automatically by the system and connected periph-
erals. They support more efficient implementation of device drivers, but are also needed
by the processor itself to draw attention to exceptions or errors that require interaction
with the kernel code.

❑ SoftIRQs— Are used to effectively implement deferred activities in the kernel itself.

In contrast to other parts of the kernel, the code for handling interrupts and system call-specific
segments contains very strong interweaving between assembly language and C code to resolve
several subtle problems that C could not reasonably handle on its own. This is not a Linux-specific
problem. Regardless of their individual approach, most operating system developers try to hide
the low-level handling of such points as deeplyas possible in the kernel sources to make them
invisible to the remaining code. Because of technical circumstances, this is not always possible, but
the interrupt handling layer has evolved over time to a state where high-level code and low-level
hardware interaction are separated as well and cleanly as possible.


Frequently, the kernel needs mechanisms to defer activities until a certain time in the future or to
place them in a queue for later processing whentime is available. You have come across a num-
ber of uses for such mechanisms in earlier chapters. In this section, we take a closer look at their
implementation.

Free download pdf