TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
2011.jtr.pbasanta.
1. 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)
2. 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
3. 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
4. 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
5. 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
6. 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
7. 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
9. 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
10. 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 RealtimeCharacterizationService
02: extends RealTimeService{
03: public Document
04: getRealtimeCharacterization(Bundle b);
05: public boolean setRealtimeCharacterization(
06: Bundle bnd, Document doc);
07:}
JTR-12 10
11. 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
12. TROSGi: Level 2 – API:
BundleScheduler, BundleRecover,
BundleCompositor
00: import org.osgi.framework.*;
01: import org.w3c.dom.*;
02: public interface BundleSchedulerService
03: extends RealTimeService{
04: public boolean setIfFeassible(Bundle bnd);
05: public boolean removeFromScheduler(Bundle bnd);
06: }
00: import org.osgi.framework.*;
01: public interface BundleRecoverService
03: extends RealTimeService{
04: public boolean addBundle(Bundle bnd);
05: public boolean removeBundle(Bundle bnd);
}
00: import org.osgi.framework.*;
01: public interface BundleCompositorService
03: extends RealTimeService{
03: public boolean addComposedBundle(Bundle bnd);
04: public boolean removeComposedBundle(Bundle bnd);
}
JTR-12 12
16. 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
17. Level 2: RecoveryService results
Soft (99%)
Worst Case
Approach Case Cost
Cost (ms)
(ms)
Including Installation Cost
(full installation) 257 157
Without Installation Cost (start only) 177 137
JTR-12 17
19. 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
20. 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