asynchronous communication mechanisms acms
play

Asynchronous Communication Mechanisms (ACMs) Fei Xia Fei Xia - PowerPoint PPT Presentation

Asynchronous Communication Mechanisms (ACMs) Fei Xia Fei Xia EECE, Newcastle University


  1. Asynchronous Communication Mechanisms (ACMs) Fei Xia Fei Xia EECE, Newcastle University

  2. ��������������������������� �������������������������� � Point to point connection data writer writer reader 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.

  3. ��������������� � Simple approach writer reader a b t

  4. ���� � An ACM divides temporal domains ACM writer reader writer timing domain reader timing domain temporal divide

  5. ��������� Each process updates its � ACM own control variables A process can only read the Control � writer reader variables value of a control variable of another process Shared memory Concurrent processes Concurrent processes data data data data � � executing on different timing domains The shared memory is organized 1-bit control variables � � as a set of � cells Does not require any � A cell is a memory location that synchronization primitives � can store one data item Order of execution does � Each process has its own set of not interfere on the � control variables correctness of the result

  6. ������� 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 �

  7. ������������������ ����� ������������� ������� �� ���������� ������� ���� ��������� ���� ��������� BB BB RRBB RRBB ! ��������� ! ��������� ! ��������� ! ��������� OWBB OWBB OWBB OWBB OWRRBB OWRRBB OWRRBB OWRRBB Overwriting enables the writer to be fully asynchronous � Rereading enables the reader to be fully asynchronous � BB stands for bounded buffer �

  8. ������������������� ACM Writer Reader Control variables variables Shared data data memory enough memory to enough memory to contain an arbitrary contain an arbitrary number of items number of items

  9. "�������� C C 0 0 C C 1 C � C 1 � -1 1 C C 2 2 � � cells in a ring … … cells in a ring … …

  10. #���������������$����� RRBB with three cells from an interleaving specification � � ��� ���� ��� ���� ���������� ���� ���� ���� ���� ���� ���� ���� ���� ���� ���������� ���������� ���� ���� ���� ���� ���������� ���� ���� ���� waiting ���� ���� ���� ���� ���� ���� ��� ��� ���� cyclic rereading

  11. ��"" Adding “silent actions” � ��� ��� µ �� � µ �� � λ ��� ���� ���� λ: writer silent actions; µ �� � ���� µ �� � ���� ���� ���� µ: reader silent actions λ ��� ���� ���� µ �� � µ �� � λ ��� ���� ���� µ �� � ���� µ �� � ���� ���� ���� prepare to λ ��� ���� ���� reread µ �� � µ �� � λ ��� ���� ���� µ �� � ���� µ �� � ���� ���� ���� λ ��� ���� ���� ��� ���

  12. ��""���������� var � : 0.. � -1; � : 0.. � -1; initialized sensibly (say � = � -1) and initialize data items in the cells. ��� ��� µ �� � µ �� � writer reader λ ��� ���� ���� wr: write cell � ; r0: if ( � +1 mod � )≠ � then � :=( � +1 mod � ); µ �� � ���� µ �� � ���� ���� ���� ww: wait until � ≠ � +1; λ ��� λ ��� ���� ���� ���� ���� w0: � :=( � +1 mod � ); w0: � :=( � +1 mod � ); rd: read cell � ; rd: read cell � ; µ �� � µ �� � λ ��� ���� ���� µ �� � ���� µ �� � ���� ���� ���� λ ��� ���� ���� µ �� � µ �� � λ ��� ���� ���� µ �� � ���� µ �� � ���� ���� ���� λ ��� ���� ���� ��� ���

  13. ��""��������������� ACM cell � Writer Reader � and � cell memory cell memory data data advance advance ACM cell � +1 Writer Reader � and � cell memory data data

  14. ������������������������ 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;

  15. ! ��������� 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

  16. � λ ����� λ ����� ���� µ ���� � µ ���� � ���� ���� ���� ��� ���� µ ���� � µ ���� � λ ����� λ ����� ���� ���� ���� ��� λ ����� λ ����� λ ����� λ ����� ��� ���� ���� µ ���� � µ ���� � &������!%��"" ���� ���� ���� ���� ���� ��� ���� µ ���� � λ ����� λ ����� µ ���� � ���� ��� µ ���� � µ ���� � µ ���� ���� ���� ��� µ ���� � µ ���� � µ

  17. &������!%��"" Control variables writer writer cell 0 cell 1 cell 2 slot 0 slot 0 x x 00 x x 10 x x 20 data x 01 slot 1 One-hot enconding (1-bit variable) reader reader Control variables

  18. ��������!%��""���������� var � : 0..1; � : 0..1; ���� : 0..1 (this cell is overwritten); ������� : 0..1 (writer releases cell for reader); %����� ������ w0: ���� next:=0; w0: ���� next:=0; r0: if ���� =1 then 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

  19. �������������������

  20. ��'������������� Alex Yakovlev Alex Yakovlev Hugo Simpson Ian Clark Eric Campbell Jordi Cortadella Kyller Gorgonio

Recommend


More recommend