In computer science, a communicating finite-state machine is a finite state machine labeled with "receive" and "send" operations over some alphabet of channels. They were introduced by Brand and Zafiropulo,[1] and can be used as a model of concurrent processes like Petri nets. Communicating finite state machines are used frequently for modeling a communication protocol since they make it possible to detect major protocol design errors, including boundedness, deadlocks, and unspecified receptions.[2]
The advantage of communicating finite state machines is that they make it possible to decide many properties in communication protocols, beyond the level of just detecting such properties. This advantage rules out the need for human assistance or restriction in generality.
Communicating finite state machines can be more powerful than finite state machines in situations where the propagation delay is not negligible (so that several messages can be in transit at one time) and in situations where it is natural to describe the protocol parties and the communication medium as separate entities.
Hierarchical state machines are finite state machines whose states themselves can be other machines. Since a communicating finite state machine is characterized by concurrency, the most notable trait in a communicating hierarchical state machine is the coexistence of hierarchy and concurrency. This has been considered highly suitable as it signifies stronger interaction inside the machine.
However, it was proved that the coexistence of hierarchy and concurrency intrinsically costs language inclusion, language equivalence, and all of universality.[3]
For an arbitrary positive integer
N
N
\{(Si)
N, (o | |
i) |
N, (M | |
i,j |
N | |
) | |
i=1 |
\}
(Si)
N | |
i=1 |
N
Si
i
(oi)
N | |
i=1 |
oi\inSi
(Mi,j
N | |
) | |
i,j=1 |
N2
Mi,j
i
j
i=j
Mi,j
N | |
(succ) | |
i=1 |
:Si x
N | |
cup | |
j=1 |
\left(
[+] | |
M | |
j,i |
\cup
[-] | |
M | |
i,j |
\right)\mapstoSi
i
[+]
[-]
A global state is a pair
\langleS,C\rangle
S=(s1,...,sN)
si
i
C
N x N
ci,j\inC
Mi,j
The initial global state is a pair
\langleO,\Epsilon\rangle
O=(o1,...,oN)
\Epsilon
N x N
i,j\in\{1,...,N\}
Ei,j
\epsilon
There are two kinds of steps, steps in which message are received and steps in which messages are sent.
A step in which the
j
i
\left\langle(s1,...,sj,...,sn),\left(\begin{array}{lll}c1,1&...&c1,n\\...&...&...\\...&mi,jci,j&...\\...&...&...\\cn,1&...&cn,n\end{array}\right)\right\rangle \vdash \left\langle(s1,...,s'j,...,sn),\left(\begin{array}{lll}c1,1&...&c1,n\\...&...&...\\...&ci,j&...\\...&...&...\\cn,1&...&cn,n\end{array}\right)\right\rangle
succi(sj,+mi,j)=s'j
m'i,j\inMi,j
i
j
\left\langle(s1,...,si,...,sn),\left(\begin{array}{lll}c1,1&...&c1,n\\...&...&...\\...&ci,j&...\\...&...&...\\cn,1&...&cn,n\end{array}\right)\right\rangle \vdash \left\langle(s1,...,s'i,...,sn),\left(\begin{array}{lll}c1,1&...&c1,n\\...&...&...\\...&mi,jci,j&...\\...&...&...\\cn,1&...&cn,n\end{array}\right)\right\rangle
succi(si,-mi,j)=s'i
A run is a sequence of global states such that a step relate a state to the next one, and such that the first state is initial.
It is said that a global state
\langleS,C\rangle
It has been proved with the introduction of the concept itself that when two finite state machines communicate with only one type of messages, boundedness, deadlocks, and unspecified reception state can be decided and identified while such is not the case when the machines communicate with two or more types of messages. Later, it has been further proved that when only one finite state machine communicates with single type of message while the communication of its partner is unconstrained, we can still decide and identify boundedness, deadlocks, and unspecified reception state.
It has been further proved that when the message priority relation is empty, boundedness, deadlocks and unspecified reception state can be decided even under the condition in which there are two or more types of messages in the communication between finite state machines.[4]
Boundedness, deadlocks, and unspecified reception state are all decidable in polynomial time (which means that a particular problem can be solved in tractable, not infinite, amount of time) since the decision problems regarding them are nondeterministic logspace complete.
Some extensions considered are:
See main article: Channel system (computer science). A channel system is essentially a version of communicating finite-state machine in which the machine is not divided into distinct process. Thus, there is a single state of state, and there is no restriction relating which system can read/write on any channel.
Formally, given a protocol
\langle(Si
n, | |
) | |
i=1 |
(oi
n, | |
) | |
i=1 |
(Mi,j
n,(succ) | |
) | |
i\rangle |
\langle\prod(Si
n, | |
) | |
i=1 |
(oi
n, | |
) | |
i=1 |
n(M | |
cup | |
i,j |
),\Delta\rangle
\Delta
((s1,...,sj,...,sn),?mi,j,(s1,...,succj(sj,+mi,j),...,sn)
((s1,...,si,...,sn),!mi,j,(s1,...,succi(si,-mi,j),...,sn)