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

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

1 Lecture 11 Interfaces and Exception Handling from Chapters 9 and 10.
Java How to Program, 9/e CET 3640 Professor: Dr. José M. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
RTS - Implementation ITV Real-Time Systems Anders P. Ravn Aalborg University February 2006.
Programming R-T Abstractions TSW November 2009 Anders P. Ravn Aalborg University.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Exceptions in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Run time vs. Compile time
© Andy Wellings, 2003 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
Java How to Program, 9/e CET 3640 Professor: Dr. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
ACM/JETT Workshop - August 4-5, ExceptionHandling and User Interfaces (Event Delegation, Inner classes) using Swing.
Object Oriented Programming
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
Experience with Processes and Monitors in Mesa
Real-Time Java Martin Schöberl. Real Time Java2 Overview What are real-time systems Real-time specification for Java RTSJ issues, subset Real-time profile.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Compilation Technology © 2007 IBM Corporation CGO Performance Overheads In Real-Time Java Programs Mark Stoodley and Mike Fulton Compilation.
Real-Time Java on JOP Martin Schöberl. Real-Time Java on JOP2 Overview RTSJ – why not Simple RT profile Scheduler implementation User defined scheduling.
1 Comp 104: Operating Systems Concepts Java Development and Run-Time Store Organisation.
10/16/2015IT 3271 All about binding n Variables are bound (dynamically) to values n values must be stored somewhere in the memory. Memory Locations for.
Java Virtual Machine Case Study on the Design of JikesRVM.
Instructore: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Concurrent and.
© 2004, D. J. Foreman 2-1 Concurrency, Processes and Threads.
Dr. R R DOCSIT, Dr BAMU. Basic Java : Multi Threading 2 Objectives of This Session State what is Multithreading. Describe the life cycle of Thread.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
CSC 212 Stacks & Queues. Announcement Many programs not compiled before submission  Several could not be compiled  Several others not tested with javadoc.
Enhancements to Java for Real Time Systems Theresa Dsena CSE Fall 2006 Prof. Ganesan.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
1 Programming Languages and the Software Production Process Informal Cardelli’s metrics of programming languages fitness to real-time applications: Economy.
Advanced Java Programming CS 537 – Data Structures and Algorithms.
Processes Introduction to Operating Systems: Module 3.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 Reusing threads.
Introducing Allors Applications, Tools & Platform.
EEL Real-time Java part 2. EEL Acknowledgements All the lecture slides were adopted from the slides of Andy Wellings.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
111 G53SRP: RTSJ Memory Areas Chris Greenhalgh School of Computer Science.
Lecture 10 Concepts of Programming Languages Arne Kutzner Hanyang University / Seoul Korea.
Processes and Virtual Memory
Multithreaded programming  Java provides built-in support for multithreaded programming. A multithreaded program contains two or more parts that can run.
Exception Handling in Java Topics: Introduction Errors and Error handling Exceptions Types of Exceptions Coding Exceptions Summary.
Thread basics. A computer process Every time a program is executed a process is created It is managed via a data structure that keeps all things memory.
DØ Offline Reconstruction and Analysis Control Framework J.Kowalkowski, H.Greenlee, Q.Li, S.Protopopescu, G.Watts, V.White, J.Yu.
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
Threads in Java Threads Introduction: After completing this chapter, you will be able to code your own thread, control them efficiently without.
How to Compile Aspects with Real-Time Java Pengcheng Wu Northeastern University Mar. 14, 2005 FOAL Workshop with AOSD’05.
CMSC 202 Computer Science II for Majors. CMSC 202UMBC Topics Exceptions Exception handling.
Exceptions Lecture 11 COMP 401, Fall /25/2014.
© Andy Wellings, 2004 Thread Priorities I  Although priorities can be given to Java threads, they are only used as a guide to the underlying scheduler.
Concurrency in Java MD. ANISUR RAHMAN. slide 2 Concurrency  Multiprogramming  Single processor runs several programs at the same time  Each program.
Lecture 4 Page 1 CS 111 Online Modularity and Memory Clearly, programs must have access to memory We need abstractions that give them the required access.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Agenda Introduction Errors and Exception Exception Hierarchy Classification of Exceptions Built in Exceptions Exception Handling in Java User defined.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Design issues for Object-Oriented Languages
Multi Threading.
Concurrency, Processes and Threads
Modularity and Memory Clearly, programs must have access to memory
G53SRP: Asynchronous Events in RTSJ
Java Programming Language
Multithreaded Programming
Concurrency, Processes and Threads
Presentation transcript:

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

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

engineering infrastructure

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

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

application specific demands platform specific features Java Virtual Machine 2

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

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

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

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

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…

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

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

crosscutting structure

aspect-oriented software development (AOSD) aspect

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); } }); }

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

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

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

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

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); } }); }

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

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 class Main { static void main() { new App().start(); } } package 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); } class class class Position... package 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); } class class 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

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

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