The Definitive Guide to Java RTS for Developers and Architects
- For Java developers and architects moving to real-time, and real-time developers moving to Java
- Walks through start-to-finish case study applications, identifying their constraints and discussing the APIs and design patterns used to address them
- Written by the former leader of the real-time Java standards process and one of Wall Street’s top real-time developers
Sun Microsystems’ Java Real-Time System (Java RTS) is proving itself in numerous, wide-ranging environments, including finance, control systems, manufacturing, and defense. Java RTS and the RTSJ standard (JSR-001) eliminate the need for complicated, specialized, real-time languages and operating environments, saving money by leveraging Java’s exceptional productivity and familiarity.
In Real-Time Java™ Programming, two of Sun’s top real-time programming experts present the deep knowledge and realistic code examples that developers need to succeed with Java RTS and its APIs. As they do so, the authors also illuminate the foundations of real-time programming in any RTSJ-compatible environment.
Key topics include
- Real-time principles and concepts, and the unique requirements of real-time application design and development
- How Java has been adapted to real-time environments
- A complete chapter on garbage collection concepts and Java SE collectors
- Using the Java RTS APIs to solve actual real-time system problems as efficiently as possible
- Utilizing today’s leading Java RTS development and debugging tools
- Understanding real-time garbage collection, threads, scheduling, and dispatching
- Programming new RTSJ memory models
- Dealing with asynchronous event handling and asynchronous transfer of control
Table of Contents:
Preface xiii
Acknowledgments xix
About the Authors xxi
Part I: Real-Time Computing Concepts 1
Chapter 1: Real-Time for the Rest of Us 3
Qualities of Real-Time Systems 3
Predictability and Determinism 7
Real-Time Computing 15
Real-Time Scheduling 18
Further Reading 35
Chapter 2: Real-Time and Java SE 37
Is Java a Real-Time Language? 37
Garbage Collection 40
Garbage Collection in Sun’s Java SE 6 HotSpot 48
Real-Time GC Algorithms 66
The Java Dilemma 76
Chapter 3: The Real-Time Specification for Java 77
A Foundation for Real-Time Java 78
Inside the RTSJ 81
Optional RTSJ Facilities 92
The Future of Real-Time Java 92
Chapter 4: The Sun Java Real-Time System 95
A Prelude to Java RTS Programming 96
Installing Java RTS 102
Guide to Determinism 107
Command-Line Options 133
Part II: Inside Java RTS 143
Chapter 5: Threads, Scheduling, and New Memory Models 145
Schedulable Objects 146
Real-Time Threads 159
Memory Models 185
Chapter 6: Synchronization 203
Resource Sharing 203
Wait-Free Thread Communication 209
Chapter 7: The Real-Time Clock API 223
The Clock API 223
Java RTS High-Resolution Time Operations 226
A Conflated Stock Data Feed Example 229
Chapter 8: Asynchronous Events 237
Asynchronous Event Processing 237
Building an Asynchronous Event Handler (AEH) 240
Time-Based Events 258
Chapter 9: Asynchronous Transfer of Control and Thread Termination 269
Asynchronous Transfer of Control (ATC) 269
Asynchronous Thread Termination 284
Chapter 10: Inside the Real-Time Garbage Collector 289
RTGC Theory of Operation 290
RTGC Memory Allocation 302
RTGC Policies 306
Part III: Using Java RTS 315
Chapter 11: An Equities Trading System 317
The Equities Market 317
The Trading System Implementation 319
The Java SE Version 322
The Java RTS Version 333
The Java RTS No-Heap Version 336
Application Confi guration 346
Chapter 12: Java RTS Tools 347
Java RTS Development 347
The Thread Schedule Visualizer (TSV) 353
Java RTS DTrace Probes 373
Bibliography 391
Index 393
About the Author :
Eric J. Bruno, systems engineer at Sun Microsystems, specializes in Java RTS in the financial community. He is contributing editor for Dr. Dobb’s Journal, and writes its online Java blog. Prior to Sun, Eric worked at Reuters where he developed real-time trading systems, order-entry and routing systems, as well as real-time news and quotes feeds, in both Java and C++.
Greg Bollella, Ph.D., distinguished engineer at Sun Microsystems, leads R&D for real-time Java. He was specifi cation lead for JSR-001, the Real-Time Specification for Java (RTSJ), and led the Real-Time for Java Expert Group under the Java Community Process. He has written multiple books, articles, and professional papers about real-time computing. He has a Ph.D. in computer science from the University of North Carolina at Chapel Hill, where he wrote a dissertation on real-time scheduling theory and real-time systems implementation.