Académique Documents
Professionnel Documents
Culture Documents
&
Asynchronous Transfer of Control
Jihua Zhong
Marc E Loy
Maung Han
Seminor in Real-time Systems
Instructor: Professor Insup Lee
Different Flavours of Java
(Java Java Personal Embedded
Family) (J2SE, Java Java
J2EE) (J2ME)
ROM Size 4 MB <2 MB < 512 KB
Handler B
Handler A
event1.addHandler(hdlrA);
System.out.println(“AsyncEvent Test.\n”);
event1.fire();
System.out.println(“Event fired.\n”);
} // main()
Use of AEv Handling
In real-time systems, there can be hundreds
(or even thousands) of possible events.
But usually, only few happens at one time.
Impractical to create and assign one thread
for each possible event.
AEv Handling offers low cost alternative to
threads.
Not like methods, AEv handlers can be
scheduled and executed asynchronously.
II. ATC
(Asynchronous Transfer of Control)
Some change in
the system
environment needs
immediate
attention.
Abandon current
execution or take
appropriate action.
AIE
(AsynchronouslyInterruptedException)
Object
Throwable
Exception
Interruptible (I)
InterruptedException
AsynchronouslyInterruptedException
Parameter for
AIE.doInterruptible()
Timed
AIE (contd.)
myAie.doInterruptible(mc); // run
Memory Management
Purpose
To allow memory areas of different
behavior to be accessed by real-time
tasks.
Specify memory consumption behavior
of RT tasks.
RT tasks can enter and exit memory
areas and allocate objects as needed.
Memory Class Types
MemoryArea
Heap Memory (normal Java Heap)
Scoped Memory (limited lifetime.)
Immortal Memory (app lifetime)
ImmortalPhysicalMemory (app lifetime, physical)
PhysicalMemoryFactory (Supply physical
mem to other mem objects, e.g. DMA, Byte
swapping)
RawMemoryAccess (Drivers, Memory
mapped I/O)
Memory Class Hierarchy
VTMemory
Object HeapMemory
LTMemory
MemoryArea ScopedMemory
ScopedPhysicalMemory
ImmortalMemory
ImmortalPhysicalMemory
PhysicalMemoryFactory
RawMemoryAcess RawMemoryFloatAcess
Scoped Memory Rules
Reference to an object in ScopeMemory;
Can never be stored in an object in Java Heap.
Can never be stored in an object in
ImmortalMemory.
Can be stored in an object in the same scope or
inner scope memory.
An object in Immortal or Heap may store
references in ScopeMemory.
ScopeMemory activation
An area of ScopeMemory can become active
for a thread by;
Calling enter() method of ScopeMemory object.
Creating instances of objects in ScopeMemory.
ScopeMemory areas can be activated in
nested manner.
Objects in an inner scope can refer to outer
scopes, but not the other way.
Conclusion
Java is trying to become real-time capable.
Most systems today are either non real-time
or implement only a subset of RTSJ.
We expect to see more complete and robust
implementations soon with increasingly
popular embedded and real-time systems.