Real-Time Systems and Programming Languages (Fourth Edition) Ada 2005, Real-Time Java and C/Real-Time POSIX

by Alan Burns and Andy Wellings

Publication Details

Real-Time Systems and Programming Languages (Fourth Edition)
Ada 2005, Real-Time Java and C/Real-Time POSIX
Alan Burns and Andy Wellings
Paperback - 602 pages
April 2009
Addison Wesley Longmain
ISBN: 978-0-321-41745-9

For those in the US who are having difficulty obtaining this book please order directly from or from


Synopsis of the book extract from the Preface

The book is aimed at Final Year and Masters students in Computer Science and related disciplines. It has also been written with the professional software engineer, and real-time systems engineer, in mind. Readers are assumed to have knowledge of sequential programming languages and some prior experience of C, Java and Ada, and to be familiar with the basic tenets of software engineering. The material presented reflects the content of courses developed over a number of years by the authors at various universities and for industry. These courses specifically address real-time systems and programming languages.


In order to give the chapters continuity, three programming languages are considered in detail: Ada, Java, and C. These languages have been chosen because they are actually used for software production. As C is a sequential language, it is used in conjunction with the POSIX family of operating system interfaces (in particular, the real-time extensions). To emphasize this, it will be referred to a C/Real-Time POSIX. As Java was not originally intended to be used for real-time systems development it must be augmented with the facilities of the Real-Time Specification for Java (RTSJ). To emphasize this, it will be referred to as Real-Time Java. Ada was designed for real-time systems development. Other theoretical or experimental languages are discussed when they offer primitives not available within the core languages. Practitioners who are primarily interested in only one of these languages should find sufficient material for their needs. The authors believe that a full appreciation of a language like Ada or Java, say, can only be obtained through a comparative study of their facilities.


return to top


Synopsis of changes within the Fourth Edition

Over the last 20 years, real-time technology has advanced considerably. Consequently this book has been creeping up in size. The fourth edition has added significant new material, and, as a result, we have restructured the book to remove some of the material that can be found elsewhere.

        The material on design has been pruned and incorporated into the Introduction. The advent of the UML real-time profile meant that we could no longer give this topic the attention it deserved. As design issues are not our focus, we decided it was best to cover less.

        The material on programming in the small and large, which provided the introduction to sequential programming in C, Java and Ada has been removed completely. We felt that the material is best served by specialist books on programming in these languages.

        We have removed discussions of occam2 and Modula to an appendix that can be obtained from the book's web page. Although these languages are no longer in widespread use, we believe they are historically important.

        The chapter on Distributed Systems has been removed, and the main topics have been distributed throughout other chapters in the book. Again, we felt that we were unable to do justice to this topic, but did not want to loose some of the important real-time issues.

        The removal of occam2 from the book left the Execution Environment chapter weak, so again we have removed it and distributed the remaining material throughout the book.

        The main new material has been introduced into the part of the book that focuses on timing issues. What were previously two chapters has now been expanded into five chapters.

We have also updated throughout our treatment of Ada, Real-Time Java and C/Real-Time POSIX to reflect the recent revisions to the associated definitions and standards.


return to top

Deleted Chapters

The following chapters from the Third edition have been deleted in their entirety; pdf versions of the chapters are available.


        Execution Environment

Also deleted from the Third edition is coverage of the languages occam and Modula-1. Material on these languages is available.


return to top

Table of Contents




1 Introduction to real-time systems

1.1 Definition of a real-time system

1.2 Examples of real-time systems

1.3 Characteristics of real-time systems

1.4 Development cycle for real-time systems

1.5 Languages for programming real-time systems


Further reading



2 Reliability and fault tolerance

2.1 Reliability, failure and faults

2.2 Failure modes

2.3 Fault prevention and fault tolerance

2.4 N-version programming

2.5 Software dynamic redundancy

2.6 The recovery block approach to software fault tolerance

2.7 A comparison between N-version programming and recovery blocks

2.8 Dynamic redundancy and exceptions

2.9 Measuring and predicting the reliability of software

2.10 Safety, reliability and dependability


Further reading


3 Exceptions and exception handling

3.1 Exception handling in older real-time languages

3.2 Modern exception handling

3.3 Exception handling in Ada, Java and C

3.4 Recovery blocks and exceptions


Further reading


4 Concurrent programming

4.1 Processes and tasks/threads

4.2 Concurrent execution

4.3 Task representation

4.4 Concurrent execution in Ada

4.5 Concurrent execution in Java

4.6 Concurrent execution in C/Real-Time POSIX

4.7 Multiprocessor and distributed systems

4.8 A simple embedded system

4.9 Language-supported versus operating-system-supported concurrency


Further reading



5 Shared variable-based synchronization and communication

5.1 Mutual exclusion and condition synchronization

5.2 Busy waiting

5.3 Suspend and resume

5.4 Semaphores

5.5 Conditional critical regions

5.6 Monitors

5.7 Mutexes and condition variables in C/Real-Time POSIX

5.8 Protected objects in Ada

5.9 Synchronized methods in Java

5.10 Shared memory multiprocessors

5.11 Simple embedded system revisited


Further reading



6 Message-based synchronization and communication

6.1 Process synchronization

6.2 Task naming and message structure

6.3 Message-passing in Ada

6.4 Selective waiting

6.5 The Ada select statement

6.6 Non-determinism, selective waiting and synchronization primitives

6.7 C/Real-Time POSIX message queues

6.8 Distributed systems

6.9 Simple embedded system revisited


Further reading



7 Atomic actions, concurrent processes and reliability

7.1 Atomic actions

7.2 Atomic actions in C/Real-Time POSIX, Ada and Real-Time Java

7.3 Recoverable atomic actions

7.4 Asynchronous notification

7.5 Asynchronous notification in C/Real-Time POSIX

7.6 Asynchronous notification in Ada

7.7 Asynchronous notification in Real-Time Java


Further reading



8 Resource control

8.1 Resource control and atomic actions

8.2 Resource management

8.3 Expressive power and ease of use

8.4 The requeue facility

8.5 Asymmetric naming and security

8.6 Resource usage

8.7 Deadlock


Further reading



9 Real-time facilities

9.1 The notion of time

9.2 Access to a clock

9.3 Delaying a task

9.4 Programming timeouts

9.5 Specifying timing requirements

9.6 Temporal scopes


Further reading



10 Programming real-time abstractions

10.1 Real-time tasks

10.2 Programming periodic activities

10.3 Programming aperiodic and sporadic activities

10.4 The role of real-time events and their handlers

10.5 Controlling input and output jitter

10.6 Other approaches for supporting temporal scopes


Further reading



11 Scheduling real-time systems

11.1 The cyclic executive approach

11.2 Task-based scheduling

11.3 Fixed priority scheduling (FPS)

11.4 Utilization-based schedulability tests for FPS

11.5 Response time analysis for FPS

11.6 Sporadic and aperiodic tasks

11.7 Task systems with D < T

11.8 Task interactions and blocking

11.9 Priority ceiling protocols

11.10 An extendible task model for FPS

11.11 Earliest deadline first (EDF) scheduling

11.12 Dynamic systems and online analysis

11.13 Worst-case execution time

11.14 Multiprocessor scheduling

11.15 Scheduling for power-aware systems

11.16 Incorporating system overheads


Further reading



12 Programming schedulable systems

12.1 Programming cyclic executives

12.2 Programming preemptive priority-based systems

12.3 Ada and fixed priority scheduling

12.4 The Ada Ravenscar profile

12.5 Dynamic priorities and other Ada facilities

12.6 C/Real-Time POSIX and fixed priority scheduling

12.7 Real-Time Java and fixed priority scheduling

12.8 Programming EDF systems

12.9 Mix Scheduling


Further reading



13 Tolerating timing faults

13.1 Dynamic redundancy and timing faults

13.2 Deadline miss detection

13.3 Overrun of worst-case execution time

13.4 Overrun of sporadic events

13.5 Overrun of resource usage

13.6 Damage confinement

13.7 Error recovery

13.8 Timing errors and backward error recovery


Further reading



14 Low-level programming

14.1 Hardware input/output mechanisms

14.2 Language requirements

14.3 Ada

14.4 Real-Time Java

14.5 C and older real-time languages

14.6 Scheduling device drivers

14.7 Memory management


Further reading



15 Mine control case study

15.1 Mine drainage

15.2 The HRT-HOOD design method

15.3 The logical architecture design

15.4 The physical architecture design.

15.5 Translation to Ada

15.6 Translation to Real-Time Java

15.7 Fault tolerance and distribution


Further reading



16 Conclusions






return to top

Teaching Aids

Slides for all the major chapters are available.

Example solutions for some of the questions in the 4th edition are available.
Teachers/lecturers who make use of this book are invited to contribute to these web pages. E-mail Alan Burns your contributions.


return to top


Code Fragments from the Book    

Many of the code fragments from the book are available. They are organised on a per chapter basis with the following structure. Each code fragment is contained in a text file that give the page number from the book and the language - for example would be a Java program from page 110.

Note these code fragments are for educational use only, they have not been tested for deployment in any real systems.

Code fragments


return to top



A separately managed list of errors found so far in the Fourth Edition is available.

return to top