About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and...
-
Upload
annabella-carson -
Category
Documents
-
view
218 -
download
0
description
Transcript of About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and...
About the Use of Correlations in Component Based Frameworks
Georg [email protected]
Department of Computing and Information Sciences
Kansas State University
b
Why Using Correlators?
Component C is receiving from two components A and B
A and B send at different rates
C needs both inputs to become active
Consider the following situation:
aA
B
Cab
b
Why Using Correlators!
We can: Reduce network
traffic Simplify computation
inside the component Clarify the design Define the
components in a more general way
Consider the following situation:
a
ab C
A
B
a + b
If we addcorrelations to
the infrastructure
Hello World!Scenario:Example scenario from introduction slides:
C
A
B
• Three Components A, B, and C • Component C receives • A and B send at different rates
TransformerFilter
Head
Hello World!φC correlation HelloWorld (φA a, φB b)a + b
{case true:push new φC { x := a.data,
y := b.data }}
Information about: which events arrived what data is present
The Two-Phase ModelConceptually, the correlator divides
into two distinct phases:1. The Filter2. The Transformere1 e3 e1 e2 e2
Stream of incoming events
Filter
Transformereout eout
Information about: which events arrived what data is present
Generates new output events
Detection ofevent patterns
Reacting to adetected pattern
And performs internal actions
Transformer
Filter
φC correlation HelloWorld (φA a, φB b)a + b
{case true:push new φC { x := a.data,
y := b.data }}
Back to “Hello World!”
In this simple examplethe transformer does
a type conversion!
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
Race ConditionScenario:Components A and B carry out a task
and deliver the results to C.Component C expects the results to
come in first from A, then from B.
The resulting race condition betweenA and C can be caught with a
correlator.
Race ConditionSolution:φdata correlation CatchRacing (φdata a, φdata b)
a + b{
case true:push a;push b;
}
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
Most Recent / EarliestScenario:A component C receives from A and B.
a + bwhen both events arrive, C wants the
most recent (earliest) of both forwarded.
We change the filter expression to:la:(a ; b) | lb:(b ; a)
Most Recent / EarliestφData correlation First
(φData a; φData b)la:(a; b) | lb:(b; a)
{case la: push a;case lb: push b;
}
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
Double MatchConsider the following filter expression:
(a + b) | (a + c)
And the following streams:
a b a a c c …
a c a b b a …
c b b c a a …
matches: a + bmatches: a + cmatches: a + band a + c
Double Match
(a + b) | (a + c)
l1:(a + b) | l2:(a + c)
Adding Labels to the expression
Double Matchl1:(a + b) | l2:(a + c)
Transformer 1: Send a general notification
{case true: push new φnote {};
}
Double Matchl1:(a + b) | l2:(a + c)
Transformer 2: Send two outputs
{case l1: push b;case l2: push c;
}
Double Matchl1:(a + b) | l2:(a + c)
Transformer 3: Send one output, withpriority on b if present.
{case l1: push b;case l2 & !l1: push c;
}
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
Interleaving EventWe consider three subexpressions x1, x2, x3. x2 shall not interleave between x1 and x3.
x1 ; (l2:(x2 ; x3) | l3:x3)
φ correlation Interleaving (...)x1 ; (l2:(x2 ; x3) | l3:x3)
{case l2: push some error event;case l3 & !l2: push some success event;
}
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
Redundant-Sensor-ArrayConsider an array of redundant components
A1, A2, …, An.and a single receiving component B, interested in the accumulation of all events
a1, a2, …, an.The filter expression is then
a1 + a2 + … + an
An
A3A2
…
A1 +B
Redundant-Sensor-Arraya1 + a2 + … + an
In a component system some components
can be temporarily unavailable!If one component does not send anymore
the whole pattern is never satisfied!
An
A3A2
…
A1 +B
An
A3A2
…
A1
Redundant-Sensor-ArrayNotify correlation SensorArray (Notify a1, …, Notify an, Control c1, …, Control cn)l1:a1 + … + ln:an || m1:c1 || … || mn:cn
{ case l1 & … & ln: push new Notify {} case m1: toggle l1 …case mn: toggle ln
}
Sensor
Array
B
C
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
Mode-AwarenessScenario:This scenario generalizes the previous.
Instead of single devices to switch on or off, we have a several modes to chose from.The same mechanism is used
to switch between modesas previously to switch the
different devices on and off.
Mode Awarenessn filter expressions, labeled with n
labels:m1:e1 || … || mn:en
n labeled control events:l1:c1 || … || ln:cn
Mode Awarenessφout correlation Modal3(φc c1, φ c c2, φ c c3, arguments for ei…)m1: e1 || m2: e2 || m3: e3 ||l1: c1 || l2: c2 || l3: c3
{abort (m2, m3);
clauses for e1, e2, e3…
case l1: revive (m1); abort (m2, m3);case l2: revive (m2); abort (m1, m3);case l3: revive (m3); abort (m1, m2);
}
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
Periodic Checks of Aperiodic EventsScenario:We introduce a periodic supervisor
component into an aperiodic system.
Whenever a clock-tick occurs, a sample is collected and sent to the supervisor.
φsample correlation PeriodicChck(φtimer t, φa a, φb b, φc c)t ; (l1:(a + b + c) | l2:t)
{case l1:push new φsample{d1 := a.data,d2 := b.data,
d3 := c.data }case l2:push some error event (missed sample);
}
Periodic Checks of Aperiodic Events
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
These are our examples.Feel free to add your own…