Presentation is loading. Please wait.

Presentation is loading. Please wait.

Celina Gibbs Software Architecture Seng 522 STARS Scoped Types and Aspects for Realtime Systems.

Similar presentations


Presentation on theme: "Celina Gibbs Software Architecture Seng 522 STARS Scoped Types and Aspects for Realtime Systems."— Presentation transcript:

1 Celina Gibbs Software Architecture Seng 522 STARS Scoped Types and Aspects for Realtime Systems

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

3 engineering infrastructure

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

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

6 application specific demands platform specific features Java Virtual Machine 2

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

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

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

10 left to developer to decipher… 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. 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. Exceptions 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. 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. Runtime Exceptions 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. 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

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

12 heap memory plain java run-loop run application instructions terminate condition

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

14 crosscutting structure

15 aspect-oriented software development (AOSD) aspect

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; } 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); } }); } 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 scoped types and packages scopea scopea.scopeb scopea.scopeb.scopec imm mem cdmem parent

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

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

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

22 tool support static 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 summary class App extends NoHeapRealtimeThread { static void 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()); } raw RTSJ 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... scoped types class App extends NoHeapRealtimeThread { static void 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(); } }); } aspect

24 summary class App extends NoHeapRealtimeThread { static void 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()); } raw RTSJ class App extends NoHeapRealtimeThread { static void 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(); } }); } aspect

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


Download ppt "Celina Gibbs Software Architecture Seng 522 STARS Scoped Types and Aspects for Realtime Systems."

Similar presentations


Ads by Google