Communicating finite-state machine
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.[1]
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.[1]
Communicating Hierarchical State Machine
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]
Definition
Protocol
For an arbitrary positive integer [math]\displaystyle{ N }[/math], a protocol [1]:3 with [math]\displaystyle{ N }[/math] process(es) is a quadruple [math]\displaystyle{ \{ (S_i)_{i=1}^N,\ (o_i)_{i=1}^N,\ (M_{i,j})_{i,j=1}^N,\ (\mathtt{succ})_{i=1}^N \} }[/math] with:
- [math]\displaystyle{ (S_i)_{i=1}^N }[/math], a sequence of [math]\displaystyle{ N }[/math] disjoint finite sets. Each set is used to represent a process, and each element of [math]\displaystyle{ S_i }[/math] represents a possible state of the [math]\displaystyle{ i }[/math]-th process.
- [math]\displaystyle{ (o_i)_{i=1}^N }[/math] (with [math]\displaystyle{ o_i\in S_i }[/math]), a sequence representing the initial state of each process.
- [math]\displaystyle{ (M_{i,j})_{i,j=1}^N }[/math], a finite sequence of [math]\displaystyle{ N^2 }[/math] disjoint finite sets such that each set [math]\displaystyle{ M_{i,j} }[/math] represents the possible messages which may be sent from process [math]\displaystyle{ i }[/math] to process [math]\displaystyle{ j }[/math]. If [math]\displaystyle{ i=j }[/math], then [math]\displaystyle{ M_{i,j} }[/math] is empty.
- [math]\displaystyle{ (\mathtt{succ})_{i=1}^N : S_i \times \bigcup_{j=1}^N \left( M_{j,i}^{[+]} \cup M_{i,j}^{[-]} \right) \mapsto S_i }[/math] is a sequence of transition functions. Each function modelizes the transition which can be taken by emitting or receiving any message. With respect to process [math]\displaystyle{ i }[/math], the symbol [math]\displaystyle{ [+] }[/math] is used to note a message that can be received and [math]\displaystyle{ [-] }[/math] a message that can be sent.
Global state
A global state is a pair [math]\displaystyle{ \langle S,C\rangle }[/math] where
- [math]\displaystyle{ S = (s_1, ..., s_N) }[/math] is an ordered collection of states such that each [math]\displaystyle{ s_i }[/math] represents a state of the [math]\displaystyle{ i }[/math]-th process.
- [math]\displaystyle{ C }[/math] is an [math]\displaystyle{ N \times N }[/math] matrix such that each [math]\displaystyle{ c_{i,j} \in C }[/math] is a subsequence of [math]\displaystyle{ M_{i,j} }[/math].
The initial global state is a pair [math]\displaystyle{ \langle O, \Epsilon \rangle }[/math] where
- [math]\displaystyle{ O = (o_1, ..., o_N) }[/math]
- [math]\displaystyle{ \Epsilon }[/math] is defined to be an [math]\displaystyle{ N \times N }[/math] matrix such that for all [math]\displaystyle{ i,j \in \{ 1, ..., N \} }[/math], [math]\displaystyle{ E_{i,j} }[/math] equals the empty word, [math]\displaystyle{ \epsilon }[/math].
Step
There are two kinds of steps, steps in which message are received and steps in which messages are sent.
A step in which the [math]\displaystyle{ j }[/math] process receive a message previously sent by the [math]\displaystyle{ i }[/math]-th process is a pair of the form [math]\displaystyle{ \left\langle(s_1,\dots,s_j,\dots,s_n),\left(\begin{array}{lll}c_{1,1}&\dots&c_{1,n}\\\dots&\dots&\dots\\\dots&m_{i,j}c_{i,j}&\dots\\\dots&\dots&\dots\\c_{n,1}&\dots& c_{n,n}\end{array}\right)\right\rangle \vdash \left\langle(s_1,\dots,s'_j,\dots,s_n),\left(\begin{array}{lll}c_{1,1}&\dots&c_{1,n}\\\dots&\dots&\dots\\\dots&c_{i,j}&\dots\\\dots&\dots&\dots\\c_{n,1}&\dots& c_{n,n}\end{array}\right)\right\rangle }[/math] when [math]\displaystyle{ \mathtt{succ}_{i}(s_j,+m_{i,j})=s'_j }[/math], with [math]\displaystyle{ m'_{i,j}\in M_{i,j} }[/math]. Similarly, a pair in which a message is sent by the [math]\displaystyle{ i }[/math]-th process to the [math]\displaystyle{ j }[/math]-th one is a pair of the form [math]\displaystyle{ \left\langle(s_1,\dots,s_i,\dots,s_n),\left(\begin{array}{lll}c_{1,1}&\dots&c_{1,n}\\\dots&\dots&\dots\\\dots&c_{i,j}&\dots\\\dots&\dots&\dots\\c_{n,1}&\dots& c_{n,n}\end{array}\right)\right\rangle \vdash \left\langle(s_1,\dots,s'_i,\dots,s_n),\left(\begin{array}{lll}c_{1,1}&\dots&c_{1,n}\\\dots&\dots&\dots\\\dots&m_{i,j}c_{i,j}&\dots\\\dots&\dots&\dots\\c_{n,1}&\dots& c_{n,n}\end{array}\right)\right\rangle }[/math] when [math]\displaystyle{ \mathtt{succ}_{i}(s_i,-m_{i,j})=s'_i }[/math]
Run
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 [math]\displaystyle{ \langle S,C\rangle }[/math] is reachable if there exists a run passing through this state.
Problems
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.[2]
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.[2]
Extensions
Some extensions considered are:
- having a notation to state that some states may not receive any message,
- messages are received in different orders, such as FILO,
- some messages may get lost,
Channel system
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 [math]\displaystyle{ \langle (S_{i})_{i=1}^n, (o_{i})_{i=1}^n, (M_{i,j})_{i,j=1}^n,(\mathtt{succ})_i\rangle }[/math], its associated channel system is [math]\displaystyle{ \langle \prod(S_{i})_{i=1}^n, (o_{i})_{i=1}^n, \bigcup_{i,j=1}^n(M_{i,j}),\Delta\rangle }[/math], where [math]\displaystyle{ \Delta }[/math] is the set of [math]\displaystyle{ ((s_1,\dots,s_j,\dots,s_n),?m_{i,j},(s_1,\dots,\mathtt{succ}_j(s_j,+m_{i,j}),\dots,s_n) }[/math] and of [math]\displaystyle{ ((s_1,\dots,s_i,\dots,s_n),!m_{i,j},(s_1,\dots,\mathtt{succ}_i(s_i,-m_{i,j}),\dots,s_n) }[/math].
References
- ↑ 1.0 1.1 1.2 1.3 D. Brand and P. Zafiropulo. On communicating finite-state machines. Journal of the ACM, 30(2):323-342, 1983.
- ↑ 2.0 2.1 2.2 Rosier, Louis E; Gouda, Mohamed G. Deciding Progress for a Class of Communicating Finite State Machines. Austin: University of Texas at Austin, 1983.
- ↑ Alur, Rajeev; Kannan, Sampath; Yannakakis, Mihalis. "Communicating hierarchical state machines," Automata, Languages and Programming. Prague: ICALP, 1999
- ↑ Gouda, Mohamed G; Rosier, Louis E. "Communicating finite state machines with priority channels," Automata, Languages and Programming. Antwerp: ICALP, 1984
Original source: https://en.wikipedia.org/wiki/Communicating finite-state machine.
Read more |