Hardware Reference
In-Depth Information
The objective of the interrupt handling mechanism is to provide service to the inter-
rupt requests that may be generated by any peripheral device, such as the keyboard,
serial ports, analog-to-digital converters, or any specific sensor interface. The service
provided by the kernel to an interrupt request consists in the execution of a dedicated
routine (driver) that will transfer data from the device to the main memory (or vice
versa). In classical operating systems, application tasks can always be preempted by
drivers, at any time. In real-time systems, however, this approach may introduce un-
predictable delays in the execution of critical tasks, causing some hard deadline to be
missed. For this reason, in a real-time system, the interrupt handling mechanism has
to be integrated with the scheduling mechanism, so that a driver can be scheduled as
any other task in the system and a guarantee of feasibility can be achieved even in the
presence of interrupt requests.
Another important role of the kernel is to provide a basic mechanism for supporting
process synchronization and communication. In classical operating systems this is
done by semaphores, which represent an efficient solution to the problem of synchro-
nization, as well as to the one of mutual exclusion. As discussed in Chapter 7, however,
semaphores are prone to priority inversion, which introduces unbounded blocking on
tasks' execution and prevents a guarantee for hard real-time tasks. As a consequence,
in order to achieve predictability, a real-time kernel has to provide special types of
semaphores that support a resource access protocol (such as Priority Inheritance, Pri-
ority Ceiling, or Stack Resource Policy) for avoiding unbounded priority inversion.
Other kernel activities involve the initialization of internal data structures (such as
queues, tables, task control blocks, global variables, semaphores, and so on) and spe-
cific services to higher levels of the operating system.
In the rest of this chapter, we describe the structure of a small real-time kernel, called
DICK ( DI dactic CK ernel). Rather than showing all implementation details, we
focus on the main features and mechanisms that are necessary to handle tasks with
explicit time constraints.
DICK is designed under the assumption that all tasks are resident in main memory
when it receives control of the processor. This is not a restrictive assumption, as this
is the typical solution adopted in kernels for real-time embedded applications.
The various functions developed in DICK are organized according to the hierarchical
structure illustrated in Figure 10.1. Those low-level activities that directly interact
with the physical machine are realized in assembly language. Nevertheless, for the
sake of clarity, all kernel activities are described in pseudo C.
The structure of DICK can be logically divided into four layers:
Search WWH ::




Custom Search