Distributed Real-Time in the RTSJ
description
Transcript of Distributed Real-Time in the RTSJ
![Page 1: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/1.jpg)
Distributed Real-Time in the RTSJ
Andrew Borg
![Page 2: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/2.jpg)
Presentation
RMI – A brief introduction
The RTSJ – A (very) brief introduction
The DRTSJ – The 3 Levels of Integration
RMI+RTSJ: Concerns, Issues and Solutions
![Page 3: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/3.jpg)
Presentation
RMI – A brief introduction
The RTSJ – A brief introduction
The DRTSJ – Current Status
RMI+RTSJ: Concerns, Issues and Solutions
![Page 4: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/4.jpg)
The RMI Specification
RMI is very minimal. Assumes a homogeneous environment of
JVMs.
There is no ORB concept (see later)
![Page 5: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/5.jpg)
Goals Support seamless remote invocation on objects. Retain most of the Java language's object
semantics. Make differences between the distributed object
model and local Java object model apparent. Make writing reliable distributed applications as
simple as possible. Preserve the type-safety provided by the Java
runtime environment. Various reference semantics for remote objects; for
example live (nonpersistent) references, persistent references, and lazy activation.
Enforce the safe Java environment provided by security managers and class loaders.
![Page 6: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/6.jpg)
A simple HelloPerson example
Client sends name to a server.
Server returns “hello ” +the name passed
![Page 7: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/7.jpg)
The interface
public interface HelloPersonInterface extends java.rmi.Remote
{
public void sayHello() throws java.rmi.RemoteException;
}
![Page 8: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/8.jpg)
The Implementation
public class HelloPerson implements HelloPersonInterface { public HelloPerson () {} public String sayHello(String S) { return new String("Hello World"+S); }}
![Page 9: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/9.jpg)
Generate Stub Using rmic
… See later
![Page 10: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/10.jpg)
Launching the Server
{Registry r= createRegistry(4321);HelloPersonImpl x = new HelloPersonImpl();Remote s =
UnicastRemoteObject.exportObject(x);r.bind("MyHelloServer",s);}
![Page 11: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/11.jpg)
Invoking the Server
HelloServerInterface H = (HelloServerInterface) r.lookup("MyHelloServer");
System.out.println(H.sayHello("Andrew"));
![Page 12: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/12.jpg)
The RMI ClassesThe RMI Classes
Server
Interface
ServerStub
![Page 13: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/13.jpg)
The Stubpublic final class HelloServerImpl_Stub extends java.rmi.server.RemoteStub implements HelloServerInterface{ public java.lang.String sayHello(java.lang.String
$param_String_1)throws java.rmi.RemoteException
{ Object $result = ref.invoke(this, $method_sayHello_0, new java.lang.Object[] {$param_String_1}, 8370655165776887524L); return ((java.lang.String) $result);
}
![Page 14: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/14.jpg)
Distributed vs. Centralised
Clients of remote objects interact with remote interfaces
Non-remote arguments to, and results from, an RMI call are passed by copy.
A remote object is passed by reference, not by copying the actual remote implementation.
Since the failure modes of invoking remote objects are inherently more complicated than the failure modes of invoking local objects, clients must deal with additional exceptions.
![Page 15: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/15.jpg)
![Page 16: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/16.jpg)
The DGC
Is part of the specification Uses a lease-mechanism with reference
counting Internally also keeps the VM alive when
remote objects exist
![Page 17: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/17.jpg)
JRMP
Serialization Protocol HTTP Protocol
Output defines sub-protocol: single-opstreammultiplex
![Page 18: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/18.jpg)
Presentation
RMI – A brief introduction
The RTSJ – A brief introduction
The DRTSJ – The 3 Levels of Integration
RMI+RTSJ: Concerns, Issues and Solutions
![Page 19: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/19.jpg)
The Real Time Specification for Java (RTSJ)
The 7 enhanced areas over Java:Thread Scheduling and DispatchingMemory ManagementSynchronization and Resource SharingAsynchronous Event HandlingAsynchronous Transfer of ControlAsynchronous Thread TerminationPhysical Memory Access
![Page 20: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/20.jpg)
JSR 50
… extends RMI in the RTSJ to provide support for predictability of end-to-end timeliness of trans-node activities.
Expert group has published a framework for the implementation of JSR 50, describing three levels of integration.
![Page 21: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/21.jpg)
The 3 levels of Integration
Level 0: RTSJ + RMI
Level 1: RTSJ + Realtime RMI
Level 2: RTSJ + Realtime RMI + Distributed Threads
![Page 22: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/22.jpg)
Two Requirements for RT-RMI
Requirement 1: Real-time InvocationEnd-to-End timeliness in the invocation
process
Requirement 2: Support for RT-RMISerialization, the DGC, etc.
![Page 23: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/23.jpg)
Real-time Invocation Control in RT-RMIReal-time Invocation Control in RT-RMI
Application
RMI Framework
Unicast Classes:Define Both threading
and Network Logic
VM Network
RMI in JavaRMI in Java
Application
Network
RMI Framework
ThreadingConcerns
NetworkConcerns
RTVM
RT-RMI RT-RMI
![Page 24: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/24.jpg)
The RMI ClassesThe RMI Classes
![Page 25: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/25.jpg)
![Page 26: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/26.jpg)
Exporting Server Parameters
Export methods defined in subclass of RealtimeRemoteServer:
public static RealtimeRemoteServer exportObject(
RealtimeRemote obj, int port,SchedulingParameters sp, NetworkParams np,Threadpool pool
)
Realtime-parameters passed up to RealtimeRemoteServer
Network parameters stay with subclass
![Page 27: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/27.jpg)
Propagating Client Parameters
Assigning parameters to a RealtimeRemoteStub instance.
Implicitly inheriting or deriving the parameters from the client Schedulable object.
Explicitly specifying parameters for each invocation.
![Page 28: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/28.jpg)
RT-RMI Server Thread Model
Single Acceptor Thread associate with each exported object
Acceptor is most eligible thread if CP Accepts call and deserialises RT parameters
Handler Thread Deserialises non RT parameters Makes Upcall on Object Serialises the result and sends back to the server
Threadpool of handler Threads
![Page 29: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/29.jpg)
![Page 30: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/30.jpg)
![Page 31: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/31.jpg)
![Page 32: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/32.jpg)
Memory Considerations in implementation
Problems for the application developer:Parameters exported are used in the Schedulables created.
RTSJ scoping rules must be respected in the upcall
Problems for the developer:Threadpools implementation in not trivialProper scoping should be used to free objects
after invocation
![Page 33: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/33.jpg)
The DGC
If scoped memory removes GC, can it also be used to solve DGC?
What are the semantics involved?
In particular, what is a remote object?
![Page 34: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/34.jpg)
Connections
Should be part of a spec? Attach connections to pools? Can we assume connection-oriented
protocols RSVP
![Page 35: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/35.jpg)
Carrying out distribution
How would a correct RTSJ be moved to a distributed environment?
![Page 36: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/36.jpg)
Asynchronicity
What are the semantics of AIEs across node boundaries?
2 levels to address
![Page 37: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/37.jpg)
CORBA and DRTSJ
Is RTSJ + RTCORBA = DRTSJ?
Must RTCORBA be Java aware?
How would a mapping work?
![Page 38: Distributed Real-Time in the RTSJ](https://reader035.fdocuments.us/reader035/viewer/2022062408/5681402c550346895dab8cd9/html5/thumbnails/38.jpg)
Conclusion