Copyright © 2001Page Real-Time Java Fact-no-fiction Java in technical automation Paul Wijntjes Consultant Turnkiek Technical Systems
Copyright © 2001Page 2 Contents Introduction Java in embedded Real Time Java Demonstrator
Copyright © 2001Page 3 Offices in: Amersfoort Delft Eindhoven
Copyright © 2001Page 4 nEarly adopter nQuality solutions nCost effective and future aimed nIn technical industrial & scientific market nReliable and valued partner Give the customer peace of mind Commitment = commitment Small things matter Treat and respect people as people Mission statement: Inproduct sw V&S systemen Prod. Autom. Network Comp R &D Traffic & Transport Productie Bdr. Defense Advanced machines Utilities Telecom Java Embedded Microsoft Unix /Linux Platforms Service areas. Market segments
Copyright © 2001Page 5 Contents Introduction Java in embedded Real Time Java Demonstrator
Copyright © 2001Page 6 Not only people YEAR 2010 Number of subscribers/units (millions) People Automobiles Bicycle Portable PCs Motorcycles, Boats, Vending Machines etc Pets (dogs and cats etc) Total Forecast by DoCoMo based on “Trends in Household Consumption” by Economic Planning Agency, and published materials by Japan Pet Food Manufacturer’s Association etc
Copyright © 2001Page 7 Pro File Pro File JavaTM 2 Platform Hardware / Operating System Java Virtual Machine J2EE APIs J2SE APIs J2ME APIs Pro File Pro File Pro File Pro File Pro File Pro File Pro File Pro File Pro File Pro File Pro File Pro File Pro File Pro File Pro File Pro File Profiles Configu- rations ??? Thanks to Chris Laffra, OTI
Copyright © 2001Page 8 Why Java in Embedded ? More reliable More productive - O bject oriented - High level - C omponent model Inherent networking Less porting effort (if any) Machine code skills deteriorating Descartes
Copyright © 2001Page 9 Evolution -> Revolution SE EE ME -2 y now +2 y
Copyright © 2001Page 10 Contents Introduction Java in embedded Real Time Java Demonstrator
Copyright © 2001Page 11 Yes, but…… What about Real-Time?
Copyright © 2001Page 12 Specification J-Consortium, RTJWG - NewMonics, HP, Microsoft, Aonix,... JCP, JSR Specs - Reference implementation - Test suite - Expected Q4-2001
Copyright © 2001Page 13 Guiding Principles Applicability to particular Java environments Backward compatibility Write once, run anywhere Current practice versus advanced future features Predictable execution No syntactic extension
Copyright © 2001Page 14 RTSJ: 8 modified areas 1. Thread scheduling and dispatching 2. Memory management 3. Synchronization and resource sharing 4. Physical memory access 5. Asynchronous event handling 6. Asynchronous transfer of control 7. Asynchronous thread termination 8. Exceptions
Copyright © 2001Page Thread scheduling and dispatching Introduction of class RealTimeThread Predictable execution Unanticipated scheduling algorithms can be used Preemptive, Priority-based, FIFO within priority with at least 28 unique priority levels
Copyright © 2001Page 16 How does it work? Rt-thread Time Priority Java thread GC Rt-thread Pipe
Copyright © 2001Page Memory management Garbage collection Basic memory areas - Scoped memory - Physical memory - Immortal memory - Heap memory
Copyright © 2001Page Synchronisation and resource sharing Prevent priority inversion Monitor behavior policy can be set per object. Determinisme
Copyright © 2001Page 19 Priority inheritance Object Thread 1 Thread 2 Lock Unlock Lock Priority Time
Copyright © 2001Page Physical memory access Byte-level access to physical memory Construction of objects in physical memory
Copyright © 2001Page Asynchronous event handling Two classes AsyncEvent AsynchEventHandler Implemented scheduler for execution
Copyright © 2001Page 22 AsyncEvent (how it works) AsyncEvent bindTo() abstract class AsyncEventHandler: run() // final handleAsyncEvent() getAndDecrementPendingFireCount() addHandler() Handler implements Schedulable and Runnable interfaces. Real world event
Copyright © 2001Page Asynchronous transfer of control (ATC) Execution transfer Time bound ATC and asynchronous event handling can be combined.
Copyright © 2001Page Asynchronous thread termination Safely transfer of control New mechanism for stopping threads
Copyright © 2001Page Exceptions New several exceptions New treatment of exceptions asynchronous transfer of control memory allocation
Copyright © 2001Page 26 Implementations TimeSys, reference implementation JSR-1 OTI/IBM J9 Esmertec, JBed Insignia Solutions, Jeode aJile Systems
Copyright © 2001Page 27 Contents Introduction Java in embedded Real Time Java Demonstrator
Copyright © 2001Page 28 Real time demonstrator
Copyright © 2001Page 29 PC 104 board QNX Neutrino OTI’s J9 + Real-Time Extensions Application Drivers motorcontrolers Architecture
Copyright © 2001Page 30 Visual Age Micro Edition After running 3 threads “simultaneously” Trace analyzerMemory analyzer
Copyright © 2001Page 31 Lessons learned Real-Time Java is Really Real-Time Implementation of specs not complete OTI’s J9 and VAME work very well
Copyright © 2001Page 32 Summary Expected exponential growth in J2ME applications Real-Time Java nearly final It’s time to make plans to use Real Time Java
Copyright © 2001Page 33 More information java.sun.com
Copyright © 2001Page 34 Thank you For your time and attention