Preface, xiii
Introduction, xvii
Chapter 1
Landscape, 1
Java Technology and Real Time, 1
Real-Time Programming Requirements, 3
Java and Embedded Real Time, 4
Definition of Real Time, 4
Precision of Measurement, 5
Consistency, 6
Utility Function Curve, 7
Java's Problem Domain, 9
Real-Time Java's Problem Domain, 11
Summary, 12
Chapter 2
Architecture of the Java Virtual Machine, 13
Write Or,ce, Run Anywhere- Maybe, 13
JVM Components, 14
Class Loading, 15
Bytecode Interpreter, 16
Security Manager, 21
Garbage Collector, 23
Thread Management, 27
Input/Output , 28
Graphics, 29
Interpreter Implementation, 30
Standard Interpreter, 30
Optimized Interpreter, 32
JIT, 32
Snippets, 33
Compilation to Independent Process, 35
Native Methods, 35
Compilation to a Native Method, 35
Compilation to the JIT Interface, 36
Chapter 4
Hardware Architecture, 37
Worst-Case Execution of One Instruction, 39
Worst-Case Scenario, 39
Practical Measures, 42
Management of Troublesome Hardware, 43
Managing Demand Paging, 43
Managing DMA, 43
Managing Cache, 44
Managing Address Translation Cache, 44
Managing Interrupts, 45
Effects on the JVM, 45
Chapter 4
Garbage Collection, 47
Reference Counting, 48
Basic Garbage Collection, 48
Mark and Sweep, 49
Defragmentation, 52
Copying Collectors, 53
Incremental Collection, 55
Incremental Garbage Collection in Practice, 57
Generational Garbage Collection, 58
Intergenerationat References, 59
Large Object Store, 60
Real-Time Issues, 60
Chapter 5
Priority Scheduling, 61
Scheduling Terms, 61
Execution Sequences, 62
Preemption, 63
The Seductive Charm of Nonpreemptive Scheduling, 64
Fixed versus Dynamic Priority, 65
Priority Inversion, 65
Why 32 Priorities?, 69
Problems with Priority Scheduling, 71
Chapter 6
Scheduling with Deadlines, 73
Underlying Mechanism, 74
Scope of the Scheduler, 75
Some Systems, 76
Earliest Deadline First (EDF), 76
Least Laxity, 78
Periodic Scheduling, 79
Aperiodic Servers, 79
Handling Overload, 82
Timing Is Usually Probabilistic, 85
Chapter 7
Rate Monotonic Analysis, 87
Theorems, 88'
Liu and Layland's Theorem, 88
A Graphical Approach, 89
Lehoczky, Sha, and Ding's Theorem, 91
Restrictions, 94
Independent Tasks, 94
Deadlines Equal to Periods, 95
Multiprocessor Systems, 96
Chapter 8
Introduction to the Real-Time Java Platform, 97
A Brief History of Real-Time Java, 98
Major Features of the Specification, 100
Threads and Scheduling, 101
Garbage Collection, 102
Asynchronous Event Handlers, 103
Asynchronous Transfer of Control, 104
Memory Allocation, 104
Memory Access, 106
Implementation, 106
RTSJ Hello World, 107
Chapter 9
Closures, 109
The Language Construct, 110
Java Closures, 110
Closure Structure, 110
Closures in the RTSJ, 111
Limitations of Closures, 112
Readability, 112
Local Variables, 113
Constructors, 113
Nesting, 113
Chapter 10
High-Resolution Time, 115
Resolution, 115
The "Clock'', 116
HighResolutionTime Base Class, 117
Absolute Time, 118
Relative Time, 119
Rational Time, 120
Chapter 11
Async Events, 123
Binding a Happening to an Event, 124
Basic Async Event Operation, 125
Async Events without Happenings, 128
Time Triggering, 128
Fault Triggering, 133
Software Event Triggering, 135
Implementation Discussion, 135
Chapter 12
Real-Time Threads, 137
Creation, 138
Scheduling, 143
Inversion Handling, 144
Fixed Priority, 146
Feasibility, 147
Periodic Threads without Handlers, 148
Feasibility Analysis, 153
Periodic Threads with Handlers, 155
Interactions with Normal Threads, 166
Changing the Scheduler, 167
Chapter 13
Non-Heap Memory, 177
The Advantage of Non-Heap Memory, 178
The Allocation Regimes, 178
Rules, 179
Mechanisms for Allocating Immortal Memory, 181
Mechanisms for Allocating from Scoped Memory, 184
Allocation Time, 184
Creating Scoped Memory, 186
Allocation Mechanisms, 188
Finalizers, 191
Using Nested Scoped Memory, 192
The Scope Stack (Tree), 192
The DA G, 193
Practical Use of Nested Scopes, 196
Every Nested Scope Involves Two Memory Areas, 198
Pitfalls, 199
Using executeInArea, 202
Using Standard Classes, 205
Using Shared Scoped Memory, 206
The Scope Stack Revisited, 207
Scope Portals, 214
Fine Print, 220
Quick Examples, 221
Chapter 14
Non-Heap Access, 227
Interaction with Scheduler, 227
Rules, 229
Samples, 231
Final Remarks, 234
Notes, 235
Chapter 15
More Async Events, 237
Async Events and the Scheduler, 237
The createReleaseParameters Method, 238
Bound Async Event Handlers, 238
Async Event Handlers and Non-Heap Memory, 239
No-Heap Event Handlers vs. No-Heap Tl~reads, 239
Scheduling, 240
Minimum Interarrival Time, 240
Async Event Handlers and Threads, 241
Special Async Events, 242
Chapter 16
Reusing Immortal Memory, 243
Using Fixed-Object Allocators, 244
Carrier Objects, 244
Limitations, 245
Recycling RT Threads, 246
Recycling Async Event Handlers, 252
Chapter 17
Asynchronous Transfer of Control, 257
Thread Interrupt in Context, 259
Asynchronous Interrupt Firing, 261
The Timed Class, 261
The interrupt Method, 263
The fire Method, 264
In Summary, 266
Replacement Rules, 267
Rules for Async Exception Propagation, 268
Oblivious catch, 268
Nonmatching dolnterruptible, 269
Matching doInterruptible, 270
Internals, 270
Application Handling for Asynchronous Interrupts, 274
Noninterruptible Code, 278
Special Issues for Synchronized blocks, 281
Legacy Code, 282
Use of ATC for Thread Termination, 283
Chapter 18
Physical Memory, 285
Physical and Virtual Memory, 286
Physical Memory Manager, 287
Memory Type, 288
Removable Memory, 290
Immortal Physical Memory, 291
Scoped Physical Memory, 291
Chapter 19
Raw Memory Access, 293
Security, 295
Peek and Poke, 295
Get/Set Methods, 297
Mapping, 300
The RawMemoryFIoatAccess Class, 301
Chapter 20
Synchronization without Locking, 303
Principles of Wait-Free Queues, 306
Constructors, 306
Common Methods, 307
The Wait-Free Write Queue, 307
Methods, 308
Sharing the Wait-Free Queue, 309
The Wait-Free Read Queue, 310
The Extra Constructor, 310
Methods, 311
The Wait-Free Double-Ended Queue, 311
Methods, 312
No-Wait Queues and Memory, 312
Implementation Notes, 31 3
Chapter 21
Recommended Practices, 315
Powerful and Easy-to-Use Features of the RTSJ, 315
Real-Time Threads, 316
Periodic Threads, 316
Asynchronous Event Handlers, 316
High-Resolution Time, 316
Happenings, 316
Very Powerful and Dangerous Features of the RTSJ, 31 7
Simple, 317
Leaky, 317
Viral, 318
Very Powerful and Finicky Features of the RTSJ, 31 8
Scoped Memory, 318
No-Heap Asynchronous Event Handlers, 319
No-Heap Real-Time Threads, 319
Asynchronously Interrupted Exceptions, 319
Selection of Priorities, 319
Index, 323