CFSM: Communicating Finite State Machines C1 1 +A 1 -R 2 Sender -A C2 1 Initial node with double circle, every CSFM only has one initial state 2 State of a CFSM +R 2 Receiver 1 CFSM CFSM -R Transition of a CFSM - sign in label sending Communicating Finite State Machine + sign in label receiving Is represented by states and transitions 2 string after signmsg type and connected to channels. This transition sends msg Here sender machine has two channels: R to the CFSM’s outgoing C1 and C2. Channel are assumed to be FIFO. channel. C1 is the outgoing channel for sender. It can also be represented C2 is the incoming channel for sender. as (1, 2, -R) When the sending transition of sender fires, It sends the msg in transition label to the outgoing channel. The receiving transition can only occurs if there is a msg of the same type in the head of CFSM’s incoming channel. 8/29/2001 Reachability Analysis Page 1 Operation of CFSM C1 1 current state 1 -R +A +R -A 2 Sender 2 Receiver C2 When the network starts, the current states of both machines are set at their initial states. Receiver at state 1 can not fire the outgoing transition (1, 2, +R) Sender at state 1 can fire the outgoing transition (1, 2, -R), and result in current state of sender changed to 2 and msg R is put in channel C1. C1 1 +A -R 2 Sender 8/29/2001 1 R -A C2 Reachability Analysis +R 2 Receiver Page 2 Operation of CFSM: Step 2 C1 R 1 -R +A 2 Sender 1 +R -A 2 Receiver C2 • Now sender at state 2 has (2,1,+A) as its outgoing transition. There is no msg A in C2, therefore this receiving transition cannot be fired. It waits. • Receiver at state 1 checks its outgoing receiving transition (1,2,+R) and found the msg label matched with the msg in the head of C1. It fires the transition, takes in the msg R (removes from C1) and changes its current state to state 2. C1 1 +A 1 -R 2 Sender 8/29/2001 -A C2 Reachability Analysis +R 2 Receiver Page 3 Operation of CFSM: Step 3 C1 R 1 -R +A 2 Sender 1 +R -A 2 Receiver C2 • Now sender at state 2 has (2,1,+A) as its outgoing transition. There is no msg A in C2, therefore this receiving transition cannot be fired. It waits. • Receiver at state 1 checks its outgoing receiving transition (1,2,+R) and found the msg label matched with the msg in the head of C1. It fires the transition, takes in the msg R (removes from C1) and changes its current state to state 2. C1 1 +A 1 -R 2 Sender 8/29/2001 -A C2 Reachability Analysis +R 2 Receiver Page 4 Operation of CFSM: Step 4 C1 1 1 -R +A 2 Sender +R -A C2 2 Receiver • Now sender still at state 2 has (2,1,+A) as its outgoing transition. There is no msg A in C2, therefore this receiving transition cannot be fired. It waits. • Receiver at state 2 checks its outgoing sending transition (1,2,-A). It fires the transition, put msg A in C2, and changes its current state to state 2. C1 1 +A 1 -R 2 Sender 8/29/2001 -A A C2 Reachability Analysis +R 2 Receiver Page 5 Operation of CFSM: Step 5 C1 1 1 -R +A 2 Sender +R -A A C2 2 Receiver • Receiver at state 1 checks its outgoing sending transition (1,2,+R). There is no msg R in C1. It waits. • Now sender at state 2 has (2,1,+A) as its outgoing transition. There is a msg A in C2, therefore this receiving transition can be fired. It reads in A (remove from C2) and changes state to 1. Now Both machines get back to their initial states. C1 1 +A 1 -R 2 Sender 8/29/2001 -A C2 Reachability Analysis +R 2 Receiver Page 6 What could happen next? C1 1 +A 1 -R -A 2 Sender +R 2 Receiver C2 • In CFSM model, we assume only one transition can be fired in a time. No two simultaneous firing. Sender: (1,2,-R) Receiver: (2,1,-A) C1 C1 1 +A 1 1 -R 2 Sender 8/29/2001 -A A C2 +R 2 Receiver +A -R 2 Sender Reachability Analysis 1 R -A C2 +R 2 Receiver Page 7 What could happen next? C1 R 1 +A 1 -R -A 2 Sender -B +R 2 Receiver C2 • Sender cannot move. • Receiver can either receive msg R or send msg B. • How many msgs can be in C1 for this network? How about C2? Receiver: (1,2,-B) Receiver: (1,2,+R) C1 R C1 1 +A 1 1 -R 2 Sender 8/29/2001 C2 -A -B +R 2 Receiver +A -R 2 Sender Reachability Analysis B C2 1 -A -B +R 2 Receiver Page 8 What could happen next? C1 1 +A 1 -R 2 Sender -A C2 +R 2 Receiver • Receiving state is a state where all its outgoing transition are all receiving transition. It can not move without msg in its incoming channel. • Both machines are at receiving states and channels are empty. This is called deadlock. The network can not progress further. 8/29/2001 Reachability Analysis Page 9 Unspecified Reception Error C1 1 +A 1 -R 2 Sender -A B C2 +R 2 Receiver • There is msg B in C2 but sender does not have a receiving transition with msg B. • This is called unspecified reception. The network can not progress further. 8/29/2001 Reachability Analysis Page 10 Non-executable States and Transitions C1 1 +A 1 -R 2 Sender -A B C2 -C +R 2 +B Receiver 3 • State 3 of Receiver will never be executed or become the current state. It is called non-executable state. • Transitions (2,3,+B) and (3,1,-C) will never be executed. They are called non-executable transitions. • How does one know they will never be executed? 8/29/2001 Reachability Analysis Page 11 Reachability Analysis 1 E gs0 E 1 A process of generating all possible reachable states from the initial global state -B C1 1 +A 1 -B -R 2 Sender -A C2 Sender’s State Channel C2’s content Channel C1’s content Receiver’s State global state/reachable state 8/29/2001 +R 2 Receiver CFSM CFSM 2 B E 1 gsn Global State ID -R gs1 Unspecified Reception Receiver do not know how to receive B E: channel empty 2 R gs2 E 1 +R 2 E E 2 -A 2 E gs4 A 1 Reachability Graph Reachability Analysis gs3 +A Page 12 Reachability Analysis • Starting from initial global state, where channels are empty and machines at their initial state, explore all possible reachable state by firing the possible transitions (and generating global states) from any given reachable state. • All deadlock and unspecified reception errors will be captured/marked as individual global state. • By examining the number of msgs in the channels we can design the buffer size for the protocol. • Can detect non-executable states and transitions by marking those state are touched and transition that are fired during the reachability analysis. 8/29/2001 Reachability Analysis Page 13 Reachability Analysis Exercise +A -R 2 M N 1 1 -A +R 3 +A -R 2 -A +R 3 a) Perform the reachability analysis on the Network (M, N). b) What sizes of buffers are needed for the two FIFO channels? c) Are there non-executable states or transitions? 8/29/2001 Reachability Analysis Page 14 Solution GS 0 1 E E 1 • One unspecified reception. N: -R M: -R • Both channels need GS 2 GS 1 1 E 2 R buffer size of 2. R 2 E 1 N:-R M:- R M:+R (see gs8 and gs9) N:+R GS 4 GS 5 GS 3 • No non-executable 2 R 3 E 2 E R 2 E 2 E 3 states and unspecified M:- A N:-A reception transitions. GS 6 GS 7 M:+A 2 E 1 A • Since both machines A 1 E 2 send same types M:-R N:-R GS 8 GS 9 of msgs. We use 2 E 2 AR AR 2 E 2 Machine: to specify N:+A M:+A which machine fires Figure 1. Reachability graph. the transition. 8/29/2001 Reachability Analysis Page 15 N:+A
© Copyright 2026 Paperzz