6.1 Introduction

Although simple applications can be programmed on a microprocessor by writing a single piece of code, many applications are sophisticated enough that writing one large program does not suffice. When multiple operations must be performed at widely varying times, a single program can easily become too complex and unwieldy. The result is spaghetti code that is too difficult to verify for either performance or functionality.

This chapter studies the two fundamental abstractions that allow us to build complex applications on microprocessors: the process and the operating system (OS). Together, these two abstractions let us switch the state of the processor between multiple tasks. The process cleanly defines the state of an executing program, while the operating system provides the mechanism for switching execution between the processes.

These two mechanisms together let us build applications with more complex functionality and much greater flexibility to satisfy timing requirements. The need to satisfy complex timing requirements—events happening at very different rates, intermittent events, and so on—causes us to use processes and operating systems to build embedded software. Satisfying complex timing tasks can introduce extremely complex control into programs. Using processes to compartmentalize functions and encapsulating in the operating system the control required to switch between processes make it much easier to satisfy timing requirements with relatively clean control within the processes.

We are particularly interested in real-time operating systems (RTOSs), which are operating systems that provide facilities for satisfying real-time requirements. A real-time operating system allocates resources using algorithms that take real time into account. General-purpose operating systems, in contrast, generally allocate resources using other criteria like fairness. Trying to allocate the CPU equally to all processes without regard to time can easily cause processes to miss their deadlines.

In the next section, we will introduce the concept of a process. Section 6.2 motivates our need for multiple processes. Section 6.3 looks at how the RTOS implements processes. Section 6.4 develops algorithms for scheduling those processes to meet real-time requirements. Section 6.6 introduces some basic concepts in interprocess communication. Section 6.7 considers the performance of real-time operating systems while Section 6.8 looks at power consumption. Section 6.9 surveys various real-time operating systems. We end with two design examples: a telephone answering machine in Section 6.10 and an engine control unit in Section 6.11.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.83.126