Context awareness in real

Download Report

Transcript Context awareness in real

Context-related issues
in real-time systems
Context awareness

Context
• The state of the environment in which an
•

application operates
Potential attributes: location, identity, activity,
bandwidth, power, etc.
Context-awareness
• Ability to extract, interpret, and use context
information obtained from its environment
Context-Awareness
Sensors/Actuators
Digital Memories
Continuous Computing
ContextAwareness
Social Computing
In the Core …

Various different content formats are
emerging …
Flash
Real
PNG
WML
GIF
HTML
ASP
MPEG1
Quicktime
JPEG
MPEG4
DHTML
PHP
Windows Media
… At the Edge …

Various different user agents and
platforms are emerging …
Embedded Devices
Desktop
WAP Phone
Integrated Chip
PDA
Laptop
Palmtop
Real-time requirements in
context-aware applications

Context-aware applications interact with
physical environment
• Inherently has timeliness requirements.
• Correctness of context information
• Correctness of actions based on context
information
• Types of timeliness requirements
• Hard real-time
• Soft real-time
• Time-free
Challenges and requirements for
context-aware real-time services

Application level
• Capture of context data
• Gathering data from unreliable multi-modal sensors
• Uncertainty of context data
• Representation of context data
• Interpretation of context data
• Synchrony
• Synchronous operation cannot be adopted to embedded
•
systems.
Context data should be fed asynchronously.
• Privacy
• Scalability
Challenges and requirements for
context-aware real-time services

Middleware level
• Adaptability
• Provides various levels of QoS
• Cope with resource constraints
• Resource preservation
• Resource allocation and scheduling for satisfying various QoS
• Collaboration
• Context-aware applications can collaborate between entities.
• Group communication
• Synchrony
• Dynamic reconfiguration of connections and entities
• Scalability
• Fault-tolerance & consistency
Challenges and requirements for
context-aware real-time services

Networking level
• Adaptability
• Provides various levels of QoS
• Cope with resource constraints
• Limited bandwidth availability
• Unpredictable latency
• Heterogeneity
• End-to-end QoS
What makes up
Context-Aware Framework?
We’ve got information
(context)!
We’ve got agents!
We’ve got sensors!
Agents
Agents are a software abstraction.
 An agent is a program that assists people
and acts on their behalf.
 Agents are: reactive, autonomous, and
goal-driven.

For OO programmers…
Objects are described in terms of methods
Agents are described in terms of behaviors.
Information
Context in our framework is Semantic data.
 Context is described in a semantic
ontology. (OWL and RDF).
 An ontology is typically a hierarchical data
structure containing all the relevant
entities and their relationships and rules
within a domain of knowledge.

Making Agents Smarter…
Using formal ontologies allows agents to
share beliefs in a precise manner.
 Ontologies create inferred knowledge…

Example
I know Abernethy 210 is a space in a
structure called Abernethy, and that
structure is different from a structure
called Manning.
Making Agents Smarter…

Using a Rules Engine allows agents to make
deductions.
Example
If this is a classroom, and there is a class
scheduled, and you are the teacher, and
you have a syllabus =>
 I should fire up your presentation and
start recording.
 I should take attendance.
What is a Rules Engine?
Rules engines are tools for building
intelligent software, or expert systems.
 Rules collect facts about the world, and
continuously apply rules to those facts.
 Rules engines allow agents to make
deductions and plans by looking at the
context information.

When should I use a Rule Engine?
Complicated
logic (not 1+1 = 2)
Changes often (whatever that means)
Traditional approaches are unmaintainabl
e
Rules
• Rules are declarative
• Follow the pattern
– IF <condition> THEN <consequence>
• A rule firing (execution) can change
the state of the Working Memory
therefore possibly triggering other rules
to fire
Problems with rule engines

How can it be implemented?
• Dynamically loadable
• Heterogeneous environment
• Changes often

Solutions
• Machine-independent language
Interpreter/script language
• Open standard
 Use of XML
• Dynamically loadable
 JAVA is (virtually) the only solution (until now).
Problems of JAVA applications in
real-time systems

Thread management

Class loading

• How long it takes? – We don’t know.
Garbage collection

• How long it takes? How often it occurs?
Compile
• Priority-based scheduling is not supported.
• Class loading is delayed until it is referenced.
• System is suspended during GC
• Java byte codes are interpreted at run time.
• How long it takes to interpret?
• How long it takes to run?
Real-Time Specification for Java
RTSJ for short
 First JSR request
 Still not completely finished
 Implementations
• TimeSys RI
• Purdue OVM

Real Time Java
20
RTSJ Guiding Principles
Backward compatibility to standard Java
 Write Once, Run Anywhere
 Current real-time practice
 Predictable execution
 No Syntactic extension
 Allow implementation flexibility

Real Time Java
21
RTSJ Overview
Clear definition of scheduler
 Priority inheritance protocol
 NoHeapRealtimeThread
 Scoped memory to avoid GC
 Low-level access through raw memory
 High resolution time and timer

Real Time Java
22
RTSJ: Scheduling
Standard Java offers no guarantee
• Even non preemptive JVM possible
 Fixed priority
 FIFO within priorities
 Minimum of 28 unique priority levels
 GC priority level not defined

Real Time Java
23
RTSJ: Memory Areas
GC collected Heap
 Immortal memory
 Scoped memory
• LTMemory
• VTMemory
 Physical memory
• Different time properties
• Access to HW devices!

Real Time Java
24
RTSJ: Thread Types
Extensions to java.lang.Thread
• RealTimeThread
• NoHeapRealTimeThread
• AsyncEventHandler
 Scoped and immortal memory for NHRTT
• Strict assignment rules
• Not easy to use

Real Time Java
25
RTSJ: Synchronization
Use synchronized
 Priority inversion possible in standard Jav
a
 Priority inheritance protocol
 Priority ceiling emulation protocol

Real Time Java
26
RTSJ: Scoped Memory
• Cumbersome progr
amming style
• New class for each c
ode part
class UseMem implements Runnable {
public void run() {
// inside scoped memory
Integer[] = new Integer[100];
...
}
}
// outside of scoped memory
// in immortal? at initialization?
LTMemory mem = new LTMemory(1024, 102
4);
UseMem um = new UseMem();
// usage
computation() {
mem.enter(um);
}
Real Time Java
27
Asynchronous Event Handler
Difference between bound an unbound
• Implementation hint at application level
• No functional difference for the application
 Better: only one type
• Specify a minimum latency at creation
• Runtime system decides about implementatio

n
Real Time Java
28
Garbage Collection?
An essential part of Java
 Without GC it is a different computing mo
del
 RTSJ does not believe in real-time GC
 Real-time collectors evolve
 Active research area
• For You?

Real Time Java
29
RTSJ Issues
J2SE library:
• Heap usage not documented
• OS functions can cause blocking
 On small systems:
• Large and complex specification
• Expensive longs (64 bit) for time values

Real Time Java
30