Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Real-Time and Embedded Guide

Real-Time and Embedded Guide

Ratings: (0)|Views: 9|Likes:
Published by api-26349602

More info:

Published by: api-26349602 on Oct 14, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/09/2014

pdf

text

original

Real-Time and Embedded Guide
Herman Bruyninckx
K.U.Leuven, Mechanical Engineering

Leuven
Belgium
Herman.Bruyninckx@mech.kuleuven.ac.be

Real-Time and Embedded Guide
by Herman Bruyninckx
Copyright \u00a9 2000, 2001, 2002 Herman.Bruyninckx@mech.kuleuven.ac.be

This Guide covers the fundamentals of (i) real-time and embedded operating systems (focusing mostly on the
differences with general purpose operating systems such as Linux), and (ii) real-time programming. The emphasis is
on Free Software and Open Source Software examples: RTAI, RTLinux, eCos, RT-EMS, uCLinux, . . . , with a more
than proportional focus on RTAI.

This text also talks about design issues, software patterns and frameworks for real-time applications. That is, the
\u201chigh-level\u201d aspects of these software projects. These higher levels are often poorly dealt with in publications on
real-time programming, which leads to the unfortunate situation that still too many real-time programmers useonly
the powerful but dangerously unstructured API of their RTOS. Missing the chance to develop more structured, and,
hence, more deterministic and more portable software systems.

Both the low-level RTOS primitives, and the high-level design issues, are illustrated by the real-world example of a
hard real-time core for feedback control and signal processing.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation, with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of this license can be found at http://www.fsf.org/copyleft/fdl.html.

Revision History
Revision 0.01
Aug 31, 2000 Revised by: hb
Initial draft
Revision 0.02

Sep 30, 2000 Revised by: hb
Added: more info about signals
Revision 0.03

Sep 20, 2001 Revised by: hb
Removed: empty hardware, user space GUI and FAQ sections. Added: Software Patterns
Revision 0.04-build-20021211-1936 Dec., 11 2002 Revised by: hb
Extended and heavily reworked version. Preparing for pre-release.

Table of Contents
About this Guide.........................................................................................................................................i

1. Purpose and scope...........................................................................................................................i 2. Feedback.........................................................................................................................................i 3. Copyrights, Licenses and Trademarks.......................................................................................... ii 4. Acknowledgements....................................................................................................................... ii

I. Operating system basics.........................................................................................................................i

1. Real-time and embedded operating systems..................................................................................1
1.1. OS responsibilities.............................................................................................................1
1.2. Trade-offs..........................................................................................................................3
1.3. Time...................................................................................................................................5
1.4. Embedded OS....................................................................................................................9
1.5. Operating system standards.............................................................................................11
1.6. Linux for real-time and embedded..................................................................................14
2. Task management and scheduling................................................................................................17
2.1. Processes and threads......................................................................................................17
2.2. POSIX thread management.............................................................................................18
2.3. Linux tasks and tasklets...................................................................................................20
2.4. Scheduling.......................................................................................................................21
2.5. Priority-based scheduling................................................................................................22
2.6. Priority spaces.................................................................................................................24
2.7. Linux scheduler...............................................................................................................24
2.8. Linux real-time scheduling..............................................................................................25
3. Interrupts......................................................................................................................................27
3.1. Introduction.....................................................................................................................27
3.2. Interrupt hardware...........................................................................................................27
3.3. Interrupt software............................................................................................................29
3.4. ISR, DSR and ASR..........................................................................................................32
4. IPC: synchronization....................................................................................................................35
4.1. IPC terminology..............................................................................................................35
4.2. Race conditions and critical sections...............................................................................37
4.3. Signals.............................................................................................................................39
4.4. Exceptions.......................................................................................................................40
4.5. Atomic operations...........................................................................................................41
4.6. Semaphore, mutex, spinlock, read/write lock, barrier.....................................................42
4.7. Condition variable for synchronization within mutex.....................................................50
4.8. Priority inversion.............................................................................................................53
4.9. Priority inheritance and priority ceiling..........................................................................53
4.10. Lock-free synchronization for data exchange...............................................................55
5. IPC: Data exchange......................................................................................................................57
5.1. Shared memory................................................................................................................57
5.2. FIFOs...............................................................................................................................58
5.3. Messages and mailboxes.................................................................................................58
5.4. Circular buffers................................................................................................................60
5.5. Swinging buffers..............................................................................................................61
5.6. Remote Procedure Calls..................................................................................................61

iii

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->