14
Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Embed Size (px)

Citation preview

Page 1: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Seminar on Component-based Software Engineering

Component Coordination

Nadia Ramjiawan

LIACS - Leiden University

Fall 2005

Page 2: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Component

Every component instance contains one or more active entities (thread of control).

The active entities inside a component C can communicate with the active entities in other components only through I/O operations performed on the channel ends connected to C.

Page 3: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Channels The only primitive medium of communication between two components.

A channel has exactly two ends.

A channel end is either: Source: accepts data into its channel. Sink: dispenses data out of its channel. Example:

ab represents the channel with source end a and sink end b.

Although every channel has exactly two ends, these ends can be of the same or different types (two sources, two sinks, or one source and one sink).

Various kinds of channel are possible, offering different synchronisation, buffering, lossy and even directionality policies.

Channel I/O Operations Read/write data items from /to their channel ends.

Page 4: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Abstract Behavior Type (ABT) Model

An ABT defines an abstract behavior as a relation among a set of timed-data-streams, without specifying any detail about: the operations that may be used to implement such behavior or the data types it may manipulate for its realization.

A timed data stream is a twin pair of streams consisting of a data stream and a time stream with the interpretation that ∀i≥0, the data item appears at its corresponding time moment

Used to model the data flow through channel ends.

Page 5: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

ABT Examples Basic channels

Synchronous channel :

Asynchronous unbounded FIFO channel :

Asynchronous FIFO channel with the bounded capacity of 1:

Page 6: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

ABT Examples (II)

Asynchronous FIFO channel with the bounded capacity of 1 and initially contain the data item D :

Synchronous drain channel: Two source ends, cannot produce any data items. Every data item is lost

Page 7: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Merge and Replicate

The merger ABT is defined as:

The replicator ABT is defined as:

Page 8: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Reo

The ABT model is too low level to provide non-trivial coordination, an effective exogenous coordination model is needed.

Reo is a channel-based exogenous coordination model wherein complex coordinators, called connectors are compositionally built of simpler ones. The simplest connectors in Reo are channels.

A connector is a set of channel ends and their connecting channels organized in a graph of nodes and edges(channels) such that:

Zero or more channel ends coincide on every node. Every channel end coincides on exactly one node. There is an edge between two nodes if and only if there is a channel one end of

which coincids on each of those nodes.

Powerful mechanism for connector construction: channel composition.

Page 9: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Nodes Reo defines three types of nodes

Source nodes: Src(N) ≠ ø ∧ Snk(N) = ø Src(N) and Snk(N): sets of source and sink channel ends

coincide on N, respectively. A source node replicates every data item written to it as soon

as all of its coincident source channel ends can consume that data item

Sink nodes: Src(N) = ø ∧ Snk(N) ≠ ø non-deterministically selects one of the data items available

through its coincident sink channel ends

Mixed nodes: Src(N) ≠ ø ∧ Snk(N) ≠ ø Combines the behavior of a sink node and a source node. Every time a data item is available through its coincident sink

channel ends it non-deterministically selects an appropriate data item and replicates that data item into all of its coincident source channel ends.

Page 10: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Nodes (II)

Node I/O operations: read and take can be done only on sink nodes write can be done on source nodes They can not be done on mixed nodes

A component can write to a source node and read from a sink node only if it is connected to that node

Components don’t read from or write to mixed nodes.

Page 11: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Examples of connectors in Reo Write-Cue Regulator

Channels ab and cd are of type Sync and ef is of type Syncdrain

Barrier Synchronizer The four channels ab, cd,

gh, ij are all of type Sync and ef is of type Syncdrain

Can be extended trivially

Page 12: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Example of connectors in Reo (II) Ordering

The channels ab and ac are Syncdrain and Sync, respectively and bc is of type FIFO1.

Coordination pattern c = (ab)*

Sequencer The enclosing box represents

the fact that the details of this connector are abstracted away: the topology inside the box is immutable

Inside the connector, four Sync, a FIFO1(o), and three FIFO1 channels are connected together.

Page 13: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Utility of the Sequencer

Two-node sequencer Coordination pattern c = (ab)*

Three-node sequencer Coordination pattern c = (aab)*

Page 14: Seminar on Component-based Software Engineering Component Coordination Nadia Ramjiawan LIACS - Leiden University Fall 2005

Questions

??