Chapter 5. Managing the Flow of Activity

In Chapter 2, we looked at different ways to break up a system into manageable chunks. That chapter described the what and why of design; this chapter covers the how. Once you’ve identified the pieces, getting them all to work together as a system can be daunting.

Scheduling and Operating System Basics

Structuring an embedded system without an operating system requires an understanding of some of the things that an operating system can do for you. I’m only going to give brief highlights; if any of this first section is brand new to you, you may want to review a book about operating systems (see Further Reading).

Tasks

When you turn on your computer, if you are like me, you load up the email program, web browser, and compiler. Several other programs start automatically (such as my instant message client). Each of these programs runs on the computer, seemingly in parallel, even if you have only one processor.

Warning

Three words that mean slightly different things, but that overlap extensively, are sometimes used interchangeably. A task is something the processor does. A thread is a task plus some overhead, such as memory. A process typically is a complete unit of execution with its own memory space, usually compiled separately from other processes. I’m focusing on tasks; threads and processes generally imply an operating system.

The operating system you are running has a scheduler that does the switching between processes (or threads), allowing ...

Get Making Embedded Systems now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.