Real-Time Java by ExampleExperiences from a 9th Semester Software Project                    at AAU  Kasper S. Luckow, Chr...
Focus of the Project• Gain knowledge in the area of real-time systems    • Specifically embedded and safety-critical real-t...
Java for Real-Time Systems Development• It would be nice to use Java for real-time systems  development over languages suc...
The Real-Time Specification for Java                                                At a quick glance  • Java, in the tradi...
Profiles• Desire to certify safety-critical systems• Desire to reduce resource usage for embedded systems• Profiles are used...
Changes to the RTSJ                                Example from the Ravenscar-Java    “The key aim of the Ravenscar-Java p...
Case - The Mine Pump                                                                                             Overview•...
Modelling the Mine Pump                                 The LEGO Construction1    Brick feeder2    Conveyor belt3    JOP b...
Modelling the Mine Pump                                                Hardware  • Java Optimized Processor (JOP) (jopdesi...
Demo of the Mine Pump  10
Walk-through of the Implementation                                                      Declaring Tasksnew P e r i o d i c...
Walk-through of the Implementation                                 Handling the Periodic Eventp u b l i c c l a s s WaterL...
Walk-through of the Implementation                                   Handling the Sporadic Eventpublic c l a s s SporadicW...
Comparing the Profiles                                                   Safety Critical JavaaddToMission (    new P e r i ...
Temporal Correctness• WCET analysis    • Can be determined through e.g. measurements, simulation,      and static analysis...
Analysing the Program     WCET Analysis using WCA16
Analysing the Program                                           Schedulability Analysis using TIMES                       ...
Summary• The Java language is being adapted for easier analysis  through profiles• Tools can help determine properties such...
Upcoming SlideShare
Loading in …5
×

Real-Time Java by Example. Experiences from a 9th Semester Software Project at AAU af Kasper S. Luckow, Christian Frost and Casper S. Jensen

834 views

Published on

Oplægget blev holdt ved et seminar i InfinIT-interessegruppen højniveau sprog til indlejrede systemer den 2. februar 2011.
Læs mere om interessegruppen på http://www.infinit.dk/dk/interessegrupper/hoejniveau_sprog_til_indlejrede_systemer/

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
834
On SlideShare
0
From Embeds
0
Number of Embeds
239
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Real-Time Java by Example. Experiences from a 9th Semester Software Project at AAU af Kasper S. Luckow, Christian Frost and Casper S. Jensen

  1. 1. Real-Time Java by ExampleExperiences from a 9th Semester Software Project at AAU Kasper S. Luckow, Christian Frost, and Casper S. Jensen 2. February 2011 InfinIT 1
  2. 2. Focus of the Project• Gain knowledge in the area of real-time systems • Specifically embedded and safety-critical real-time systems• Determine how temporal correctness can be ensured (schedulability, WCET)• Determine how Java can be applied to this area• Conduct a case-study for practical experience 2
  3. 3. Java for Real-Time Systems Development• It would be nice to use Java for real-time systems development over languages such as C/C++ • Increased productivity • Reduced risk of errors • A more common language for newly educated programmers• Using Java poses a number of interesting problems• How can we express the necessary real-time concepts in Java?• How can we verify properties such as WCET and schedulability? 3
  4. 4. The Real-Time Specification for Java At a quick glance • Java, in the traditional sense lacks facilities for real-time systems • The RTSJ is broad, flexible, and contains many detailsFacilities and concepts introduced in the RTSJ: • Schedulable objects and scheduling. • Real-time threads. • Asynchronous event handling and timers. • Asynchronous transfer of control (ATC). • Physical and raw memory access. • Time values and clocks. • Synchronization and resource sharing. • Memory management, scoped and immortal memory. 4
  5. 5. Profiles• Desire to certify safety-critical systems• Desire to reduce resource usage for embedded systems• Profiles are used to reduce complexity of the RTSJ and allow for easier analysis• Ravenscar-Java (RJ)• Safety-Critical Java (SCJ)• Predictable Java (PJ) 5
  6. 6. Changes to the RTSJ Example from the Ravenscar-Java “The key aim of the Ravenscar-Java profile is to develop a concurrent Java programming model that supports predictable and reliable execution of application programs, thus benefiting the construction of modern high integrity software”Changes can be categorised into three areas: • Predictability of memory utilisation. • Predictability of timing. • Predictability of control and data flow. 6
  7. 7. Case - The Mine Pump Overview• Classic text-book example of a real-time system• Pump starts when water level is high• Pump stops when water level is low• Pump never runs when methane level is high Water flow sensor Methane sensor Air flow sensor Carbon monoxide sensor High water level detector Low water level detector 7
  8. 8. Modelling the Mine Pump The LEGO Construction1 Brick feeder2 Conveyor belt3 JOP board4 High water sensor5 Low water sensor6 Mine shaft7 Water pump8 Methane sensor9 Conveyor belt10 Slide11 Environment motor12 Environment motor 8
  9. 9. Modelling the Mine Pump Hardware • Java Optimized Processor (JOP) (jopdesign.com) • Implemented on a Cyclone EP1C12 FPGA • 100MHz processor, 512KB flash, 1MB SRAMImplementation language: Ravenscar-Java 9
  10. 10. Demo of the Mine Pump 10
  11. 11. Walk-through of the Implementation Declaring Tasksnew P e r i o d i c T h r e a d ( new P r i o r i t y P a r a m e t e r s ( PERIODIC PRIORITY ) , new P e r i o d i c P a r a m e t e r s ( new A b s o l u t e T i m e ( 0 , 0 ) , new R e l a t i v e T i m e ( PERIODIC PERIOD , 0 ) ) , new W a t e r L e v e l D e t e c t i o n R u n n a b l e ( . . . ) ) ;new S p o r a d i c W a t e r L e v e l H i g h ( new P r i o r i t y P a r a m e t e r s ( SPORADIC PRIORITY ) , new S p o r a d i c P a r a m e t e r s ( new R e l a t i v e T i m e ( SPORADIC PERIOD , 0 ) , 1 ) , waterpumpMotor ) ; 11
  12. 12. Walk-through of the Implementation Handling the Periodic Eventp u b l i c c l a s s WaterLevelDetectionRunnable implements{... p u b l i c void run ( ) { i f ( highWaterSensor . isWaterLevelReached ( ) ) { waterHighEvent.fire(); } e l s e i f ( lowWaterSensor . isNoWaterPresent ( ) ) { waterLowEvent . f i r e ( ) ; } }} 12
  13. 13. Walk-through of the Implementation Handling the Sporadic Eventpublic c l a s s SporadicWaterLevelHigh extends SporadicEventHandler{ p u b l i c void handleAsyncEvent () { t h i s . waterpumpMotor . s t a r t ( ) ; }} 13
  14. 14. Comparing the Profiles Safety Critical JavaaddToMission ( new P e r i o d i c G a s D e t e c t i o n ( new P r i o r i t y P a r a m e t e r s ( GAS PRIORITY ) , new P e r i o d i c P a r a m e t e r s ( new R e l a t i v e T i m e ( 0 , Scheduler . getDefaultScheduler () , new LTMemory ( 1 0 ∗ 1 0 2 4 ) , gasSensor , waterPumpMotor ) )); 14
  15. 15. Temporal Correctness• WCET analysis • Can be determined through e.g. measurements, simulation, and static analysis • In our case safe WCETs are required and tight WCETs are desirable • Often dependent on the underlying hardware, operating system and virtual-machine • Predictability is the key!• Schedulability analysis • “Tightness” of schedulability analysis desirable • Must take necessary factors into account to ensure the schedulability 15
  16. 16. Analysing the Program WCET Analysis using WCA16
  17. 17. Analysing the Program Schedulability Analysis using TIMES Idle waterLevelChanged==1 go? C WaterDetection C Low C High SporadicLowWaterLevel SporadicHighWaterLevel C Cleanup waterLevelChanged:=0Furthermore schedulability analysis was also conducted using 17
  18. 18. Summary• The Java language is being adapted for easier analysis through profiles• Tools can help determine properties such as WCET and schedulability for the programmer• Still a lot of limitations regarding the capabilities of these tools 18

×