Asynchronous Communication Mechanisms (ACMs) Fei Xia Fei Xia - - PowerPoint PPT Presentation
Asynchronous Communication Mechanisms (ACMs) Fei Xia Fei Xia - - PowerPoint PPT Presentation
Asynchronous Communication Mechanisms (ACMs) Fei Xia Fei Xia EECE, Newcastle University
- Point to point connection
writer reader data writer reader Data is a stream of items of a set type. Writer and reader are cyclic processes. Writer provides one item of data per cycle. Reader uses one item per cycle.
- Simple approach
reader writer
t
b a
- An ACM divides temporal domains
writer timing domain reader timing domain writer reader ACM temporal divide
- Each process updates its
- wn control variables
- A process can only read the
value of a control variable of another process
- Concurrent processes
ACM reader writer
Shared memory Control variables
data data
- The shared memory is organized
as a set of cells
- A cell is a memory location that
can store one data item
- Each process has its own set of
control variables
- Concurrent processes
executing on different timing domains
- 1-bit control variables
- Does not require any
synchronization primitives
- Order of execution does
not interfere on the correctness of the result
data data
- Atomic register [Lamport 86]
- The problem of asynchronous communication can be solved using
shared registers
- Complex registers are built from simple ones
- ACMs [Simpson 87-03]
- Defined a fully ACM that preserves data-coherence with 4 slots
- Defined a fully ACM that preserves data-coherence with 4 slots
- Classification of ACMs
- Systematic synthesis of ACMs [Yakovlev Group 96-08]
- ACMs are modelled using MATLAB for use in higher level systems
- Automatic synthesis of ACMs [Gorgônio, Xia 05-08]
- State space generation (BFS based)
- Petri net synthesis using theory of regions
- Modular approach using Petri nets modules as building blocks
- Modelling and verification using CPN
- BB
BB RRBB RRBB ! ! OWBB OWBB OWRRBB OWRRBB ! ! OWBB OWBB OWRRBB OWRRBB
- Overwriting enables the writer to be fully asynchronous
- Rereading enables the reader to be fully asynchronous
- BB stands for bounded buffer
- ACM
Reader Writer Control variables Shared memory data data variables enough memory to enough memory to contain an arbitrary contain an arbitrary number of items number of items
"
C C0 C C1
1
C C
- 1
1
C C2
2
- cells in a ring … …
cells in a ring … …
#$
- RRBB with three cells from an interleaving specification
- rereading
cyclic waiting
""
- Adding “silent actions”
µ µ
- λ
- λ
µ µ
- λ: writer silent actions;
µ: reader silent actions
µ
- µ
µ
- λ
µ
- λ
λ
- µ
µ
- µ
µ
- λ
- prepare to
reread
""
µ µ
- λ
- λ
µ µ
- var : 0..-1; : 0..-1; initialized sensibly
(say =-1) and initialize data items in the cells. writer wr: write cell ; ww: wait until ≠+1; w0: :=(+1 mod ); reader r0: if (+1 mod )≠ then :=(+1 mod ); rd: read cell ;
µ
- λ
- µ
µ
- λ
µ
- λ
λ
- µ
µ
- µ
µ
- λ
- w0: :=(+1 mod );
rd: read cell ;
""
Reader Writer cell memory and ACM cell cell memory data data cell memory and ACM cell +1 Reader Writer data data advance advance
- var : 0..1; : 0..1; initialized sensibly (one cell has =1 and
another has =1, all others being 0) and initialize data in the cells. %
- %
- wr: write;
r0: if next=0 then w0: :=0; next:=1; begin :=0; next:=1; ww: wait until next=0; advance to next end wa: advance to next; rd: read;
!
- Needs more than one “slot” per cell
- This will allow the writer to “overtake” the reader if overwriting the oldest
item in the buffer
- Item to be overwritten can be
- Oldest in the buffer
- Newest in the buffer
- Newest in the buffer
- Some other item (does not make as much sense as the previous choices)
- Also has to do with if the ACM is organized as a FIFO, a stack or a random
bag
&!%""
µ µ µ
- λ
- µ
- λ
- λ
- µ
- µ
µ
- λ
- µ
µ λ µ
- λ
- λ
λ µ µ
- µ
µ λ λ
&!%""
writer writer
Control variables
x x x
slot 0 cell 0 cell 1 cell 2
reader reader
One-hot enconding (1-bit variable)
Control variables data
x00 x10 x20
slot 0 slot 1
x01
!%""
var : 0..1; : 0..1; : 0..1 (this cell is overwritten); : 0..1 (writer releases cell for reader); %
- w0: next:=0;
r0: if =1 then w0: next:=0; r0: if =1 then if ≠ then :=1; begin :=0; =(not); advance to next end wr: write slot ; :=; wa: :=1; rd: read slot ; next:=0; ra: if next=1 then advance to next; advance to next
'
Alex Yakovlev Alex Yakovlev Hugo Simpson Ian Clark Eric Campbell Jordi Cortadella Kyller Gorgonio