K11932_cover.fhmx 12/21/11 11:07 AM Page 1
C
M
Y
CM MY CY CMY K
REAL-TIME
EMBEDDED
SYSTEMS
Open-Source Operating
Systems Perspective
Embedded Systems
Series Editor
Richard Zurawski
SA Corporation, San Francisco, California, USA
Communication Architectures for Systems-on-Chip, edited by José L. Ayala
Real-Time Embedded Systems: Open-Source Operating Systems Perspective, Ivan
Cibrario Bertolotti and Gabriele Manduchi
Time-Triggered Communication, edited by Roman Obermaisser
K11932_FM.indd 2
12/20/11 12:31 PM
REAL-TIME
EMBEDDED
SYSTEMS
Open-Source Operating
Systems Perspective
IVAN CIBRARIO BERTOLOTTI
GABRIELE MANDUCHI
Boca Raton London New York
CRC Press is an imprint of the
Taylor & Francis Group, an informa business
CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
© 2012 by Taylor & Francis Group, LLC
CRC Press is an imprint of Taylor & Francis Group, an Informa business
No claim to original U.S. Government works
Version Date: 20111207
International Standard Book Number-13: 978-1-4398-4161-7 (eBook - PDF)
This book contains information obtained from authentic and highly regarded sources. Reasonable
efforts have been made to publish reliable data and information, but the author and publisher cannot
assume responsibility for the validity of all materials or the consequences of their use. The authors and
publishers have attempted to trace the copyright holders of all material reproduced in this publication
and apologize to copyright holders if permission to publish in this form has not been obtained. If any
copyright material has not been acknowledged please write and let us know so we may rectify in any
future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced,
transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or
hereafter invented, including photocopying, microfilming, and recording, or in any information stor-
age or retrieval system, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, please access www.copy-
right.com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222
Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that pro-
vides licenses and registration for a variety of users. For organizations that have been granted a pho-
tocopy license by the CCC, a separate system of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are
used only for identification and explanation without intent to infringe.
Visit the Taylor & Francis Web site at
http://www.taylorandfrancis.com
and the CRC Press Web site at
http://www.crcpress.com
Foreword
Real-time embedded systems have become an integral part of our technologi-
cal and social space. But is the engineering profession equipped with the right
knowledge to develop those systems in ways dictated by the economic and
safety aspects? Likely yes. But the knowledge is fragmented and scattered
among different engineering disciplines and computing sciences. Seldom any-
one of us has the clear picture of the whole. If so, then parts of it are at an
abstract level. That poses a question whether the academic system provides
education in a way holistic enough to prepare graduates to embark on the de-
velopment of real-time embedded systems, frequently complex and imposing
safety requirements. How many electrical and computer engineering depart-
ments offer subjects focusing on the application-dependent specialized com-
munication networks used to connect embedded nodes in distributed real-time
systems. If so, then the discussion is confined to the Controller Area Network
(CAN), or sometimes FlexRay, in the context of automotive applications—
usually a small unit of an embedded systems subject. (The impression might
be that specialized communication networks are mostly used in automotive ap-
plications.) The requirement for the underlying network technology to provide
real-time guarantees for message transmissions is central to proper functioning
of real-time systems. Most of computer engineering streams teach operating
systems. But real-time aspects are scantly covered. Computer science students,
on the other hand, have very little, if any, exposure to the “physicality” of the
real systems the real-time operating systems are intended to interact with.
Does this put computer science graduates in a disadvantaged position? In
the late 1990s and early 2000s, I was involved in the Sun Microsystems lead
initiative to develop real-time extensions for the Java language. The working
group comprised professionals mostly from industry with backgrounds largely
in computing sciences. I was taken aback by the slow pace of the process.
On reflection, the lack of exposure to the actual real-time systems in different
application areas and their physicality was likely to be behind difficulties to
identify generic functional requirements to be implemented by the intended
extensions.
In the second part of 1980s, I was teaching digital control to the final year
students of the electrical engineering course. The lab experiments to illustrate
different control algorithms were designed around the, at that time, already
antiquated Data General microNOVA MP/200 minicomputer, running one of
the few real-time operating systems commercially available at that time—
QNX, if I remember correctly. Showing things work was fun. But students’ in-
v
vi
sight into working of the whole system stopped at the system level commands
of the operating systems. The mystery had to be revealed by discussing hy-
pothetical implementations of the system level calls and interaction with the
operating system kernel—of course at the expense of the digital control sub-
ject. At that time, seldom any electrical engineering curriculum had a separate
subject dedicated to operating systems. Of frustration and to avoid the “black
box” approach to illustrating control systems in action, I have written in C
a simple multitasking real-time executive for MS-DOS-based platforms, to be
run on an IBM PC (Intel 8088). Students were provided with the implementa-
tion documentation in addition to theoretical background; quite a lot of pages
to study. But the reward was substantial: they were now in full “control.”
With the support of an enterprising post-graduate student, the executive was
intended to be grown into more robust RTOS with a view for commercializa-
tion. But it was never to be. Academic life has other priorities. Around 1992,
I decided to harness the MINIX operating system, which I then taught to the
final-year graduate students, to run my real-time control lab experiments to
illustrate control algorithms in their supporting real-time operating system
environment. But soon after that came the Linux kernel.
If you are one of those professionals with the compartmented knowledge,
particularly with the electrical and computer engineering or software engi-
neering background, with not much theoretical knowledge of and practical
exposure to real-time operating systems, this book is certainly an invaluable
help to “close the loop” in your knowledge, and to develop an insight into how
things work in the realm of real-time systems. Readers with a background in
computer science will benefit from the hands-on approach, and a comprehen-
sive overview of the aspects of control theory and signal processing relevant
to the real-time systems. The book also discusses a range of advanced topics
which will allow computer science professionals to stay up-to-date with the
recent developments and emerging trends.
The book was written by two Italian researchers from the Italian National
Research Council (CNR) actively working in the area of real-time (embedded)
operating systems, with a considerable background in control and communi-
cation systems, and a history of the development of actual real-time systems.
Both authors are also involved in teaching several courses related to these
topics at Politecnico di Torino and University of Padova.
The book has been written with a remarkable clarity, which is particularly
appreciated whilst reading the section on real-time scheduling analysis. The
presentation of real-time scheduling is probably the best in terms of clarity
I have ever read in the professional literature. Easy to understand, which is
important for busy professionals keen to acquire (or refresh) new knowledge
without being bogged down in a convoluted narrative and an excessive detail
overload. The authors managed to largely avoid theoretical only presentation
of the subject, which frequently affects books on operating systems. Selected
concepts are illustrated by practical programming examples developed for the
Linux and FreeRTOS operating systems. As the authors stated: Linux has a
vii
potential to evolve in a fully fledged real-time operating system; FreeRTOS,
on the other hand, gives a taste of an operating system for small footprint
applications typical of most of embedded systems. Irrespective of the rationale
for this choice, the availability of the programming examples allows the reader
to develop insight in to the generic implementation issues transferrable to
other real-time (embedded) operating systems.
This book is an indispensable addition to the professional library of anyone
who wishes to gain a thorough understanding of the real-time systems from the
operating systems perspective, and to stay up to date with the recent trends
and actual developments of the open-source real-time operating systems.
Richard Zurawski
ISA Group, San Francisco, California