SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
For Coordination, State Component Transitions
Simon Bliudze
Anastasia Mavridou
Alina Zolotukhina
Rigorous System Design Laboratory (EPFL)
{firstname.surname}@epfl.ch

Radoslaw Szymanek
Crossing-Tech S.A.
radoslaw.szymanek@crossing-tech.com
With partial support from
the Swiss Commission for Technology and Innovation
BIP background
A framework and a toolset for component-based
system design
Developed and maintained

• by Verimag and RiSD
• directed by Joseph Sifakis
(ACM Turing award 2007)

We apply lessons learned
from Embedded Systems
to Java

2
Need for coordination

Independent software entities share access to resources.
Communication and data exchange can be complex.
Component execution must be coordinated.
3
Semaphores, locks, monitors, etc.

Coordination based on low-level primitives rapidly
becomes unpractical.
4
Synchronisation

Task 1:

Task 2:

...
free(S1);
take(S2);
...

...
take(S1);
free(S2);
...

A simple synchronisation barrier
5
Synchronisation
Task 1:

Task 2:

Task 3:

...
free(S1);
free(S1);
take(S2);
take(S3);
...

...
take(S1);
free(S2);
free(S2);
take(S3);
...

...
take(S1);
take(S2);
free(S3);
free(S3);
...

Three-way synchronisation barrier
6
Can we do worse? Yes, we can!
Task 1:

Task 2:

initialise(x);
free(S1);
take(S2);
sh = max(x, sh);
free(S2);
take(S1);
x = sh;

initialise(y);
take(S1);
free(S2);
sh = max(y, sh);
take(S2);
free(S1);
y = sh;

Coordination mechanisms mixed up
with computation do not scale.
7
Can we do worse? Yes, we can!
Task 1:

Task 2:

initialise(x);
free(S1);
take(S2);
sh = max(x, sh);
free(S2);
take(S1);
x = sh;

initialise(y);
take(S1);
free(S2);
sh = max(y, sh);
take(S2);
free(S1);
y = sh;

Coordination mechanisms mixed up
with computation do not scale.
Code maintenance is a nightmare!

7
Separation of concerns: The BIP approach

b1
f1

b1

r1

b2

f1
p1
p1

r1

r2
f2

f2

p2
b2

p2

r2

Coordination glue is a separate entity
Component behaviour specified by Finite State Machines
8
Finite State Machines are everywhere

http://www.uml-diagrams.org

Android MediaRecorder interface
http://developer.android.com/reference/
android/media/MediaRecorder.html
9
BIP by example: Mutual exclusion
b1

f1

b2

sleep

f1

f2
sleep

b1

f2

work

b2
work

Interaction model:
{b1, f1, b2, f2, b1f2, b2f1}
Maximal progress:
b1 < b1 f2, b2 < b2 f1
Design front-end
Semantic back-end

sleep
sleep

f1
work
sleep

b1
b2
b 1b 2
f1b2
b2

f2

f2

f1f2
work
work

b1f2
b1
f1

sleep
work

sleep
sleep

f1
work
sleep

b1
f1b2

f1

b2
b1f2
b1

b2
f2

f2

work
work

f1

sleep
work

sleep
sleep

work
sleep

f2

b1
f1b2

f2
b2
b1f2

work
work

sleep
work

f1
10
Engine-based execution
1. Components
notify the Engine
about enabled
transitions.

B

E

H

A

V

I

O

U

R

Interactions

Priorities

2. The Engine
picks an
interaction and
instructs the
components.
11
OSGi bundle states
install
Installed
uninstall
Uninstalled

uninstall

up
da
te
resolve
Resolved

start
Starting

Stopping
stop
Active

Only lifecycle state is shown.
All functional states are hidden in the ‘Active’ state.
12
Use case: Camel Routes

Many independent routes share memory

• We have to control the memory usage
• e.g., by limiting to only a safe number of routes
simultaneously

13
Camel routes
public class RouteBuilder(...)
{
from(…).routeId(…).process(…).to(…);
}

Camel API: suspendRoute and resumeRoute
Transition types:

•
• Spontaneous
Enforceable

(can be controlled by the Engine)

working

off

finishing
off

begin

end

end

off

(inform about uncontrollable external events)

ready
begin

end
suspended

on

on
14
Use case: BIP model
BIP Specifications

working

off

finishing
off

finished
off

begin

off

end

off

done
end
[!g]

end

end

internal
[g]
wait
off

ready

on

begin

end
suspended

on

on

on
finished

on

add
add
0

rm
add
1

rm

2
rm

BIP Monitor

The Monitor component
limits the number of
active routes to two
15
Implemented architecture
Spring app context bundle
BIP Component

Spring
bean to
control

Notifier

BIP
Control
Spec
BIP
Model
Executor

Interaction
specification
inform

execute

OSGi bundle
BIP Component

BIP Monitor
Spec

BIP Model
Executor

Behaviour
specification

Arrows:

• Blue — API calls between model and entity
• Red — OSGi-managed through published services
• Green — called once at initialisation phase

16
BIP Specification: Ports, Initial state
@bipPorts({
@bipPort(name = "end", type = "spontaneous"),
@bipPort(name = "off", type = "enforceable"),
…
})
@bipComponentType(
initial = "off",
name = "org.bip.spec.switchableRoute")
public class SwitchableRoute
implements CamelContextAware,
InitializingBean,
DisposableBean
{ … }

Behavior
finished
off

off

done
end
[!g]

internal
[g]
wait

on

end
off

on

on
finished
17
BIP Specification: Transitions
@bipTransition(name = "off",
source = "on", target = "wait", guard = "")
public void stopRoute() throws Exception {
camelContext.suspendRoute(routeId);
}

Transition annotations provide

•
•
•

Label: a port, declared by @bipPort
Source and target states
Guard expression

Behavior
finished
off

off

done
end
[!g]

internal
[g]
wait

on

end
off

on

on
finished
18
BIP Specification: Guards
@bipTransition(name = "end",
source = "wait", target = "done",
guard = "!isFinished")
public void spontaneousEnd() throws Exception { … }
@bipTransition(name = "",
source = "wait", target = "done",
guard = "isFinished")
public void internalEnd() throws Exception { … }
Behavior
finished
off

off

done
end
[!g]

internal
[g]
wait

on

end
off

on

on
finished
19
BIP Specification: Guards
@bipTransition(name = "end",
source = "wait", target = "done",
guard = "!isFinished")
public void spontaneousEnd() throws Exception { … }
@bipTransition(name = "",
source = "wait", target = "done",
guard = "isFinished")
public void internalEnd() throws Exception { … }
@bipGuard(name = "isFinished")
Behavior
public boolean isFinished() {
finished
CamelContext cc = camelContext;
off
done
return
end
cc.getInflightRepository().size(
[!g]
wait
cc.getRoute(routeId).getEndpoint()
end
) == 0;
off
}
on

off

internal
[g]

on

on
finished
19
BIP Component interface
public interface BIPComponent extends BIPSpecification
{
void execute(String portID);
void inform(String portID);
}

Interface methods:

• execute — called by the Engine to
•

execute an enforceable transition
inform — called by Notifiers to inform
about spontaneous events

Behavior
finished
off

off

done
end
[!g]

internal
[g]
wait

on

end
off

on

on
finished
20
BIP Executor interface
public interface Executor extends BIPComponent {
void publish();
void unpublish();
void register(BIPEngine bipEngine);
void deregister();
}

Interface methods:

• publish/unpublish
•

— collaborates with OSGi

service registry
register/deregister — manage connection with the
BIP Engine

Implements the component execution semantics

21
Spontaneous event notifiers
new RoutePolicy() {
…
public void onExchangeDone(
Route route, Exchange exchange)
{
executor.inform("end");
}
}

BIP Specification may also need
to know it’s executor in order to
set up notification mechanisms

Behavior
finished
off

off

done
end
[!g]

internal
[g]
wait

on

end
off

on

on
finished
22
Conclusion: Separation of concerns

Coordination code depends on the execution
environment
No coordination code in business components
Coordination code is confined to

• BIP Glue specification
• BIP Specification of the monitors imposing system
properties

23
Conclusion: Developer perspective

Developer provides BIP Spec as a Java class
BIP Spec is reusable
BIP Executor

• implements the BIP semantics
• interacts with the BIP Engine
24
Future work

• Data transfer
• Exception handling & transaction support
• Further experimentation with real-life applications
• Adding BIP coordination to the OSGi standard

25
!
u
o
y
k
n
?
a
s
h
n
T
io
t
s
e
u
q
y
n
A
State stability

working

off

finishing
off

begin

end

end

off
suspended

ready
begin

end

on

on

It must be possible to postpone the treatment of
spontaneous events.
27
working

off

begin
end

finishing

finishing

end
begin

end
off

ready

off

off

on

suspended

suspended
on

end

on

finishing

off

end

suspended

finished
done
internal
[g]

end
[!g]

internal
[!g]

on

wait

wait

suspended
end
[!g]

internal
[g]

on

internal
[g]

off

on

on

wait

off
on

off
on

g = isFinished()
28

Weitere ähnliche Inhalte

Was ist angesagt?

VLSI Experiments I
VLSI Experiments IVLSI Experiments I
VLSI Experiments I
Gouthaman V
 
Data Acquisition
Data AcquisitionData Acquisition
Data Acquisition
azhar557
 
ECE_467_Final_Project_Report
ECE_467_Final_Project_ReportECE_467_Final_Project_Report
ECE_467_Final_Project_Report
Sidharth Kumar
 

Was ist angesagt? (12)

VLSI Experiments I
VLSI Experiments IVLSI Experiments I
VLSI Experiments I
 
Verilog lab mauual
Verilog lab mauualVerilog lab mauual
Verilog lab mauual
 
Unit 2 module-2
Unit 2 module-2Unit 2 module-2
Unit 2 module-2
 
Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.
 
Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECE
 
Dynamic Binary Analysis and Obfuscated Codes
Dynamic Binary Analysis and Obfuscated Codes Dynamic Binary Analysis and Obfuscated Codes
Dynamic Binary Analysis and Obfuscated Codes
 
Data Acquisition
Data AcquisitionData Acquisition
Data Acquisition
 
ECE_467_Final_Project_Report
ECE_467_Final_Project_ReportECE_467_Final_Project_Report
ECE_467_Final_Project_Report
 
How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protections
 
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander NasonovMultiplatform JIT Code Generator for NetBSD by Alexander Nasonov
Multiplatform JIT Code Generator for NetBSD by Alexander Nasonov
 
An Open Discussion of RISC-V BitManip, trends, and comparisons _ Claire
 An Open Discussion of RISC-V BitManip, trends, and comparisons _ Claire An Open Discussion of RISC-V BitManip, trends, and comparisons _ Claire
An Open Discussion of RISC-V BitManip, trends, and comparisons _ Claire
 
Practical file
Practical filePractical file
Practical file
 

Ähnlich wie For Coordination, State Component Transitions - Radoslaw Szymanek, Simon Bliudze

Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
chiportal
 
UA Mobile 2012 (English)
UA Mobile 2012 (English)UA Mobile 2012 (English)
UA Mobile 2012 (English)
dmalykhanov
 
Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdf
SamHoney6
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
sean chen
 
SiliconFailsafeForIoT_Doin
SiliconFailsafeForIoT_DoinSiliconFailsafeForIoT_Doin
SiliconFailsafeForIoT_Doin
Jonny Doin
 

Ähnlich wie For Coordination, State Component Transitions - Radoslaw Szymanek, Simon Bliudze (20)

Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
Appsec obfuscator reloaded
Appsec obfuscator reloadedAppsec obfuscator reloaded
Appsec obfuscator reloaded
 
Migrating Objective-C to Swift
Migrating Objective-C to SwiftMigrating Objective-C to Swift
Migrating Objective-C to Swift
 
UA Mobile 2012 (English)
UA Mobile 2012 (English)UA Mobile 2012 (English)
UA Mobile 2012 (English)
 
Android 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and NetworkAndroid 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and Network
 
IOT Firmware: Best Pratices
IOT Firmware:  Best PraticesIOT Firmware:  Best Pratices
IOT Firmware: Best Pratices
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
When virtualization encounters afl blackhat eu2016--1.4
When virtualization encounters afl blackhat eu2016--1.4When virtualization encounters afl blackhat eu2016--1.4
When virtualization encounters afl blackhat eu2016--1.4
 
Introducing the Sun SPOTs
Introducing the Sun SPOTsIntroducing the Sun SPOTs
Introducing the Sun SPOTs
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 
ez-clang C++ REPL for bare-metal embedded devices
ez-clang C++ REPL for bare-metal embedded devicesez-clang C++ REPL for bare-metal embedded devices
ez-clang C++ REPL for bare-metal embedded devices
 
Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2
 
Web Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdfWeb Template Mechanisms in SOC Verification - DVCon.pdf
Web Template Mechanisms in SOC Verification - DVCon.pdf
 
Global Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the Seal
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
 
SiliconFailsafeForIoT_Doin
SiliconFailsafeForIoT_DoinSiliconFailsafeForIoT_Doin
SiliconFailsafeForIoT_Doin
 
Megamodeling of Complex, Distributed, Heterogeneous CPS Systems
Megamodeling of Complex, Distributed, Heterogeneous CPS SystemsMegamodeling of Complex, Distributed, Heterogeneous CPS Systems
Megamodeling of Complex, Distributed, Heterogeneous CPS Systems
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation
 
PhD Slides
PhD SlidesPhD Slides
PhD Slides
 

Mehr von mfrancis

Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
mfrancis
 
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
mfrancis
 
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
mfrancis
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
mfrancis
 

Mehr von mfrancis (20)

Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
 
OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)
 
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
 
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank LyaruuOSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
 
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
 
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
 
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
 
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
 
OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)
 
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
 
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
 
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
 
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
 
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
 
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
 
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
 
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
 
How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

For Coordination, State Component Transitions - Radoslaw Szymanek, Simon Bliudze

  • 1. For Coordination, State Component Transitions Simon Bliudze Anastasia Mavridou Alina Zolotukhina Rigorous System Design Laboratory (EPFL) {firstname.surname}@epfl.ch Radoslaw Szymanek Crossing-Tech S.A. radoslaw.szymanek@crossing-tech.com With partial support from the Swiss Commission for Technology and Innovation
  • 2. BIP background A framework and a toolset for component-based system design Developed and maintained • by Verimag and RiSD • directed by Joseph Sifakis (ACM Turing award 2007) We apply lessons learned from Embedded Systems to Java 2
  • 3. Need for coordination Independent software entities share access to resources. Communication and data exchange can be complex. Component execution must be coordinated. 3
  • 4. Semaphores, locks, monitors, etc. Coordination based on low-level primitives rapidly becomes unpractical. 4
  • 6. Synchronisation Task 1: Task 2: Task 3: ... free(S1); free(S1); take(S2); take(S3); ... ... take(S1); free(S2); free(S2); take(S3); ... ... take(S1); take(S2); free(S3); free(S3); ... Three-way synchronisation barrier 6
  • 7. Can we do worse? Yes, we can! Task 1: Task 2: initialise(x); free(S1); take(S2); sh = max(x, sh); free(S2); take(S1); x = sh; initialise(y); take(S1); free(S2); sh = max(y, sh); take(S2); free(S1); y = sh; Coordination mechanisms mixed up with computation do not scale. 7
  • 8. Can we do worse? Yes, we can! Task 1: Task 2: initialise(x); free(S1); take(S2); sh = max(x, sh); free(S2); take(S1); x = sh; initialise(y); take(S1); free(S2); sh = max(y, sh); take(S2); free(S1); y = sh; Coordination mechanisms mixed up with computation do not scale. Code maintenance is a nightmare! 7
  • 9. Separation of concerns: The BIP approach b1 f1 b1 r1 b2 f1 p1 p1 r1 r2 f2 f2 p2 b2 p2 r2 Coordination glue is a separate entity Component behaviour specified by Finite State Machines 8
  • 10. Finite State Machines are everywhere http://www.uml-diagrams.org Android MediaRecorder interface http://developer.android.com/reference/ android/media/MediaRecorder.html 9
  • 11. BIP by example: Mutual exclusion b1 f1 b2 sleep f1 f2 sleep b1 f2 work b2 work Interaction model: {b1, f1, b2, f2, b1f2, b2f1} Maximal progress: b1 < b1 f2, b2 < b2 f1 Design front-end Semantic back-end sleep sleep f1 work sleep b1 b2 b 1b 2 f1b2 b2 f2 f2 f1f2 work work b1f2 b1 f1 sleep work sleep sleep f1 work sleep b1 f1b2 f1 b2 b1f2 b1 b2 f2 f2 work work f1 sleep work sleep sleep work sleep f2 b1 f1b2 f2 b2 b1f2 work work sleep work f1 10
  • 12. Engine-based execution 1. Components notify the Engine about enabled transitions. B E H A V I O U R Interactions Priorities 2. The Engine picks an interaction and instructs the components. 11
  • 13. OSGi bundle states install Installed uninstall Uninstalled uninstall up da te resolve Resolved start Starting Stopping stop Active Only lifecycle state is shown. All functional states are hidden in the ‘Active’ state. 12
  • 14. Use case: Camel Routes Many independent routes share memory • We have to control the memory usage • e.g., by limiting to only a safe number of routes simultaneously 13
  • 15. Camel routes public class RouteBuilder(...) { from(…).routeId(…).process(…).to(…); } Camel API: suspendRoute and resumeRoute Transition types: • • Spontaneous Enforceable (can be controlled by the Engine) working off finishing off begin end end off (inform about uncontrollable external events) ready begin end suspended on on 14
  • 16. Use case: BIP model BIP Specifications working off finishing off finished off begin off end off done end [!g] end end internal [g] wait off ready on begin end suspended on on on finished on add add 0 rm add 1 rm 2 rm BIP Monitor The Monitor component limits the number of active routes to two 15
  • 17. Implemented architecture Spring app context bundle BIP Component Spring bean to control Notifier BIP Control Spec BIP Model Executor Interaction specification inform execute OSGi bundle BIP Component BIP Monitor Spec BIP Model Executor Behaviour specification Arrows: • Blue — API calls between model and entity • Red — OSGi-managed through published services • Green — called once at initialisation phase 16
  • 18. BIP Specification: Ports, Initial state @bipPorts({ @bipPort(name = "end", type = "spontaneous"), @bipPort(name = "off", type = "enforceable"), … }) @bipComponentType( initial = "off", name = "org.bip.spec.switchableRoute") public class SwitchableRoute implements CamelContextAware, InitializingBean, DisposableBean { … } Behavior finished off off done end [!g] internal [g] wait on end off on on finished 17
  • 19. BIP Specification: Transitions @bipTransition(name = "off", source = "on", target = "wait", guard = "") public void stopRoute() throws Exception { camelContext.suspendRoute(routeId); } Transition annotations provide • • • Label: a port, declared by @bipPort Source and target states Guard expression Behavior finished off off done end [!g] internal [g] wait on end off on on finished 18
  • 20. BIP Specification: Guards @bipTransition(name = "end", source = "wait", target = "done", guard = "!isFinished") public void spontaneousEnd() throws Exception { … } @bipTransition(name = "", source = "wait", target = "done", guard = "isFinished") public void internalEnd() throws Exception { … } Behavior finished off off done end [!g] internal [g] wait on end off on on finished 19
  • 21. BIP Specification: Guards @bipTransition(name = "end", source = "wait", target = "done", guard = "!isFinished") public void spontaneousEnd() throws Exception { … } @bipTransition(name = "", source = "wait", target = "done", guard = "isFinished") public void internalEnd() throws Exception { … } @bipGuard(name = "isFinished") Behavior public boolean isFinished() { finished CamelContext cc = camelContext; off done return end cc.getInflightRepository().size( [!g] wait cc.getRoute(routeId).getEndpoint() end ) == 0; off } on off internal [g] on on finished 19
  • 22. BIP Component interface public interface BIPComponent extends BIPSpecification { void execute(String portID); void inform(String portID); } Interface methods: • execute — called by the Engine to • execute an enforceable transition inform — called by Notifiers to inform about spontaneous events Behavior finished off off done end [!g] internal [g] wait on end off on on finished 20
  • 23. BIP Executor interface public interface Executor extends BIPComponent { void publish(); void unpublish(); void register(BIPEngine bipEngine); void deregister(); } Interface methods: • publish/unpublish • — collaborates with OSGi service registry register/deregister — manage connection with the BIP Engine Implements the component execution semantics 21
  • 24. Spontaneous event notifiers new RoutePolicy() { … public void onExchangeDone( Route route, Exchange exchange) { executor.inform("end"); } } BIP Specification may also need to know it’s executor in order to set up notification mechanisms Behavior finished off off done end [!g] internal [g] wait on end off on on finished 22
  • 25. Conclusion: Separation of concerns Coordination code depends on the execution environment No coordination code in business components Coordination code is confined to • BIP Glue specification • BIP Specification of the monitors imposing system properties 23
  • 26. Conclusion: Developer perspective Developer provides BIP Spec as a Java class BIP Spec is reusable BIP Executor • implements the BIP semantics • interacts with the BIP Engine 24
  • 27. Future work • Data transfer • Exception handling & transaction support • Further experimentation with real-life applications • Adding BIP coordination to the OSGi standard 25
  • 29. State stability working off finishing off begin end end off suspended ready begin end on on It must be possible to postpone the treatment of spontaneous events. 27