Real-Time Java Platform Programming - Dibble_ Peter C_.pdf
(
2003 KB
)
Pobierz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Real-Time Java™ Platform Programming
By
Peter C. Dibble
Publisher : Prentice Hall PTR
Pub Date : March 11, 2002
ISBN : 0-13-028261-8
Pages : 352
Table of
Contents
Written for experienced Java platform developers, this practical guide provides a solid
grounding in real-time programming. Dibble, a member of the RTSJ expert group, starts
with an overview of real-time issues unique to the Java platform. He then explains how to
use each major feature of the RTSJ.
From broad real-time principles to detailed programming pitfalls, Real-Time Java
Platform Programming covers everything you need to know to build effective RT
programs. Key topics include:
•
Interoperability with non-RT code, tradeoffs in real-time development, and RT
issues for the JVMtm software
•
Garbage collection, non-heap access, physical and "immortal" memory, and
constant-time allocation of non-heap memory
•
Priority scheduling, deadline scheduling, and rate monotonic analysis
•
Closures, asynchronous transfer of control, asynchronous events, and timers
Team-Fly
®
Table of Content
Table of Content
...................................................................................................................i
Copyright
.............................................................................................................................. v
Preface
................................................................................................................................vi
Introduction
........................................................................................................................vii
Chapter 1. Landscape
........................................................................................................ 1
Java Technology and Real Time
.................................................................................. 1
Definition of Real Time
.................................................................................................. 3
Java's Problem Domain
................................................................................................. 8
Real-Time Java's Problem Domain
............................................................................. 9
Summary
........................................................................................................................ 10
Chapter 2. Architecture of the Java Virtual Machine
................................................... 11
Write Once, Run Anywhere—Maybe
......................................................................... 11
JVM Components
......................................................................................................... 12
Interpreter Implementation
.......................................................................................... 23
Chapter 3. Hardware Architecture
.................................................................................. 28
Worst-Case Execution of One Instruction
................................................................. 28
Management of Troublesome Hardware
.................................................................. 32
Effects on the JVM
....................................................................................................... 33
Chapter 4. Garbage Collection
....................................................................................... 35
Reference Counting
..................................................................................................... 35
Basic Garbage Collection
............................................................................................ 35
Copying Collectors
....................................................................................................... 39
Incremental Collection
................................................................................................. 41
Generational Garbage Collection
............................................................................... 44
Real-Time Issues
.......................................................................................................... 45
Chapter 5. Priority Scheduling
........................................................................................ 46
Scheduling Terms
......................................................................................................... 46
Execution Sequences
.................................................................................................. 46
Preemption
.................................................................................................................... 47
Fixed versus Dynamic Priority
.................................................................................... 49
Priority Inversion
........................................................................................................... 49
Why 32 Priorities?
........................................................................................................ 52
Problems with Priority Scheduling
............................................................................. 53
Chapter 6. Scheduling with Deadlines
........................................................................... 55
Underlying Mechanism
................................................................................................ 55
Scope of the Scheduler
............................................................................................... 56
Some Systems
.............................................................................................................. 56
Timing Is Usually Probabilistic
.................................................................................... 63
Chapter 7. Rate Monotonic Analysis
.............................................................................. 65
Theorems
....................................................................................................................... 65
Restrictions
.................................................................................................................... 71
Chapter 8. Introduction to the Real-Time Java Platform
............................................ 74
A Brief History of Real-Time Java
.............................................................................. 74
Major Features of the Specification
........................................................................... 76
Implementation
............................................................................................................. 80
RTSJ Hello World
......................................................................................................... 80
Chapter 9. Closures
.......................................................................................................... 82
The Language Construct
............................................................................................. 82
Java Closures
............................................................................................................... 82
Limitations of Closures
................................................................................................ 84
Chapter 10. High-Resolution Time
................................................................................. 87
Resolution
...................................................................................................................... 87
ii
The "Clock"
.................................................................................................................... 87
HighResolutionTime Base Class
................................................................................ 88
Absolute Time
............................................................................................................... 89
Relative Time
................................................................................................................ 90
Rational Time
................................................................................................................ 90
Chapter 11. Async Events
............................................................................................... 92
Binding a Happening to an Event
.............................................................................. 92
Basic Async Event Operation
..................................................................................... 93
Async Events without Happenings
............................................................................ 95
Implementation Discussion
....................................................................................... 100
Chapter 12. Real-Time Threads
................................................................................... 102
Creation
........................................................................................................................ 102
Scheduling
................................................................................................................... 106
Periodic Threads without Handlers
.......................................................................... 110
Periodic Threads with Handlers
............................................................................... 115
Interactions with Normal Threads
............................................................................ 122
Changing the Scheduler
............................................................................................ 123
Chapter 13. Non-Heap Memory
................................................................................... 131
The Advantage of Non-Heap Memory
..................................................................... 131
The Allocation Regimes
............................................................................................. 132
Rules
............................................................................................................................. 133
Mechanisms for Allocating Immortal Memory
........................................................ 134
Mechanisms for Allocating from Scoped Memory
................................................. 136
Using Nested Scoped Memory
................................................................................. 142
Using Shared Scoped Memory
................................................................................ 154
Fine Print
...................................................................................................................... 165
Quick Examples
.......................................................................................................... 166
Chapter 14. Non-Heap Access
..................................................................................... 169
Interaction with Scheduler
......................................................................................... 169
Rules
............................................................................................................................. 170
Samples
....................................................................................................................... 171
Final Remarks
............................................................................................................. 174
Chapter 15. More Async Events
................................................................................... 176
Async Events and the Scheduler
............................................................................. 176
The createReleaseParameters Method
.................................................................. 176
Bound Async Event Handlers
................................................................................... 177
Async Event Handlers and Non-Heap Memory
..................................................... 177
No-Heap Event Handlers vs. No-Heap Threads
................................................... 177
Scheduling
................................................................................................................... 178
Async Event Handlers and Threads
........................................................................ 179
Special Async Events
................................................................................................ 179
Chapter 16. Reusing Immortal Memory
...................................................................... 180
Using Fixed-Object Allocators
.................................................................................. 180
Recycling RT Threads
............................................................................................... 181
Recycling Async Event Handlers
............................................................................. 186
Chapter 17. Asynchronous Transfer of Control
.......................................................... 189
Thread Interrupt in Context
....................................................................................... 190
Asynchronous Interrupt Firing
.................................................................................. 191
Rules for Async Exception Propagation
.................................................................. 197
Noninterruptible Code
................................................................................................ 206
Legacy Code
............................................................................................................... 209
Use of ATC for Thread Termination
........................................................................ 209
Chapter 18. Physical Memory
....................................................................................... 211
Physical and Virtual Memory
.................................................................................... 212
iii
Physical Memory Manager
........................................................................................ 212
Immortal Physical Memory
........................................................................................ 215
Scoped Physical Memory
.......................................................................................... 216
Chapter 19. Raw Memory Access
................................................................................ 217
Security
........................................................................................................................ 218
Peek and Poke
............................................................................................................ 218
Get/Set Methods
......................................................................................................... 219
Mapping
....................................................................................................................... 221
The RawMemoryFloatAccess Class
........................................................................ 222
Chapter 20. Synchronization without Locking
............................................................ 224
Principles of Wait-Free Queues
............................................................................... 226
The Wait-Free Write Queue
...................................................................................... 227
The Wait-Free Read Queue
...................................................................................... 229
The Wait-Free Double-Ended Queue
...................................................................... 230
No-Wait Queues and Memory
.................................................................................. 231
Implementation Notes
................................................................................................ 232
Chapter 21. Recommended Practices
......................................................................... 233
Powerful and Easy-to-Use Features of the RTSJ
................................................. 233
Very Powerful and Dangerous Features of the RTSJ
........................................... 234
Very Powerful and Finicky Features of the RTSJ
.................................................. 235
Selection of Priorities
................................................................................................. 236
Index
................................................................................................................................. 239
Symbol .......................................................................................................................... 239
A.................................................................................................................................... 239
B .................................................................................................................................... 239
C .................................................................................................................................... 240
D.................................................................................................................................... 240
E .................................................................................................................................... 241
F..................................................................................................................................... 241
G.................................................................................................................................... 241
H.................................................................................................................................... 242
I ..................................................................................................................................... 242
J ..................................................................................................................................... 242
K.................................................................................................................................... 242
L .................................................................................................................................... 242
M ................................................................................................................................... 242
N.................................................................................................................................... 243
O.................................................................................................................................... 243
P..................................................................................................................................... 244
R .................................................................................................................................... 244
S..................................................................................................................................... 244
T .................................................................................................................................... 246
V.................................................................................................................................... 246
W ................................................................................................................................... 246
iv
Copyright
© 2002 Sun Microsystems, Inc.—
Printed in the United States of America.
901 San Antonio Road, Palo Alto, California
94303 U.S.A.
All rights reserved. This product and related documentation are protected by copyright and
distributed under licenses restricting its use, copying, distribution, and decompilation. No part of
this product or related documentation may be reproduced in any form by any means without prior
written authorization of Sun and its licensors, if any.
RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the United States
Government is subject to the restrictions set forth in DFARS 252.227-7013 (c)(1)(ii) and FAR
52.227-19.
The products described may be protected by one or more U.S. patents, foreign patents, or pending
applications.
TRADEMARKS—HotJava, Java, Java Development Kit, Solaris, SPARC, SunOS, and Sunsoft
are trademarks of Sun Microsystems, Inc.
The publisher offers discounts on this book when ordered in bulk quantities. For more information,
contact Corporate Sales Department, Prentice Hall PTR , One Lake Street, Upper Saddle River,
NJ 07458. Phone: 800-382-3419; FAX: 201- 236-7141. Email:
corpsales@prenhall.com
.
Editorial/production supervision:
Jan H. Schwartz
Cover design director:
Jerry Votta
Cover designer:
Anthony Gemmellaro
Cover illustration:
Karen Strelecki
Manufacturing manager:
Alexis R. Heydt-Long
Marketing manager:
Debby vanDijk
Associate editor:
Eileen Clark
Editorial assistant:
Brandt Kenna
Sun Microsystems Press Publisher:
Michael Llwyd Alread
10 9 8 7 6 5 4 3 2 1
Sun Microsystems Press
A Prentice Hall Title
v
Plik z chomika:
superktos86
Inne pliki z tego folderu:
Real-Time Java Platform Programming - Dibble_ Peter C_.pdf
(2003 KB)
cover.jpg
(56 KB)
metadata.opf
(7 KB)
Inne foldery tego chomika:
Zgłoś jeśli
naruszono regulamin