1 / 25

STARS

STARS. Scoped Types and Aspects for Realtime Systems. engineering infrastructure. demands. load. tides. wind. currents. raising/lowering capabilities?. multiple lanes?. features. a tower?. special materials?. engineering infrastructure. system infrastructure. code under pressure

holli
Download Presentation

STARS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. STARS Scoped Types and Aspects for Realtime Systems

  2. engineering infrastructure demands load tides wind currents raising/loweringcapabilities? multiple lanes? features a tower? special materials?

  3. engineering infrastructure

  4. system infrastructure • code under pressure • needs to be both fast and flexible application-specific demands virtual machines platform-specific features

  5. What happens to structure? • code under pressure • needs to be both fast and flexible application-specific demands virtual machines platform-specific features

  6. Java Virtual Machine application specific demands platform specific features 2

  7. Java Virtual Machine responsibility to structure RT mechanism falls on the application RT RTLinux Can STARS bring structure to RT mechanism to improve manageability of RT applications?

  8. RTSJ memory regions • all scoped memory areas must follow a single parent rule to avoid cyclic parent relationships scope a parent • an outer scope may not hold a reference to an object within a more deeply nested inner scope scope b parent scope c • objects allocated within a scoped memory area can not be discarded until all threads in that area have terminated

  9. RTSJ memory regions • all scoped memory areas must follow a single parent rule to avoid cyclic parent relationships scope a RT mechanisms getting in the way parent • an outer scope may not hold a reference to an object within a more deeply nested inner scope scope b • objects allocated within a scoped memory area can not be discarded until all threads in that area have terminated

  10. Exceptions • AsynchronouslyInterruptedException: Generated when a thread is asynchronously interrupted. • DuplicateFilterException: PhysicalMemoryManager can only accomodate one filter object for each type of memory. It throws this exception if an attempt is made to register more than one filter for a type of memory. • InaccessibleAreaException: Thrown when an attempt is made to execute or allocate from an allocation context that is not accessible on the scope stack of the current thread. • MITViolationException: Thrown by the fire() method of an instance of Async-Event when the bound instance of AsyncEventHandler with a Release-Parameter type of SporadicParameters has mitViolationExcept behavior and the minimum interarrival time gets violated. • MemoryScopeException: Thrown by the wait-free queue implementation when an object is passed that is not compatible with both ends of the queue. • MemoryTypeConflictException: Thrown when the PhysicalMemoryManager is given conflicting specification for memory. The conflict can be between two types in an array of memory type specifiers, or when the specified base address does not fall in the requested memory type. • OffsetOutOfBoundsException: Generated by the physical memory classes when the given offset is out of bounds. • SizeOutOfBoundsException: Generated by the physical memory classes when the given size is out of bounds. • IllegalAssignmentError: Thrown on an attempt to make an illegal assignment. • MemoryAccessError: Thrown by the JVM when a thread attempts to access memory that is not in scope. • ResourceLimitError: Thrown if an attempt is made to exceed a system resource limit, such as the maximum number of locks. • ThrowBoundaryError: A throwable tried to propagate into a scope where it was not accessible. Errors • UnsupportedPhysicalMemoryException: Generated by the physical memory classes when the requested physical memory is unsupported. • MemoryInUseException: Thrown when an attempt is made to allocate a range of physical or virtual memory that is already in use. • ScopedCycleException: Thrown when a user tries to enter a ScopedMemory that is already accessible (ScopedMemory is present on stack) or when a user tries to create ScopedMemory cycle spanning threads (tries to make cycle in the VM ScopedMemory tree structure). • UnknownHappeningException: Thrown when bindTo() is called with an illegal happening. RuntimeExceptions left to developer to decipher…

  11. RTSJ memory regions • all scoped memory areas must follow a single parent rule to avoid cyclic parent relationships scope a the right abstraction can help structure the mechanism… parent • an outer scope may not hold a reference to an object within a more deeply nested inner scope scope b • objects allocated within a scoped memory area can not be discarded until all threads in that area have terminated

  12. heap memory plain java run-loop run condition terminate applicationinstructions

  13. RTSJ run-loop create new memory scope(m) run create new application thread(a) condition terminate a.run in m applicationinstructions terminate inner memory scope outer memory scope

  14. crosscutting structure

  15. aspect aspect-oriented software development (AOSD)

  16. RTSJ using AOSD… App around(Object o): call(void App.new()) && this (o) { App d = (AppLoop)proceed(o); d.memSpace = new LTMemory( SZ,SZ ); return d; } void around(Detector d): execution(void App.run()) && this (d) { (d.memSpace).enter( new Runnable() { public void run() { proceed(d); } });}

  17. scoped types to clarify policy • provides the abstraction to help structure mechanism • clarifies policy • possible problems: • breaks existing abstractions? • conceals too much mechanism?

  18. imm parent mem parent cdmem scoped types and packages scopea scopea.scopeb scopea.scopeb.scopec

  19. scoped types and gates instance of a gate class scope a parent instance of a gate class scope b parent scope c

  20. scoped types and gates instance of a gate class scope a parent instance of a gate class scope b

  21. applying AOSD to gates Gate around(Object o): call(void Gate+.new()) && this (o) { Gate g = proceed(o); g.memSpace = new LTMemory( SZ,SZ ); return g; } public interface Gate { MemoryArea mem; } void around(final Gate g): execution(void Gate+.run()) && this (g) { (g.memSpace).enter( new Runnable() { public void run() {proceed(g); } });} declare parents: (type1||type2||…) implements Gate

  22. tool supportstatic verification • set of rules established to coincide with RTSJ invariants • assume that a scoped package contains at least one gate class and zero or more scoped classes • statically verify rules • eliminates expensive, error prone dynamic verification

  23. package imm; @scoped class Main { static void main() { new App().start(); } } package imm.mem; @gate final class App extends NoHeapRealtimeThread { void run() { Detector cd = new Detector(); StateTable state = new StateTable(); Aircraft key = new Aircraft(); while ( true ) cd.run( state, key); } } @scoped class StateTable ... @scoped class Aircraft ... @scoped class Position ... package imm.mem.cdmem; @gate final class Detector { void run(StateTable state, Aircraft key){ Frame frame = receiveFrame(); TmpAircraft plane = frame.getAircraft(); plane.update( key); Position pos_in_table = state.get( key); if ( pos_in_table == null ) state.put(plane.copy(), frame.getPosition().copy()); else frame.getPosition(). update(pos_in_table); } } @scoped class TmpAircraft ... @scoped class TmpPosition ... @scoped class Frame ... class App extends NoHeapRealtimeThread { staticvoid main() { imm = ImmortalMemory.instance(); app = (App) imm.newInstance( App.class); app.start(); } void run() { LTMemory mem = new LTMemory( ...); mem.enter( new Runner() ); } } class Runner implements Runnable { void run() { LTMemory cdmem = new LTMemory(...); Detector cd = new Detector( new StateTable() ); while ( true ) cdmem.enter( cd ); } } class Detector implements Runnable { StateTable state; … void run() { Frame frame = receiveFrame(); Position pos_in_table = state.get( frame.getAircraft()); if (pos_in_table == null) { mem = MemoryArea.getMemoryArea(this); Aircraft new plane = mem.newInstance( Aircraft.class); frame.getAircraft().update(new_plane); pos_in_table = mem.newInstance( Position.class); state.put( new_plane, pos_in_table); } pos_in_table.update( frame.getPosition()); } } class App extends NoHeapRealtimeThread { staticvoid main() { app.start(); } class Runner implements Runnable { void run() { Detector cd = new Detector( new StateTable() ); } } class Detector implements Runnable { StateTable state; … void run() { Frame frame = receiveFrame(); Position pos_in_table = state.get( frame.getAircraft()); if (pos_in_table == null) { Aircraft new plane = new Aircraft(); frame.getAircraft().update(new_plane); pos_in_table = new Position(); state.put( new_plane, pos_in_table); } pos_in_table.update( frame.getPosition()); } } void around (Object obj): execution ( void *.run() ) && this (obj) { if ( isGate (obj) ) new LTMemory(..).enter( new Runnable() { public void run() { proceed(); } }); } void around (Object obj): execution ( void *.run() ) && this (obj) { if ( isGate (obj) ) new LTMemory(..).enter( new Runnable() { public void run() { proceed(); } }); } raw RTSJ scoped types aspect summary

  24. class App extends NoHeapRealtimeThread { staticvoid main() { imm = ImmortalMemory.instance(); app = (App) imm.newInstance( App.class); app.start(); } void run() { LTMemory mem = new LTMemory( ...); mem.enter( new Runner() ); } } class Runner implements Runnable { void run() { LTMemory cdmem = new LTMemory(...); Detector cd = new Detector( new StateTable() ); while ( true ) cdmem.enter( cd ); } } class Detector implements Runnable { StateTable state; … void run() { Frame frame = receiveFrame(); Position pos_in_table = state.get( frame.getAircraft()); if (pos_in_table == null) { mem = MemoryArea.getMemoryArea(this); Aircraft new plane = mem.newInstance( Aircraft.class); frame.getAircraft().update(new_plane); pos_in_table = mem.newInstance( Position.class); state.put( new_plane, pos_in_table); } pos_in_table.update( frame.getPosition()); } } class App extends NoHeapRealtimeThread { staticvoid main() { app.start(); } class Runner implements Runnable { void run() { Detector cd = new Detector( new StateTable() ); } } class Detector implements Runnable { StateTable state; … void run() { Frame frame = receiveFrame(); Position pos_in_table = state.get( frame.getAircraft()); if (pos_in_table == null) { Aircraft new plane = new Aircraft(); frame.getAircraft().update(new_plane); pos_in_table = new Position(); state.put( new_plane, pos_in_table); } pos_in_table.update( frame.getPosition()); } } void around (Object obj): execution ( void *.run() ) && this (obj) { if ( isGate (obj) ) new LTMemory(..).enter( new Runnable() { public void run() { proceed(); } }); } void around (Object obj): execution ( void *.run() ) && this (obj) { if ( isGate (obj) ) new LTMemory(..).enter( new Runnable() { public void run() { proceed(); } }); } raw RTSJ aspect summary

  25. conclusions • require sophisticated mechanisms to support complex structure • AOSD provides linguistic support for software engineering principles • separation of concerns • modularity • STARS uses AOSD to achieve • separation of real-time mechanism from application code

More Related