2011.jtr.pbasanta.
Upcoming SlideShare
Loading in...5
×
 

2011.jtr.pbasanta.

on

  • 425 views

 

Statistics

Views

Total Views
425
Views on SlideShare
425
Embed Views
0

Actions

Likes
0
Downloads
3
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

2011.jtr.pbasanta. 2011.jtr.pbasanta. Presentation Transcript

  • Enhancing OSGi with real-time Java support Pablo Basanta-Val, Marisol García-Valls, and Iria Estévez-Ayres mailto:pbasanta@it.uc3m.es†Jornadas de Tiempo Real 2012- Santander ( ) Acceptado en Software Practice and Experience (SPE)
  • Outline• OSGi and RTSJ – Motivation and interesting issues• TROSGi (real-Time foR OSGi) – Architecture: L0, L1, L2 – API – Performance results• Conclusion and ongoing work 2
  • Context• Java programmers may use OSGi for – Life-cycle management of Java applications called bundles • start/stop/update bundles • export/lookup/unexport bundles/services from the framework • Runlevels• Some pieces work has addressed the provision of real- time with OSGi – [hybrid approaches] • Java for soft-real time + C modules for hard real-time – [pure Java approaches] • Using RTSJ (i.e., The Real-Time Specification for Java) JRT-12 3
  • Some issues in OSGi and RTSJ integration• Access to real-time Java facilities – I.e. RTSJ and/or DRTSJ• Improving the predictability of the framework – Definition of a real-time bundle • Real-time characterization • Access/modification of the characterization • Backward compatibility – Predictability in bundle management • Execution environment, security, underlying OS• New real-time services for OSGi – New APIs• Other real-time improvements on exiting services – E.g. Real-time framework, real-time HTTP 4
  • In this work: TROSGi• Primary goal: – Real-time and OSGi integration• This presentation – Introducing the integration framework proposed with RTSJ • Integration levels, architecture, and AP• Outcomes, – TROSGi=={real-time for OSGi} 5
  • TROSGi: Level 0 • Minimal access to real-time Java and OSGi • Changes required from the env.: – javax.realtime. – Real-time operating system (if any) – OSGi should export javax.realtime – Bundles should import javax.realtime 6
  • TROSGi: Level 0 – Example (1/2) 00: import javax.realtime.*; 01: import org.osgi.framework.*; 02: public class ExampleRT implements BundleActivator{ 03: BundleContext ctx; 04: RealtimeThread rt; 05: public void start(BundleContext context) throws Exception { 06: rt=new RealtimeThread(){ 07: public void run(){ 08: try{ 09: do{ System.out.println(“RT hello”); 10: RealtimeThread.sleep(new AbsoluteTime(10,0)); //mit=10 ms 11: }while (true); 12: }catch(Exception e){ 13: System.out.println(“STOP called: bye, bye”);} 14: }; 15: rt.start(); //Launch the real-time thread 16: } 17: public void stop(BundleContext context) throws Exception { 18: rt.interrupt(); //Launch an exception 19: } 20:.} Listing 1. Example of a bundle activator that starts/stops a real-time thread 7
  • TROSGi: Level 0 – Example (2/2)00: Bundle-Name: Hello RT Threads01: Bundle-SymbolicName: es.uc3m.it.drequiem.trosgi.Rtthreads02: Bundle-Description: A Hello World bundle for RTSJ03: Bundle-ManifestVersion: 204: Bundle-Version: 1.0.005: Bundle-Activator: ExampleRT06: Import-Package: org.osgi.framework, javax.realtime Listing 2. Bundle descriptor 8
  • TROSGi: Level 1 –Real-time characterization service• Goal: – Real-time charaterization• Solution: – Stored in the bundle in an xml file – Accessed from the bundle using a service 00: <!--Bundle-Name: Hello RT Threads -> 01: <schedulable name="RTHello"> 02: <mit>10000</mit> 03: </schedulable> 9
  • TROSGi-Level 1: Example and API 00: import javax.realtime.*; 01: import org.osgi.framework.*; 02: import es.uc3m.it.trosgi.*; 03: import org.w3c.dom.*; 04: public class ExampleRT implements BundleActivator{ 05: BundleContext ctx; 06: RealtimeThread rt; 07: int mit=0; 08: public void start(BundleContext context) throws Exception { 09: rt=new RealtimeThread(){ 10: public void run(){ 11: ServiceReference c_rf1= // Ref to the service 12: Context.getServiceReference(“CharacterizationService”); 13: RealtimeCharacterizationService client1= 14: (RealtimeCharacterizationService) context.getService(c_rf1); 15: Bundle bundle=context.getBundle(); 16: Document doc=client1.getRealtimeCharacterization(bundle); 17: NodeListlist nlist=doc.getElementsByTagName("mit");00: import org.osgi.framework.*;01: public interface RealtimeCharacterizationService02: extends RealTimeService{03: public Document04: getRealtimeCharacterization(Bundle b);05: public boolean setRealtimeCharacterization(06: Bundle bnd, Document doc);07:} JTR-12 10
  • TROSGi: Level 2 –Real-time characterization service• Three new services: – Admission controlers • Based on RTSJ’s model – Fault-tolerance • Partiatilly taken from DRTSJ – Compositor • Inspired in iLAND gained experience and • DRTSJ’s distributable threads JTR-12 11
  • TROSGi: Level 2 – API: BundleScheduler, BundleRecover, BundleCompositor00: import org.osgi.framework.*;01: import org.w3c.dom.*;02: public interface BundleSchedulerService03: extends RealTimeService{04: public boolean setIfFeassible(Bundle bnd);05: public boolean removeFromScheduler(Bundle bnd);06: }00: import org.osgi.framework.*;01: public interface BundleRecoverService03: extends RealTimeService{04: public boolean addBundle(Bundle bnd);05: public boolean removeBundle(Bundle bnd);}00: import org.osgi.framework.*;01: public interface BundleCompositorService03: extends RealTimeService{03: public boolean addComposedBundle(Bundle bnd);04: public boolean removeComposedBundle(Bundle bnd);} JTR-12 12
  • Level 2: Common Services API(inspired in RTSJ’s resource model)f 00: <!DOCTYPE resourcemodel[ 01: <!ELEMENT resourcemodel(bundlescheduler| 02: bundlerecover|bundlecompositor) 03: <!ELEMENT bundlescheduler(schedulable*)> 04: <!ELEMENT schedulable (releaseparameters?,scheduling?)> 05: <!ATTLIST alt name (#PCDATA)> 06: <!ELEMENT releaseparameters (periodic|sporadic 07: |aperiodic)> 08: <!ELEMENT periodic (start?,period?,cost?,deadline?)> 09: <!ELEMENT sporadic (start?,mit?,cost?,deadline?)> 10: <!ELEMENT aperiodic> 11: <!ELEMENT start (#PCDATA)> 12: <!ELEMENT period (#PCDATA)> 13: <!ELEMENT cost (#PCDATA)> 14: <!ELEMENT deadline (#PCDATA)> 15: <!ELEMENT mit (#PCDATA)> 16: <!ELEMENT scheduling (priority?)> 17: <!ELEMENT priority (#PCDATA)> 18: <!ELEMENT bundlerecover (policy+)> 19: <!ELEMENT policy (mit?, cost?,deadline?,priority?)> 20: <!ATTLIST policy name #PCDATA> 21: <!ELEMENT bundlecompositor (alt*)> 22: <!ELEMENT alt (block+)> 23: <!ATTLIST alt type (#PCDATA)> 24: <!ELEMENT block (schedulable*)> 25: ]> JTR-12 13
  • Implementation• Prototype: Characterization Scheduler Service Service – Oracle’s JTR TROSGi Services Recovery Service Compositor Service – Real-time Linux kernel 2.6.28 Real-Time Java – Knopflerfish 3.0 Access OSGi (knopflerfish 3.0)• TROSGi Real-time Java (1.5.0_20_Java_RTS-2.2.fcs_b19) – RUB admission controller – Re-starting fault policy Real-time operating system (2.6.28-3-rt) – Multi-constrained recovery CPU Memory service Network (1.5 Ghz) (5 Gb) – 50 kbytes footprint JTR-12 14
  • Level 0 and Level 1 results JTR-12 15
  • Level 2: BundleScheduler results• Admission control takes reduced amout of time (see 1st figure) – 1024 tasks in 50 ms• Most of the time consumed in XML processing (see 2nd figure) JTR-12 16
  • Level 2: RecoveryService results Soft (99%) Worst Case Approach Case Cost Cost (ms) (ms)Including Installation Cost(full installation) 257 157Without Installation Cost (start only) 177 137 JTR-12 17
  • Level 2: BundleCompositor results Much overhead !!! - Compared against the scheduler service JTR-12 18
  • Conclusions• The definition of real-time OSGi is a rather open issue – No standard, nor functional solutions• TROSGi offers a service-based approach for real-time integrations – Three integration levels : L0, L1, and L2 – Tested on RTSJ, and validated with simple implementation services JTR-12 19
  • Ongoing work• Two main ongoing issues – Improving the implementation • Use of DRTSJ, new service implementations, real-time security • New compositor policies – Introducing hooks for other languages • C and Ada integration 20
  • JTR-12 21