Real Time Systems and Programming Languages Ada 95 Real Time Java and Real Time POSIX 3rd Edition by Alan Burns, Andy Wellings ISBN 0201729881 9780201729887 - Download the entire ebook instantly and explore every detail
Real Time Systems and Programming Languages Ada 95 Real Time Java and Real Time POSIX 3rd Edition by Alan Burns, Andy Wellings ISBN 0201729881 9780201729887 - Download the entire ebook instantly and explore every detail
https://ebookball.com/product/software-engineering-for-real-time-
systems-1st-edition-by-jim-cooling-
isbn-0201596202-9780201596205-15548/
Fourth Edition
University of York
A
ADDISON-WESLEY
VV
Animprint of Pearson Education
Harlow, England London
-
New York
-
Boston
- - San Francisco -
Toronto -
Sydney -
Singapore -
Hong Kong
Tokyo Seoul Taipei New Delhi Cape Town
- - - - - Madrid -
Mexico City Amsterdam
- -
Munich - Paris -
Milan
Pearson Education Limited
Edinburgh Gate
Harlow
Essex CM20 2JE
England
and Associated Companies throughout the world
ISBN: 978-0-321-41745-9
A catalogue record for this book is available from the British Library
of Congress Cataloging-in-Publication Data
Library
for this book be obtained from the Library of Congress
A catalogue record can
M
10987654321
1312111009
sustainable forests.
The publisher’s
policy is to use paper nzanufactured from
1
Contents
Preface xiii
v
Vi CONTENTS
88
Summary . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . .
Further 89
reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
95
Concurrent programming
4.1 Processes and tasks/threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Task 103
4.3 representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.9 operating—system—supported
Language—supported concurrency 131 versus
132
Summary . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . .
Further 133
reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5 .4 145
Semaphores . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . .
critical 156
5.5 Conditional regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
179
5.10 Shared memory multiprocessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
183
5.11 Simple embedded system revisited . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
185
Summary . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . .
Further 186
reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Selective 201
6.4 waiting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.6 Non—determinism,
selective waiting and synchronization primitives 205
219
6.9 Simple embedded system revisited . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
220
Summary . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . .
Further 221
reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
CONTENTS vii
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . r. . 304
Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
11 real-time 365
Scheduling systems
executive 366
11.1 The cyclic approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
378
11.6 Sporadic and aperiodic tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
413
11.15 Scheduling for power—awaresystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
414
11.16 Incorporating system overheads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
419
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Further 420
reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
426
12.2 Programming preemptive priority-based systems . . . . . . . . . . . . . . . . . .
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
13 faults 457
Tolerating timing
13.1 and timing faults 457
Dynamic redundancy . . . . . . . . . . . . . . . . . . . . . . . . . . .
492
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Further 493
reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
CONTENTS ix
.p.
. . 572 '
16 Conclusions 575
References 579
Index 587
Supporting resources
For instructors
0 Solutions to exercises
0
Example examination questions
0 Code fragments
o PowerPoint slides
For more information please contact your local Pearson Education sales
representative or visit www.pearsoned.co.uk/burns
List of Figures
10.1 A simple task with input and output jitter constraints. . . . . . . . . . . . . . . 350
10.2 Three threads implementing input and output jitter constraints, . . . . . 352
10.3 The Logical Execution Time model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
OCPP. . . . . . . . . . . . . . . . . . . . . . . . . . 388
11.9 Example of priority inheritance —
ICPP. . . . . . . . . . . . . . . . . . . . . . . . . . . 389
11.10 Releases of sporadic tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
11.11 PDC example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
11.12 Overheads when executing tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
11.13 The behaviour of four periodic tasks in Exercise 11.4. . . . . . . . . . . . . . 422
Audience
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 reflectsthe content
of courses developed over a number of years by the authors at various universities and
for industry. These courses
specificallyaddress real—timesystems and programming
languages.
xiii
xiv PREFACE
for software As C is
sequential language, it is used in conjunction with the
production. a
POSIX family of operating system interfaces (in particular, the real-time extensions). To
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.
In all, the book contains 16 chapters, the first 8 of which are loosely organized
into the following three groups. Chapter l represents an extended introduction. The
characteristics and requirements of real-time systems are presented, then an overview
of the design of such systems is given. Design is not the primary focus of this book;
nevertheless, it is important to discuss implementation within an appropriate context.
Chapters 2 and 3 concern themselves with the production of reliable software
resumption and termination models are described, as are the language primitives found
in Ada and Java.
Real~time inherently concurrent,
systems are and therefore the study of this aspect
of programming languages is fundamental. Chapter 4 introduces the notions of process,
tasks and thread the many different
and reviews models that are used by language and
operating system designers. The term task is used generically to represent a concurrent
activity. Communication between tasks is considered in the following two chapters.
Firstly shared—variable
methods are including the use of semaphores, monitors,
described
mutexes and protected objects. Message—based models are also important in modern
systems. It is therefore appropriate that a large portion of the book focuses on how to
PREFACE XV
meet them. Chapter 9 introduces the notions of time and clocks, along with the role of
temporal scopes for specifying timing constraints. Chapter 10 then shows the common
programming abstractions that are used to represent these constraints. Ensuring that
timing constraints can be met at run-time requires real-time scheduling. Hard real-time
systems have timing constraints that must be satisfied; soft systems can occasionally fail
to perform adequately. The mathematical
analysis that underpins real-time scheduling is
covered in Chapter 11: both priority and deadline—based
scheduling is considered. The
support provided for programming schedulable system is then covered in Chapter 12.
Chapter 13 brings together fault tolerance and real-time, focusing on the options available
to the programmer when timing faults occur at run—time.
One important requirement of many real-time systems is that they incorporate ex-
ternal devices that must be programmed (that is, controlled) as part of the application
software. This low—levelprogramming is at variance with the abstract approach to soft-
ware production that characterizes software engineering. Chapter I4 considers ways in
which low—levelfacilities can be successfully incorporated into high-level languages.
The final major chapter of the book is a case
study.AAn example from a mine
control system is used. Inevitably a single scaled down study cannot illustrate all the
issues covered in the previous chapters; in particular factors such as size and
complexity
are not addressed. Nevertheless, the case study does cover many important aspects of
real-time systems.
All chapters have summaries and further reading lists. Most also have lists of
"
material, and, as a result, we have restructured the book to remove some of the material
that can be found elsewhere.
0 The material on design has been pruned and incorporated into the Introduction.
The advent of the UML real-time profilemeant that we could no longer give this
xvi PREFACE
topic the attention it deserved. As design issues are not our focus, we decided it
was best to cover less.
unable to do justice to this topic, but did not want to lose some of the important
real—timeissues.
0 The removal of occam2 from the book left the Execution Environment chap—
ter weak, so again we have removed it and distributed the remaining material
o The main new material has been introduced into the part of the book that focuses
on timing issues. What was previously two chapters has now been expanded into
five chapters.
We have also update throughout our treatment of Ada, Real—TimeJava and C/Real-
Time POSIX to reflect the recent revisions to the associated definitions and standards.
Teaching Aids
This text is supported by further material available via the following WWW site:
http: //www .
pearsoned . co . uk/burns
Overhead projection foil layouts are available for many parts of the book. Also available
are solutions to some of the exercises. We will, over time, add further exercises, and
where appropriate new examples and additional teaching material. Teachers/lecturers
who make us of this book are invited to contribute to these web pages.
ment, scheduling theories, reuse, language design, kernel design, communication pro—
tocols, distributed and parallel architectures, and program code analysis. The aim of the
PREFACE xvii
http://www.cs.york.ac.uk/rts
for providing us with a stimulating environment and for many enlightening discussions,
particularly Lj erka Beus—Dukic, Geoff Davies, John McDermid, Gary Morgan, Rick
Pack, Rob Stone and Hussein Zedan.
During 1988 Alan Burns was on sabbatical at the Universities of Queensland and
’
Houston. We would like to thank all staff at these institutions particularly Andrew Lister,
Charles McKay and Pat Rogers.
This book would not have been possible without the use of electronic mail over
JANET. We would like to thank the Computer Board of the United Kingdom University
Grants Council and the Science and Engineering Research Council for providing this
invaluable service.
Finally we would like to give special thanks
Sylvia Holmes and Carol Burns. to
Sylvia for the many hours she has spent painstakingly proof reading the final manuscript,
and Carol for the many evenings she has tolerated our meetings and discussions.
Many people have helped in the production of the Second Edition of this book. In
particular we would like to thank: Alejandro Alonso, Angel Alvarez, Sergio Arevalo,
Neil Audsley, Martin Dorey, Michael Gonzalez Harbour, Stuart Mitchell, Gary Morgan,
Offer Pazy and Juan de la Puente.
We also wish to acknowledge the very helpful comments given by the technical
this edition.
would like to thank all those people who us comments on the
Finally, we gave
Second Edition of the book.
We would like to thank all those people who gave us comments on the Third Edition of
thebook, particularly Yolande Berbers. the other members of the
We also wish to thank
Ada Rapporteur Group, the Technical Interpretation Committee for the Real—TimeSpec-
ification for Java (particularly Peter Dibble), and the Java Expert Groups (J SR 282 and
301) for their help in understanding the nuances of Ada and Real—TimeJava. Sanjoy Ba-
rauh, Michael Gonzalez Harbour and Bev Littlewood have also given us invaluable help
with multiprocessor scheduling, Real—TimePOSIX and software reliability estimations,
respectively.
We would like to acknowledge the past and present members of the Real—Time
at York for their continuing contribution
presented.
to the material
Systems Group
Finally, a special thanks go to all the students who have taken our Real—Time
module of their degree course at York. Their continuous comments and
Systems as part
criticisms have helped keep us on our toes!
so
their range
of application widens. Built
initially as equation solvers, their influence has ex-
tended into all walks of life, from washing machines to air traffic control. One
of the fastest expanding areas of computer exploitation is that involving appli-
cations whose prime function is not that of information processing, but which
nevertheless require information processing in order to carry out their prime
function. A microprocessor-controlled washing machine is a good example of
such a system. Here, the prime function is to wash clothes; however, depending
on the type of clothes to be washed, different ‘wash programs’ must be exe-
cuted. These types of computer applications are generically called real-time or
embedded. It has been estimated that 99% of the worldwide production of mi-
croprocessors is used in embedded systems. These embedded systems place
particular requirements on the computer languages needed to program them,
as they have different characteristics from the more traditional information pro-
cessing systems.
This book is concerned with embedded computer and their
systems pro-
gramming languages. It studies the
particular characteristics of these systems
and discusses how modern real-time and
programming languages operating
systems have evolved. in order to give the chapters continuity, three program-
ming languages are considered in detail: Ada, Java and
languages C. These
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 empha-
size this, it will be referred to a C/Flea/-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
2 INTRODUCTION TO REAL-TIME SYSTEMS
world, and the output has to relate to that same movement. The lag from input
further definitions will be given. Young (1982) defines a real-time system to be:
In their most general sense, all these definitions cover a very wide range of com-
activities. For example, an operating system like Windows may be considered
puter
real-time in that when a user enters a command he or she will expect a response within
few seconds. it is usually not a disaster if the response is not forthcoming.
a Fortunately,
These of system can be distinguished from those where failure to respond can
types
be considered bad Indeed, for some, it is this aspect that
just as as wronga response.
others where response time is important but not
distinguishes a real-time system from
of real-time depends not only on the
crucial. Consequently, the correctness a system
also the time which the results produced.
logical result of the computation, but on at are
those where response times are important but the system will still function correctly if
missed. Soft systems can themselves be distinguished from
deadlines are occasionally
DEFINITION OF A REAL-TIME SYSTEM 3
tardiness). ‘
A deadline that can be missed occasionally, but in which there is no benefit from late
delivery, is called firm. In some real—timesystems, optional firm be
‘
components may
given probabilistic requirements (for example, a hard service must produce an output
every 300 ms; at least 80% of the time this output will be produced by a firm component,
X; on other occasions, a hard, but functionally much simpler component, Y, will be used).
In this book, the term ‘real—timesystem’
is used to mean both soft and hard real-
time. Where discussion is concerned specifically
with hard real—timesystems, the term
‘hard real—time’will be used explicitly.
In a hard or soft real—timesystem,
usually interfaced directly to the computer is
some physical equipment and is dedicated to monitoring or controlling the operation of
that equipment. A key feature of all these applications is the role of the computer as
system is typically concerned with relative times: an output has to be produced within 50
ms of an associated input. The key requirement of a reactive system is that it ‘keeps up
with the environment’.Often reactive systems are also control systems and hence they
need to be synchronized with their environment. In particular, input sampling and output
signalling must be done very regularly with controlled variability there is a need to —
activities. design
However, some approaches restrict the software
periodic and sporadic
ti1ne—triggered activities; ‘events’ must be polled for
architecture so that there are only
(that is, examined via a periodic activity).
Again, in this book a broad definition of ‘real—time system’ is assumed. The term
is taken to include reactive and time—awaresystems that may have both time—triggered
and event—triggered invocations of work. Periodic, aperiodic and sporadic activities are
now given.
larger engineering
in system occurred in the
The first use of
computer
a componentas a a
On detecting an increase in flow,the computer must respond by altering the valve angle;
this response must occur within a finite period if the equipment at the receiving end of
ineler
Flbw
Processing
Output valve
angle
Time
. Valve
Computer
Operator
console
Process
control
computer
ab
Chemicals
and
materials
1.2.2 Manufacturing
The use of computers in manufacturing has become essential in order that production
costs can be kept low andproductivity increased. Computers have enabled the integration
of the entire manufacturing process from product design to fabrication. It is in the area
of production control that embedded systems are best illustrated. Figure 1.3 diagram-
matically represents the role of the production control computer in the manufacturing
process. The physical system consists of a variety of mechanical devices such as ma- —
chine tools, manipulators and conveyor belts all of which need to be controlled
——
and
coordinated by the computer.
A modern manufacturing control system will employ a wide
range of robots. These
will again need to be controlled and coordinated, but they are also autonomous real-time
6 INTRODUCTION TO REAL—TIME SYSTEMS
Operator
console
Production
control
computer
in their own right. They have large numbers of sensors (for example proximity
systems
that need controlling and often vision subsystems that
indicators), many moving parts
require considerable computational power. When mobile robots and humans operate in
the then there are considerable safety issues that dictate that at least
same physical
space
part of the robots’ functions are hard real-time.
Command
and control
computer
Terminals Sensors/actuators
Engineering
lmerface
Algorithms for system
Reawme _"
digital control
clock
Remote
monitoring
Data logging System
Database
Data retrieval
and display
Operator
interface
the and
cognition of human users. There are clear requirements
determined by perception
on visual frame rates, sound/picture synchronization and response times (to, for example,
joystick movements) that must be satisfied if the quality of the human experience is not to
plication area for real-time systems, but such fixed systems are not the only commodities
under development. There is an increasing need to allow devices to be mobile whilst still
aid to personal security and/or surveillance and of course a camera and general—purpose
recording device. The one single defining p roperty of all mobile systems is that they are
indeed mobile batteries for And batteries have finite life which
they rely
—
on power.
adds to the challenges of developing these complex real-time systems.
CHARACTERISTICS OF REAL—TI_ME SYSTEMS 9
The local sensory system must, in this case, decide whether raw data or a processed .
'
(simpler) form of the data is fed into the digital world.
A cyber—physical system is likely to have real—timerequirements that range from
the millisecond level for the sensing activity to n1inutes or even hours for the applications
that are built upon the amalgamation of the dynamic and static data. It should be clear
to all readers, who have presumably spent time ‘on the net’,that the current internet
with its simple protocols and architecture cannot guarantee real—timebehaviour. Future
enhancements (or alternatives) to the internet are, however, likely to respond to the
challenges of cyber—physical systems and provide QoS (Quality of Service) that does
provide real—timeguarantees even if the guarantees
—
thereby ensuring that ‘worst—casebehaviour’ does not produce any unwelcome delays
during critical periods of the systems’
operations.
Given adequate processing power, language and 1un~time support are required to
and so on, or at regular intervals, for instance, every 5 seconds (with control systems,
rates from a few hundred hertz to several hundred megahertz). As a
sample can vary
result of these readings, other actions will need to be performed. In an electric power
station, it is necessary at 6 p.m. on Monday to Friday each week to increase the supply
of electricity to domestic consumers. This is in response to the peak in demand caused
families home from work, turning on lights, cooking dinner and so on. In
by returning
recent in the UK, the demand for domestic electricity reaches a peak immediately
years
after high—profile when millions of viewers leave their living rooms, turn
sporting events,
in the kitchen and switch on the kettle in order to make a cup of tea or coffee.
on lights
An example of a dynamic change to the timing requirements of a system can be
found in an aircraft flightcontrol system. If an aircraft has experienced depressurization,
there is an immediate need for all computing resources to be given over to handling the
to cruising all involve changes to the basic operation of the flight control system. These
known as mode changes, also have consequences for the
changes, which are generally
temporal characteristics of the executing software.
In order to meet response times, it is necessary for a system’s behaviour to be pre-
dictable. Chapters 9—l2 consider the facilities and techniques used to obtain predictable
program behaviour.
that these actions be carried outin sequence but give the illusion of being
usually may
simultaneous. In some embedded systems, however, this may not be the case, for example
CHARACTERISTICS OF REAL-TIME SYSTEMS 11
input data
For complicated systems, the input and output activities cannot be separated
more
from the computational part. Only during the computation activity itself will it be possible
to determine the external data that is needed (for example from another activity, a shared
database or from some interface into the environment).
In Chapters 4, 5 and 6, various models of concurrent programming are considered
in detail. Attention is then focused, in the following two chapters, on achieving reliable
communication and synchronization between concurrent processes in the presence of
design errors.
also interrupts to signal to the processor that certain operations have been
generate
performed or that error conditions have arisen.
In the interfacing to devices has either been left under the control of the oper-
past,
has the application to resort to assembly language
ating system, or required programmer
inserts to control and manipulate the registers and interrupts. Nowadays, because of the
variety of devices and the time—critical nature of their associated interactions, their control
must often be direct, and not through a layer of operating system functions. Furthermore,
reliability requirements argue against the use of low—level programming techniques.
Since real—timesystems are time~critical, efficiency of implementation will be
more important than in other systems. It is interesting that one of the main benefits
of using a high—level language is that it enables the programmer to abstract away from
reference)
with the desired
(or signal 1' (t) to produce an error signal, e(t). The
compared
controller uses this error vector to change the input variables to the plant, u (r). For a very
Figure 1.6 illustrates a feedback controller. This is the most common form, but
feed—forwardcontrollers are also used. In order to calculate what changes must be made
Controller \x90-\xC9
to the input variables, so that a desirable effect on the output vector takes place, it is
necessary to have a mathematical model of the plant. The derivation of these models is
the concern of the distinct discipline of control theory. Often a plant is modelled as a set
of first—orderdifferential equations. These link the output of the system with the internal
State of the plant and its input variables. Changing the output of the plant involves solving
these equations to give required input values. Most physical systems exhibit inertia, so ,
leaves the company or institution using the software, then someone else can learn
person
the program in a relatively short period of time. Indeed, for these programs, there is an
art craft
or to their construction and small
beautiful. is
not all software exhibits this most desirable characteristic of small-
Unfortunately,
ness. Lehman and Belady (1985), in attempting to characterize large systems, reject the
and intuitive notion that largeness is simply proportional to attributes
simple perhaps
such as: the number of instructions, lines of code or modules making up a program and
to algorithmic complexity. Instead, they relate largeness to variety, and the degree of
to the amount of variety. Traditional indicators such as number of instructions
largeness
and development effort are, therefore, just symptoms of variety.
The is that of needs and activities in the real world and their reflection
variety
in a But continuously
the real world changing.
is It is evolving. So
program.
too are, therefore, the needs and activities of society. Thus large programs,
like all complex systems, must continuously evolve.
The more society relinquishes control of its vital functions computers, the more
to
it becomes that those computers do not fail. The failure of a system involved
imperative
in automatic fund transfer between banks can lead to millions of dollars being lost
in electricity generation could result in the failure of
irretrievablyg faulty component
a
These somewhat dramatic examples illustrate that computer hardware and software must
be reliable and safe. Even in hostile environments, such as those found in military
be to design and implement systems that will fail only in a
applications, it must possible
controlled Furthermore, where operator interaction is required, care must be taken
way.
in the design of the interface in order to minimize the possibility of human error.
The sheer size and complexity of real—timesystems exacerbate the reliability prob-
lem; not only must expected difficulties inherent in the application be taken into account,
In
Chapters 2 and 3, the problems of producing reliable and safe software will be
considered along with the facilities that languages have introduced to with both
cope
expected and unexpected error conditions. The issue is examined further in Chapters 7
and 13.
with the role of the execution environment in providing efficient and predictable imple-
mentations.
Finally in Chapter 15 a case Study, that brings together many of the key issues of
the book, is developed.
The remainder of this introductory chapter outlines number of other
important a
issues whose detailed consideration is nevertheless beyond the scope this book. In partic-
ular the development cycle (i.e. requirements specification, design, implementation and
testing) is introduced and a number of general language topics are summarized. These
discussions provide the backdrop to the detailed treatments in the following chapters and
help deal with the size and complexity problems inherent in the development of most
real—timesystems.
considered in detail. Readers should consult the further reading list at the end of this
This section brief overview of some of the typical stages that are passed
code. gives a
0
requirements specificationduring which —
an authoritative specification
of the
0 architectural design —
As different activities are isolated, notations are required that enable each stage
to be documented. Transformations from one stage nothingto another are, therefore,
more than translations from one notation to another. For example, a compiler produces
executable code from source code that is expressed in a programming language. Unfor—
other translations (further the design hierarchy) are less well defined; usually
tunately, up
because the notations employed are too vague and imprecise, and cannot fully capture
the semantics of the requirements or of the design.
Linked to notations are the models that can be expressed in these languages.
driven architectures (MDA). Here formal notations are used to develop models of the
that can then be subject to verification.Techniques such as model—checlmodel—checl and
systems
mechanical used to increase the designer’s confidence that the systems once
proof are
be the right approach for the future for relatively straightforward systems. However, the
current state of these MDA approaches is not sufficiently advanced for general real—time
that the functionality of the system is defined. In terms of specific real—timefactors, the
behaviour of the should be made quite explicit, as should the reliability
temporal system
and the desired behaviour of the software in the event of component failure.
requirements
The requirements phase will also define which acceptance tests should apply to the
software.
DEVELOPMENT CYCLE FOR REAL-TIME SYSTEMS 17
The design of a large embedded system cannot be undertaken in one exercise. It must be
structured in some way. To manage the development of complex real-time systems, two
complementary approaches are often used: decomposition and abstraction. Together,
they form the basis of most software engineering methods.
Decomposition, as its name
suggests, involves the systematic breakdown of the complex system into smaller and
smaller parts until components are isolated that can be understood and engineered by
’
form of task (process). The task abstraction is, therefore, the abstraction on which this
book will focus. In Chapter 4, the notion of task is introduced, Chapter 5 then con-
siders shared—variable
based tasks interaction. A more controlled and abstract interface
Chapter 6.
Both object and task abstractions are important in the design and implementation
of reliable embedded systems. These forms of encapsulation lead to the use of modules
with well—defined(and abstract) interfaces. From the definition of modules, more sizeable
the answer to this question lies at the heart of all software design activities. Cohesion
and coupling are two metrics that are often used to describe the relationships between
entities within a design (in the following, the term ‘module’ is used for a distinct software
entity).
Cohesion is concerned with how well a module holds together —
its internal
Allworth and Zobel (1987) give six measures of cohesion that from
strength. range
the very poor to the strong.
0 Coincidental —
elements of the module are not linked other than in a very super-
ficial way; for example, written in the same month.
0
Logical —
elements of the module are related in terms of the overall system, but
not in terms of the actual software; for example all output device drivers.
o
Temporal —
o Procedural ~
elements of the module are used together in the same section of the
system.
Coupling, by comparison, is
interdependence
a measure of program modules.
of the
If two modules pass control information between them, they are said to possess high
(or tight) coupling. Alternatively, the coupling is loose if only data is communicated.
Another way of looking at coupling is to consider how easy it would be to remove a
Within all design methods, a good decomposition is one that has strong cohesion
and loose coupling. This principle is equally true in sequential and concurrent program-
ming domains.
It was noted earlier that most real-time practitioners advocate the use of ob-
and task (process) abstractions. Formal techniques do exist that enable concurrent
ject
time-constrained systems to be specified and analysed. Nevertheless, these techniques
are not yet sufficiently mature to constitute ‘tried and tested’ design methods. Rather, the
real-time industry uses, at best, structured methods and software engineering approaches
that are applicable to all information processing systems. They do not give specific
DEVELOPMENT CYCLE FOR REAL-TIME SYSTEMS 19
support to the real—timedomain, and they lack the richness that is needed if the full
power of implementation languages is to be exploited.
With thehigh reliability requirements that are the essence of most real—timesystems, it
is clear that testing must be extremely stringent. A comprehensive strategy for testing
involves many techniques, most of which are applicable to all software products. It is,
therefore, assumed that the reader is familiar with these techniques.
The difficulty with real—timeconcurrent programs is that the most intractable sys-
tem errors are usually the result of subtle interactions between tasks. Often the errors are
also time-dependent and will only manifest themselves in rare states. Murphy’s Law dic-
tates that these rare states are also crucially important and only occur when the controlled
system is, in some sense, critical.
Testing is, of course, not restricted to the final assembled system. The decom-
position incorporated in the design and manifest within program modules (including
tasks) forms a natural architecture for component testing. Of particular importance (and
difficulty) within real—timesystems is that not only must correct behaviour in a correct
environment be tested, but dependable behaviour in an arbitrarily incorrect environ-
ment must be catered for. All error recovery paths must be exercised and the effects of
simultaneous errors investigated. ,
To assist in any complex testing activity, a realistic test bed presents attrac-
many
tions. For software, such a test environment is called a simulator.
A simulator is a program which imitates the actions of theengineering system in
which the real—timesoftware is embedded. It simulates the generation of interrupts and
performs other I/O actions in real—time.
Using a simulator, abnormal as well as ‘normal’
system behaviour can be created. Even the final system has been completed, certain
when
error states may only
safely be experimented with via a simulator. The meltdown of
a
1.4.4 Postscript
In many ways, this discussion
design issues has been a divergent one. It has introduced
on
more problem areas and engineering issues than can possibly be tackled in just one book.
This broad sweep across the ‘design process’ is aimed at setting the restof the book in
context. By now focusing on language issues and programming activities, the reader
will be able to understand the ‘end product’ of design, and judge to what extent current
still a very active research area. Although systems design should lead naturally into
the expressive of most modern languages is not matched by
implementation, power
methodologies. Only by understanding what is possible at the implemen-
current design
tation stage can appropriate design approaches be developed.
It is possible to identify three classes of programming languages which are, or have
been, used in the development of real—time systems. These are assembly languages, se-
Security
The of language design is a measure of the extent to which programming errors
security a
is limit to the type and number of errors that can be detected by a language
obviously a
system; for
example, errors in the programmer’s logic cannot be detected automatically.
well structured and readable that such
A secure language must, therefore, be so errors
generating
an overall reduction in cost;
o no
Readability
The of language depends on a variety of factors including the appro-
readability a
priate choice of keywords, the ability to define types and the facilities for program
LANGUAGES FOR PROGRAMMING REAL—TlME SYSTEMS 21
The main disadvantage is that it usually increases the length of any given program.
Flexibility
»
A language must be sufficiently flexible to allow the programmer to express all the
required operations in a straightforward and coherent fashion. Otherwise, as with older
sequential languages, the programmer will often have to resort to operating system ,
'
commands or machine code inserts to achieve the desired result.
Simplicity
Simplicity is a worthwhile aim of any design, be it of the international space station or
o
minimizing the effort required to produce compilers;
o
reducing the cost associated with programmer training;
0
diminishing the possibility of making programming errors as a result of misinter-
pretation of the language features.
Portability
A program, to a certain extent, should be independent of the hardware on which it ex-
ecutes. One of the main claims of Java is that programs are compiled once and run
anywhere. For a real—timesystem, this is difficult to achieve (even with the advent of
portable binary codes, such as Java Byte Code and ANDF (Venners, 1999; X/Open
Company Ltd, 1996)), as a substantial part of any program will normally involve
manipulation of hardware resources. However, a language must be capable of isolat—
ing the maclzine—clependentpart of a program from the mac/zine—independenrpart.
22 INTRODUCTION TO REAL-TIME SYSTEMS
Efficiency
In real—timesystem, times must be guaranteed; therefore the language must
a response
efficient and to be produced. Mechanisms which lead to
allow programs predictable
run—timeoverheads should be avoided. Obviously, efficiency requirements
unpredictable
must be balanced against security, flexibility and readability requirements.
The main with the of assembly languages is that they are machine-
problem use
with
oriented rather than problem—oriented.
The programmer can become encumbered
details which are unrelated to the algorithms being programmed, with the result that the
themselves become obscure. This keeps development costs high and makes
algorithms
difficult to when errors are found or enhancements required.
it very modify programs
Further difficulties arise because programs cannot be moved from one machine to
another but must be rewritten. Also staff must be retrained if they are required to work
the United States Air Force, for example, Jovial was in common use. In the UK, the
of Defence standardized on Coral 66, and large industrial concerns like ICI
Ministry
standardized on RTL/2. Currently, the C and C++ programming languages are popular.
All these languages have one thing in common they are sequential. They also —
tend to be weak in the facilities they provide for real—time control and reliability. As a
In spite of the
increasing application—tailored
use languages,
of the production of com-
o
Reliability software is unreliable and will often fail to perform to its specification.
~
0 Cost —
software in one
system is seldom used in another.
o
Efficiency software —
involved.
Perhaps one of the best illustrations of the impact of the software crisis can be found in
the American Department of Defense’s (DOD) search for a common high-order program-
ming language for all its applications. As hardware prices began to fall during the 1970s,
the DoD’s attention was focused on the rising cost of its embedded software. It estimated
that, in 1973, three thousand million dollars were spent on software alone. A survey of
programming languages showed that at least 450 general-purpose programming lan-
guages and incompatible dialects were used in DoD embedded computer applications.
An evaluation of existing languages occurred in 1976 against an emerging set of require-
ments. These evaluations resulted in four main conclusions (Whitaker, 1978):
The result was the birth of a new language in 1983 called Ada. In 1995, the language
was updated to reflect 10 years of use and modern advances in programming language
design. The same occurred in 2005 when a number of key features were added to Ada.
Other older
languages of note include PEARL, used extensively in Germany for
process control applications, Mesa (Xerox Corporation, 1985), used by Xerox in their of-
fice automation equipment, and CHILL (CCITT, 1980) which was developed in response
to CCITT requirements for programming telecommunication applications.
With the advent of the Internet, the Java programming language has become pop-
ular. Although initially not suitable for real—timeprogramming, recently much effort has
been dedicated to producing real—timeversions of Java this will be discussed at length —
Summary
In this chapter, a real—timesystem has been defined as:
any information
processing activity or system which has to respond to
externally generated input stimuli within a finite and specified delay.
Two main classes of such systems have been identified: hard real—timesys-
tems, where it is absolutely imperative that responses occur within the specified
24 INTRODUCTION TO REAL—TH\/IE SYSTEMS
Hard
Criticality of
80“
deadlines
Classification Firm
Time-aware
Role of time
Reactive
Dead|ine/latency
Periodic/sporadic/
aperiodic
Rea|~time —-—
Time-triggered
Structure
e—[ Event-triggered
Real-time facilities
Concurrent
Numerical computations
Interaction with
——-—
Characteristics
hardware devices
deadline; and soft real-time systems, where response times are important, but
the system will still function correctly if deadlines are occasionally missed. Vari-
ous types of real-time systems have been introduced including reactive systems
and time-aware systems, also time-triggered and event-triggered systems.
FURTHER READING 25
0 real-time control;
o concurrent control of separate system components;
o low-level programming;
o
support for numerical computation;
o
iargeness and complexity;
. extreme reliability and safety.
The main aspects associated with the term ‘real-time’ that have been
introduced in this chapter are illustrated
Figure 1.8 opposite. in
This chapter has also outlined the major stages involved in the design and
implementation of real—timesystems. These include requirements specification,
systems design, detailed design, coding and testing. The high reliability require-
ments of real-time systems dictate that, wherever possible, rigorous methods
should be employed. '
expressive power to deal adequately with this application domain. More recent
languages have attempted to incorporate concurrency and error-handling facil-
ities. A discussion of these features is contained in subsequent chapters. The
following general criteria were considered a useful basis for a real-time language
design: security, readability, flexibility, simplicity, portability and efficiency.
Further reading
Bailey, D. L. and Buhr, R. J. A. (1998) Introduction to Real-Time Systems: From Design.
to Networking with C/C++. Upper Saddle River, NJ: Prentice Hall.
Wiley.
Exercises
1.1 To what extent should the choice of a design method for real-time systems be
influenced by:
1.6 Should the Ada language be the only language used in the implementation of
embedded real-time systems?
1.7 To what extent does UML allow hard real-time systems to be designed and
analysed‘?
Chapter 2
Reliability and safety requirements usually much more stringent for real-time
are
and embedded systems than for other computer systems. For example, if an ap-
plication which computes the solution to some scientific problem fails then it may
be reasonable to abort the program, as only computer time has been lost. How-
ever, in the case of an embedded system, this may not be an acceptable action.
A process control computer, for instance, responsible for the operation of a large
gas furnace, cannot afford to close down the furnace as soon as a fault occurs.
Instead, it must try to provide a degraded service and prevent a costly shutdown
operation. More importantly, real-time computer systems may endanger human
lives if they abandon control of their application. An embedded computer con-
trolling a nuclear reactor must not let the reactor run out of control, as this may
result in a core meltdown and an emission of radiation. A military avionics system
should at least allow the pilot to eject before permitting the plane to crash!
it is now widely accepted that the society in which we live is totally depen-
dent on the use of computer~based systems to support its vital functions. It is,
therefore, imperative that these systems do not fail. Without wishing to define
precisely what is meant by a system failure or a fault (at the moment), there are,
in general, four sources of faults which can result in an embedded system failure.
Included in this category are those faults that stem from misunderstanding
the interactions between the program and the environment.
fault tolerance.
Before proceeding, more precise definitionsof reliability, failures and faults are neces-
a measure of the success with which the system conforms to some authori-
tative specification
of its behaviour.
Section 2.9 will deal with the metrics of reliability; for the time being, liiglily reliable
will be considered synonymous with a lowfailure rate.
The alert reader will have noticed that our definitions,
so far, have been concerned
with the behaviour of a system; that is, its external appearance. Failures result from
internal to the system which eventually manifest themselves in
unexpected problems
the system’s external behaviour. These problems are called errors and their mechanical
termed faults. A faulty component of a system is, therefore,
or algorithmic causes are
a component which, under a particular set of circumstances during the lifetime of the
will result in an error. Viewed in terms of state transitions, 21 system can be
system,
considered as a number of external and internal states. An external state‘ which is not
RELIABILITY, FAILURE AND FAULTS 29
specified
in the behaviour of the system is regarded as a failure of the system. The
system itself consists of a number of components, each with their own states, all of which
contribute to the system’s
external behaviour. The combined states of these components
termed the internal
are of the system. An internal
state state which is not specified
is
called an error and the component which produced the transition is said to
illegal state
be faulty.
A fault is active when it produces and until this
an error, point it is dormant. Once
produced, the error can be transformed into other errors via the computational process as
it propagates through the system. Eventually, the error manifests itself at the boundaries
of the system causing a service
delivery to fail (Avizienis et al., 2004).
Of course, is
usually composed of components; each of these may be
a system
considered as a system in its own
right. Hence a failure in one system will lead to a fault
in another which will result in an error and potential failure of that system. This in turn
will introduce a fault into any surrounding system and so on (as illustrated in Figure 2.1). »
There are many different classificationsof fault types depending on the aspect of
interest. For example, whether they are created during development or during operations,
whether they are intentionally or accidentally created, whether they are hardware or
software in origin, etc. From a real—timeperspective, the duration of the fault is one of
the most important aspects. Three types of fault can be
distinguished.
occurs a
become active at any time. Examples of such faults occur in hardware components
which have an adverse reaction to some external interference, such as electrical
fields or radioactivity. After the disturbance disappears does the fault
so (although
not necessarily the induced error). Many faults in communication systems are
transient.
‘The names come from analogies with physics. The assertion that software
most production bugs are
ephemeral ~
0 Bohrbugs —
these bugs are reproducible and usually identifiable. Hence they can
easily be removed during testing. If they cannot be removed, then design diversity
techniques can be employed during operation (see Section 2.4).
o Heisenbugs —
these are software bugs that only activate under certain rare cir-
cumstances. good example is code shared between
A concurrent tasks that is not
the code
properly synchronized. Only when two tasks happen to execute concur-
rently will the fault activate and even then the error may long way
propagate a
from its source before it is detected. Because of this, they often disappear when
investigated —
assumed that it would only operate for a few hours at one location. During the Gulf
War it was used continuously for many hours. Its main battery could last for 100 hours.
After the Patriot’s radar detects an airborne object that has the characteristics of a Scud
missile, the range gate (an electronic detection device within the radar system) calculates
an area in the air space where the system should next look for the detected missile. The
range gate filters out information about airborne objects outside its calculated area and
the information needed for tracking, targeting and intercepting Scuds.
only processes
object within the calculated gate area confirms that it is a Scud missile. In
Finding an range
1991, Patriot missile defence system failed to track and intercept an incoming
February a
range gate’s prediction software, which used the Scud’s velocity and the time of the last
radar detection. Time is kept continuously by the system’s internal clock in tenths of
seconds held as an integer variable. The longer the system has been running, the larger
the number representing time. To predict where the Scud will next appear, both time and
must be expressed as real numbers. The registers in the Patriot computer are
velocity
24 bits and the conversion of time results in a loss of precision causing a less
only long,
accurate time calculation. The effect of this inaccuracy on the range gate’s calculation is
directly proportional to the target’s velocity and the length of time the system has been
Consequently, performing the conversion after the Patriot has been running
running.
for extended periods causes the gate to shift away from the centre of
continuously range
the target, making it less likely that the target missile will be successfully intercepted.
Table 2.1 shows the effect of this inaccuracy. After 20 hours, the target becomes outside
the range gate. As with all software ageing problems, restarting the system (in this case
before 20 hours of continual operational time) would clear the problem.
FAILURE MODES 31
Table 2.1 Effect of extended run—timeon Patriot operation (taken from http://www.fas.org/
spp.starwars/gao/im92026.htm).
To create reliable systems, all types of fault must be prevented from causing erro—
neous system behaviour (that is failure). The difficulty this presents is compounded by
the indirect use of computers safety—critical
in the construction
systems. For example, of
in 1979 an error was discovered in a program used to design nuclear reactors and their
supporting cooling systems. The fault that this caused in the reactor design had not been
found during installation tests as it concerned the strength and structural support of pipes 2
and valves. The program had supposedly guaranteed the attainment of earthqual earthqual
safety
standards in operating reactors. The discovery of the bug led to the shutting down of five
nuclear power plants (Leveson, 1986).
0 value failure —
http://klabs.org/richcontent/Reports/Failure_Reports/ariane/ariane501 .htm.)
32 RELIABILITY AND FAULT TOLERANCE
Failures in the time domain can result in the service being delivered:
too early —
One further failure mode should be identified, which is where a service is delivered
that is not expected. This is often called a commission or impromptu failure. It is, of
course, often difficult to distinguish a failure in both the value and the time domain from
a commission failure followed by an omission failure. Figure 2.2 illustrates the failure
mode classification.
Given the above classification of failure modes, it is now possible to make some
Fail uncontrolled —
a system which produces correct services in the value domain but may
suffer from a ‘late’ timing error.
Fail which has all the properties of fail silent, but also permits
stop system —
Fail controlled -«
Fail never —
Other assumptions and classificationsare clearly possible, but the above list will suffice
for this book.
Failure mode
Much light has been thrown upon the cause of death by Richet’s
experiments.[437] It would seem that, in some cases, death takes
place by a suffocation as complete as in drowning, the chest and
diaphragm being immovable, and the nervous respiratory centres
exhausted. In such a case, immediate death would be averted by a
tracheal tube, by the aid of which artificial respiration might be
carried on; but there is another asphyxia due to the enormous
interstitial combustion carried on by muscles violently tetanised. “If,”
says Richet, “after having injected into a dog a mortal dose of
strychnine, and employed artificial respiration according to the
classic method twenty or thirty times a minute, the animal dies
(sometimes at the end of ten minutes, and in every case at the end
of an hour or two), and during life the arterial blood is examined, it
will be ascertained that it is black, absolutely like venous blood.”
[447]1 grm. of strychnine gave 1·280 grms. of the chromate, = 78·1 per
cent. of strychnine; 3 gave 3·811 of the chromate, = 78·77 per cent. of
strychnine.—Mohr.
[451] Dr. C. Plugge, Arch. f. exp. Path. u. Ph., Bd. xxxii. 313.
Hypaphorine forms colourless crystals which brown, without melting, above 220°,
and exhale a vapour smelling like napththylamine. The free alkaloid is soluble in
water, but has no action on litmus. The salts are less soluble than the free alkaloid,
so that acids, such as nitric or hydrochloric, produce in a short time precipitates on
standing. Solutions of the salts are not precipitated by alkalies; chloroform, ether,
benzene, all fail to extract it from either alkaline or acid solutions. It gives no
precipitate with potassic chromate, but most general alkaloidal reagents
precipitate.
It gives a precipitate with iodine trichloride, and has therefore probably a pyridine
nucleus, it may be an acid anilide.[452] It gives the same colours as strychnine with
sulphuric acid and potassic permanganate or potassic chromate; it causes in frogs
tetanus, but the dose has to be much larger than that of strychnine. The duration
of life in doses of 15 mgrms. may extend to five days, and frogs may even recover
after 50 mgrms.
Julius Tafel (Ber., 1890, 412) has shown that the colour reactions with
[452]
H2SO4 and oxidising agents are the characteristic tests of an acid anilide.
Minimum Lethal
Dose for every Proportional
Kilogram Weight Strength.
of Rabbit.
Mgrms.
Strychnine nitrate, 0·6 ...
Thebaine nitrate, 14·4 24·0
Brucine nitrate, 23·0 38·33
Landanine nitrate, 29·6 49·33
Codeine nitrate, 51·2 85·33
Hydrocotarnine nitrate, 203·8 339·66
If these views are correct, it follows that the least fatal dose for an
adult man would be 1·64 grm. (about 24·6 grains) of brucine nitrate.
Brucine Crystals. (From a Photograph.)
It is said to be poisonous, its action being similar to that of strychnine and brucine,
and in activity standing midway between the two.
§ 405. Strychnic Acid.—Pelletier and Caventou obtained by boiling with spirit small,
hard, warty crystals of an organic acid, from S. ignatius, as well as from nux
vomica seeds. The seeds were first exhausted by ether, the alcohol solution was
filtered and evaporated, and the extract treated with water and magnesia, filtered,
and the residue first washed with cold water, then with hot spirit, and boiled lastly
with a considerable quantity of water. The solution thus obtained was precipitated
with acetate of lead, the lead thrown out by SH2, and the solution evaporated, the
acid crystallising out. It is a substance as yet imperfectly studied, and probably
identical with malic acid.
[458] See Liebig’s Annal., 211, 249-282; Ber. der deutsch. Chem.
Gesellsch., 11, 2189; 12, 1560.
3. PEREIRINE.
§ 407. Pereirine—an alkaloid from pereira bark—gives a play of colours with
sulphuric acid and potassic bichromate similar to but not identical with that of
strychnine. Fröhde’s reagent strikes with it a blue colour. On dissolving pereirine in
dilute sulphuric acid, and precipitating by gold chloride, the precipitate is a
beautiful red, which, on standing and warming, is deepened. Pereirine may be
extracted from an acid solution, after alkalising with ammonia, by ether or
benzene.
4. GELSEMINE.
Sulphuric acid dissolves gelsemine with a reddish or brownish colour; after a time
it assumes a pinkish hue, and if warmed on the water-bath, a more or less purple
colour; if a small crystal of potassic bichromate be slowly stirred in the sulphuric
acid solution, reddish purple streaks are produced along the path of the crystal;
ceric oxide exhibits this better and more promptly, so small a quantity as ·001
grain showing the reaction. This reaction is something like that of strychnine, but
nitric acid causes gelsemine to assume a brownish-green, quickly changing to a
deep green—a reaction which readily distinguishes gelsemine from strychnine and
other alkaloids.
§ 409. Fatal Dose.—10 mgrms. killed a frog within four hours, and 8 mgrms. a
cat within fifteen minutes. A healthy woman took an amount of concentrated
tincture, which was equivalent to 11 mgrms. (1⁄6 grain), and died in seven and a
half hours.
§ 410. Effects on Animals—Physiological Action.—Gelsemine acts powerfully
on the respiration; for example, Drs. Sydney Ringer and Murrell[461] found, on
operating on the frog, that in two minutes the breathing had become distinctly
slower; in three and a half minutes, it had been reduced by one-third; and in six
minutes, by one-half; at the expiration of a quarter of an hour, it was only one-
third of its original frequency; and in twenty minutes, it was so shallow and
irregular that it could no longer be counted with accuracy. In all their experiments
they found that the respiratory function was abolished before reflex and voluntary
motion had become extinct. In several instances the animals could withdraw their
legs when their toes were pinched, days after the most careful observations had
failed to detect the existence of any respiratory movement. The heart was seen
beating through the chest wall long after the complete abolition of respiration.
See Lancet, 1873, vol. ii. p. 475; Brit. Med. and Surg. Journ., April
[462]
1869; Phil. Med. and Surg. Reporter, 1861.
5. COCAINE.
Benzoic
Cocaine. acid. Ecgonin. Alcohol.
C17H21NO4 + 2H2O = C6H5COOH + C9H15NO3 + CH3OH.
Cocaine is but little soluble in water, but easily dissolves in ether, alcohol, benzene,
chloroform, and carbon disulphide; an aqueous solution is alkaline to methyl-
orange, but not to phenol-phthalein. It can be made synthetically by the reaction
of ecgonin-methyl-ester with benzoyl chloride.
6. CORYDALINE.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookball.com