key: cord-0054953-smt4e7zp authors: Di Giusto, Cinzia; Laversa, Laetitia; Lozes, Etienne title: On the k-synchronizability of Systems date: 2020-04-17 journal: Foundations of Software Science and Computation Structures DOI: 10.1007/978-3-030-45231-5_9 sha: a00d3e0f288f1e29a9b3d81b6bd9ca165760a94c doc_id: 54953 cord_uid: smt4e7zp We study k-synchronizability: a system is k-synchronizable if any of its executions, up to reordering causally independent actions, can be divided into a succession of k-bounded interaction phases. We show two results (both for mailbox and peer-to-peer automata): first, the reachability problem is decidable for k-synchronizable systems; second, the membership problem (whether a given system is k-synchronizable) is decidable as well. Our proofs fix several important issues in previous attempts to prove these two results for mailbox automata. Asynchronous message-passing is ubiquitous in communication-centric systems; these include high-performance computing, distributed memory management, event-driven programming, or web services orchestration. One of the parameters that play an important role in these systems is whether the number of pending sent messages can be bounded in a predictable fashion, or whether the buffering capacity offered by the communication layer should be unlimited. Clearly, when considering implementation, testing, or verification, bounded asynchrony is preferred over unbounded asynchrony. Indeed, for bounded systems, reachability analysis and invariants inference can be solved by regular model-checking [5] . Unfortunately and even if designing a new system in this setting is easier, this is not the case when considering that the buffering capacity is unbounded, or that the bound is not known a priori . Thus, a question that arises naturally is how can we bound the "behaviour" of a system so that it operates as one with unbounded buffers? In a recent work [4] , Bouajjani et al. introduced the notion of k-synchronizable system of finite state machines communicating through mailboxes and showed that the reachability problem is decidable for such systems. Intuitively, a system is k-synchronizable if any of its executions, up to reordering causally independent actions, can be chopped into a succession of k-bounded interaction phases. Each of these phases starts with at most k send actions that are followed by at most k receptions. Notice that, a system may be k-synchronizable even if some of its executions require buffers of unbounded capacity. As explained in the present paper, this result, although valid, is surprisingly non-trivial, mostly due to complications introduced by the mailbox semantics of communications. Some of these complications were missed by Bouajjani et al. and the algorithm for the reachability problem in [4] suffers from false positives. Another problem is the membership problem for the subclass of k-synchronizable systems: for a given k and a given system of communicating finite state machines, is this system k-synchronizable? The main result in [4] is that this problem is decidable. However, again, the proof of this result contains an important flaw at the very first step that breaks all subsequent developments; as a consequence, the algorithm given in [4] produces both false positives and false negatives. In this work, we present a new proof of the decidability of the reachability problem together with a new proof of the decidability of the membership problem. Quite surprisingly, the reachability problem is more demanding in terms of causality analysis, whereas the membership problem, although rather intricate, builds on a simpler dependency analysis. We also extend both decidability results to the case of peer-to-peer communication. Outline. Next section recalls the definition of communicating systems and related notions. In Section 3 we introduce k-synchronizability and we give a graphical characterisation of this property. This characterisation corrects Theorem 1 in [4] and highlights the flaw in the proof of the membership problem. Next, in Section 4, we establish the decidability of the reachability problem, which is the core of our contribution and departs considerably from [4] . In Section 5, we show the decidability of the membership problem. Section 6 extends previous results to the peer-to-peer setting. Finally Section 7 concludes the paper discussing other related works. Proofs and some additional material are available at https://hal.archives-ouvertes.fr/hal-02272347. A communicating system is a set of finite state machines that exchange messages: automata have transitions labelled with either send or receive actions. The paper mainly considers as communication architecture, mailboxes: i.e., messages await to be received in FIFO buffers that store all messages sent to a same automaton, regardless of their senders. Section 6, instead, treats peer-to-peer systems, their introduction is therefore delayed to that point. Let V be a finite set of messages and P a finite set of processes. A send action, denoted send(p, q, v), designates the sending of message v from process p to process q. Similarly a receive action rec(p, q, v) expresses that process q is receiving message v from p. We write a to denote a send or receive action. Let S = {send(p, q, v) | p, q ∈ P, v ∈ V} be the set of send actions and R = {rec(p, q, v) | p, q ∈ P, v ∈ V} the set of receive actions. S p and R p stand for the set of sends and receives of process p respectively. Each process is encoded by an automaton and by abuse of notation we say that a system is the parallel composition of processes. Definition 1 (System). A system is a tuple S = (L p , δ p , l 0 p ) | p ∈ P where, for each process p, L p is a finite set of local control states, δ p ⊆ (L p × (S p ∪ R p ) × L p ) is the transition relation (also denoted l a − → p l ) and l 0 p is the initial state. Definition 2 (Configuration). Let S = (L p , δ p , l 0 p ) | p ∈ P , a configuration is a pair ( l, Buf) where l = (l p ) p∈P ∈ Π p∈P L p is a global control state of S (a local control state for each automaton), and Buf = (b p ) p∈P ∈ (V * ) P is a vector of buffers, each b p being a word over V. We write l 0 to denote the vector of initial states of all processes p ∈ P, and Buf 0 stands for the vector of empty buffers. The semantics of a system is defined by the two rules below. [SEND] A send action adds a message in the buffer b of the receiver, and a receive action pops the message from this buffer. An execution e = a 1 · · · a n is a sequence of actions in S ∪ R such that ( l 0 , Buf 0 ) a1 − → · · · an − − → ( l, Buf) for some l and Buf. As usual e = ⇒ stands for a1 − → · · · an − − →. We write asEx(S) to denote the set of asynchronous executions of a system S. In a sequence of actions e = a 1 · · · a n , a send action and there is ≥ 1 such that a i and a j are the th actions of e with these properties respectively. A send action a i is unmatched if there is no matching reception in e. A message exchange of a sequence of actions e is a set either of the form v = {a i , a j } with a i a j or of the form v = {a i } with a i unmatched. For a message v i , we will note v i the corresponding message exchange. When v is either an unmatched send(p, q, v) or a pair of matched actions {send(p, q, v), rec(p, q, v)}, we write proc S (v) for p and proc R (v) for q. Note that proc R (v) is defined even if v is unmatched. Finally, we write procs(v) for {p} in the case of an unmatched send and {p, q} in the case of a matched send. An execution imposes a total order on the actions. We are interested in stressing the causal dependencies between messages. We thus make use of message sequence charts (MSCs) that only impose an order between matched pairs of actions and between the actions of a same process. Informally, an MSC will be depicted with vertical timelines (one for each process) where time goes from top to bottom, that carry some events (points) representing send and receive actions of this process (see Fig. 1 ). An arc is drawn between two matched events. We will also draw a dashed arc to depict an unmatched send event. An MSC is, thus, a partially ordered set of events, each corresponding to a send or receive action. A message sequence chart is a tuple (Ev, λ, ≺), where -Ev is a finite set of events, λ : Ev → S ∪ R tags each event with an action, -≺= (≺ po ∪ ≺ src ) + is the transitive closure of ≺ po and ≺ src where: • ≺ po is a partial order on Ev such that, for all process p, ≺ po induces a total order on the set of events of process p, i.e., on λ −1 (S p ∪ R p ) • ≺ src is a binary relation that relates each receive event to its preceding send event : * for all events r ∈ λ −1 (R), there is exactly one events s such that s ≺ src r * for all events s ∈ λ −1 (S), there is at most one event r such that s ≺ src r * for any two events s, r such that s ≺ src r, there are p, q, v such that λ(s) = send(p, q, v) and λ(r) = rec(p, q, v). We identify MSCs up to graph isomorphism (i.e., we view an MSC as a labeled graph). For a given well-formed (i.e., each reception is matched) sequence of actions e = a 1 . . . a n , we let msc(e) be the MSC where Ev = [1. .n], ≺ po is the set of pairs of indices (i, j) such that i < j and {a i , a j } ⊆ S p ∪ R p for some p ∈ P (i.e., a i and a j are actions of a same process), and ≺ src is the set of pairs of indices (i, j) such that a i a j . We say that e = a 1 . . . a n is a linearisation of msc(e), and we write asT r(S) to denote {msc(e) | e ∈ asEx(S)} the set of MSCs of system S. Mailbox communication imposes a number of constraints on what and when messages can be read. The precise definition is given below, we now discuss some of the possible scenarios. For instance: if two messages are sent to a same process, they will be received in the same order as they have been sent. As another example, unmatched messages also impose some constraints: if a process p sends an unmatched message to r, it will not be able to send matched messages to r afterwards (Fig. 1a) ; or similarly, if a process p sends an unmatched message to r, any process q that receives subsequent messages from p will not be able to send matched messages to r afterwards (Fig. 1b) . When an MSC satisfies the constraint imposed by mailbox communication, we say that it satisfies causal delivery. Notice that, by construction, all executions satisfy causal delivery. Definition 4 (Causal Delivery). Let (Ev, λ, ≺) be an MSC. We say that it satisfies causal delivery if the MSC has a linearisation e = a 1 . . . a n such that for any two events i ≺ j such that a i = send(p, q, v) and a j = send(p , q, v ), either a j is unmatched, or there are i , j such that a i a i , a j a j , and i ≺ j . Our definition enforces the following intuitive property. Proposition 1. An MSC msc satisfies causal delivery if and only if there is a system S and an execution e ∈ asEx(S) such that msc = msc(e). We now recall from [4] the definition of conflict graph depicting the causal dependencies between message exchanges. Intuitively, we have a dependency whenever two messages have a process in common. For instance an SS −→ dependency between message exchanges v and v expresses the fact that v has been sent after v, by the same process. Definition 5 (Conflict Graph). The conflict graph CG(e) of a sequence of actions e = a 1 · · · a n is the labeled graph (V, { XY −→} X,Y ∈{R,S} ) where V is the set of message exchanges of e, and for all X, Notice that each linearisation e of an MSC will have the same conflict graph. We can thus talk about an MSC and the associated conflict graph. (As an example see Figs. 1c and 1d.) In this section, we define k-synchronizable systems. The main contribution of this part is a new characterisation of k-synchronizable executions that corrects the one given in [4] . In the rest of the paper, k denotes a given integer k ≥ 1. A k-exchange denotes a sequence of actions starting with at most k sends and followed by at most k receives matching some of the sends. An MSC is k-synchronous if there exists a linearisation that is breakable into a sequence of k-exchanges, such that a message sent during a k-exchange cannot be received during a subsequent one: either it is received during the same k-exchange, or it remains orphan forever. Definition 6 (k-synchronous). An MSC msc is k-synchronous if: 1. there exists a linearisation of msc e = e 1 · e 2 · · · e n where for all i ∈ [1..n], e i ∈ S ≤k · R ≤k , 2. msc satisfies causal delivery, 3. for all j, j such that a j a j holds in e, a j a j holds in some e i . An execution e is k-synchronizable if msc(e) is k-synchronous. We write sT r k (S) to denote the set {msc(e) | e ∈ asEx(S) and msc(e) is k-synchronous}. Example 1 (k-synchronous MSCs and k-synchronizable Executions). 1. There is no k such that the MSC in Fig. 2a is k-synchronous. All messages must be grouped in the same k-exchange, but it is not possible to schedule all the sends first, because the reception of v 1 happens before the sending of v 3 . Still, this MSC satisfies causal delivery. be an execution. Its MSC, msc(e 1 ) depicted in Fig. 2b satisfies causal delivery. Notice that e 1 can not be divided in 1-exchanges. However, if we consider the alternative linearisation of msc(e 1 ): , we have that e 2 is breakable into 1exchanges in which each matched send is in a 1-exchange with its reception. Therefore, msc(e 1 ) is 1-synchronous and e 1 is 1-synchronizable. Remark that e 2 is not an execution and there exists no execution that can be divided into 1-exchanges. A k-synchronous MSC highlights dependencies between messages but does not impose an order for the execution. Comparison with [4] . In [4] , the authors define set sEx k (S) as the set of ksynchronous executions of system S in the k-synchronous semantics. Nonetheless as remarked in Example 1.2 not all executions of a system can be divided into k-exchanges even if they are k-synchronizable. Thus, in order not to lose any executions, we have decided to reason only on MSCs (called traces in [4] ). Following standard terminology, we say that a set U ⊆ V of vertices is a strongly connected component (SCC) of a given graph (V, →) if between any two vertices v, v ∈ U , there exist two oriented paths v → * v and v → * v. The statement below fixes some issues with Theorem 1 in [4] . Theorem 1 (Graph Characterisation of k-synchronous MSCs). Let msc be a causal delivery MSC. msc is k-synchronous iff every SCC in its conflict graph is of size at most k and if no RS edge occurs on any cyclic path. Example 2 (A 5-synchronous MSC). Fig. 2c depicts a 5-synchronous MSC, that is not 4-synchronous. Indeed, its conflict graph (Fig. 2d ) contains a SCC of size 5 (all vertices are on the same SCC). Comparison with [4] . Bouajjani et al. give a characterisation of k-synchronous executions similar to ours, but they use the word cycle instead of SCC, and the subsequent developments of the paper suggest that they intended to say Hamiltonian cycle (i.e., a cyclic path that does not go twice through the same vertex). It is not the case that a MSC is k-synchronous if and only if every Hamiltonian cycle in its conflict graph is of size at most k and if no RS edge occurs on any cyclic path. Indeed, consider again Example 2. This graph is not Hamiltonian, and the largest Hamiltonian cycle indeed is of size 4 only. But as we already discussed in Example 2, the corresponding MSC is not 4-synchronous. As a consequence, the algorithm that is presented in [4] for deciding whether a system is k-synchronizable is not correct as well: the MSC of Fig. 2c would be considered 4-synchronous according to this algorithm, but it is not. We show that the reachability problem is decidable for k-synchronizable systems. While proving this result, we have to face several non-trivial aspects of causal delivery that were missed in [4] and that require a completely new approach. In other words, a system S is k-synchronizable if for every execution e of S, msc(e) may be divided into k-exchanges. Remark 1. In particular, a system may be k-synchronizable even if some of its executions fill the buffers with more than k messages. For instance, the only linearisation of the 1-synchronous MSC Fig. 2b that is an execution of the system needs buffers of size 2. For a k-synchronizable system, the reachability problem reduces to the reachability through a k-synchronizable execution. To show that k-synchronous reachability is decidable, we establish that the set of k-synchronous MSCs is regular. More precisely, we want to define a finite state automaton that accepts a sequence e 1 · e 2 · · · e n of k-exchanges if and only if they satisfy causal delivery. We start by giving a graph-theoretic characterisation of causal delivery. For this, we define the extended edges v XY v of a given conflict graph. The relation XY is defined in Fig. 3 with X, Y ∈ {S, R}. Intuitively, v XY v expresses that event X of v must happen before event Y of v due to either their order on the same machine (Rule 1), or the fact that a send happens before its matching receive (Rule 2), or due to the mailbox semantics (Rules 3 and 4), or because of a chain of such dependencies (Rule 5). We observe that in the extended conflict graph, obtained applying such rules, a cyclic dependency appears whenever causal delivery is not satisfied. Fig. 5a and 5b depict an MSC and its associated conflict graph with some extended edges. This MSC violates causal delivery and there is a cyclic Theorem 2 (Graph-theoretic Characterisation of Causal Delivery). An MSC satisfies causal delivery iff there is no cyclic causal dependency of the form v SS v for some vertex v of its extended conflict graph. Let us now come back to our initial problem: we want to recognise with finite memory the sequences e 1 , e 2 . . . e n of k-exchanges that composed give an MSC that satisfies causal delivery. We proceed by reading each k-exchange one by one in sequence. This entails that, at each step, we have only a partial view of the global conflict graph. Still, we want to determine whether the acyclicity condition of Theorem 2 is satisfied in the global conflict graph. The crucial observation is that only the edges generated by Rule 4 may "go back in time". This means that we have to remember enough information from the previously examined kexchanges to determine whether the current k-exchange contains a vertex v that shares an edge with some unmatched vertex v seen in a previous k-exchange and whether this could participate in a cycle. This is achieved by computing two sets of processes C S,p and C R,p that collect the following information: a process q is in C S,p if it performs a send action causally after an unmatched send to p, or it is the sender of the unmatched send; a process q belongs to C R,p if it receives a message that was sent after some unmatched message directed to p. More precisely, we have: These sets abstract and carry from one k-exchange to another the necessary information to detect violations of causal delivery. We compute them in any local conflict graph of a k-exchange incrementally, i.e., knowing what they were at the end of the previous k-exchange, we compute them at the end of the current one. More precisely, let e = s 1 · · · s m · r 1 · · · r m be a k-exchange, CG(e) = (V, E) its conflict graph and B : P → (2 P × 2 P ) the function that associates to each p ∈ P the two sets B(p) = (C S,p , C R,p ). Then, the conflict graph CG(e, B) is the graph (V , E ) with V = V ∪ {ψ p | p ∈ P} and E ⊇ E as defined below. For each process p ∈ P, the "summary node" ψ p shall account for all past unmatched e = s1 · · · sm · r1 · · · r m s1 · · · sm ∈ S * r1 · · · r m ∈ R * 0 ≤ m ≤ m ≤ k ( l, Buf0) e = ⇒ ( l , Buf) for some Buf for all p ∈ P B(p) = (CS,p, CR,p) and B (p) = (C S,p , C R,p ), These extra edges summarise/abstract the connections to and from previous k-exchanges. Equation (1) Example 4 (An Invalid Execution). Let e = e 1 · e 2 with e 1 and e 2 the two 2-exchanges of this execution. such that e 1 = send(q, r, v 1 ) · send(q, s, v 2 ) · rec(q, s, v 2 ) and e 2 = send(p, s, v 3 ) · rec(p, s, v 3 ) · send(p, r, v 4 ) · rec(p, r, v 4 ). Fig. 5a and 5c show the MSC and corresponding conflict graph of each of the 2-exchanges. Note that two edges of the global graph (in blue) "go across" kexchanges. These edges do not belong to the local conflict graphs and are mimicked by the incoming and outgoing edges of summary nodes. The values of sets C S,r and C R,r at the beginning and at the end of the k-exchange are given on the right. All other sets C S,p and C R,p for p = r are empty, since there is only one unmatched message to process r. Notice how at the end of the second k-exchange, r ∈ C R,r signalling that message v 4 violates causal delivery. Comparison with [4] . In [4] the authors define e,k = = ⇒ cd in a rather different way: they do not explicitly give a graph-theoretic characterisation of causal delivery; instead they compute, for every process p, the set B(p) of processes that either sent an unmatched message to p or received a message from a process in B(p). They then make sure that any message sent to p by a process q ∈ B(p) is unmatched. According to that definition, the MSC of Fig. 5b would satisfy causal delivery and would be 1-synchronous. However, this is not the case (this MSC does not satisfy causal delivery) as we have shown in Example 3. Due to to the above errors, we had to propose a considerably different approach. The extended edges of the conflict graph, and the graph-theoretic characterisation of causal delivery as well as summary nodes, have no equivalent in [4] . Next lemma proves that Fig. 4 properly characterises causal delivery. Lemma 1. An MSC msc is k-synchronous iff there is e = e 1 · · · e n a linearisation such that ( l 0 , B 0 ) e1,k = = ⇒ cd · · · en,k ==⇒ cd ( l , B ) for some global state l and some B : P → (2 P × 2 P ). Note that there are only finitely many abstract configurations of the form ( l, B) with l a tuple of control states and B : P → (2 P × 2 P ). Moreover, since V is finite, the alphabet over the possible k-exchange for a given k is also finite. Therefore e,k = = ⇒ cd is a relation on a finite set, and the set sT r k (S) of k-synchronous MSCs of a system S forms a regular language. It follows that it is decidable whether a given abstract configuration of the form ( l, B) is reachable from the initial configuration following a k-synchronizable execution. Theorem 3. Let S be a k-synchronizable system and l a global control state of S. The problem whether there exists e ∈ asEx(S) and Buf such that ( l 0 , Buf 0 ) e = ⇒ ( l, Buf) is decidable. Remark 2. Deadlock-freedom, unspecified receptions, and absence of orphan messages are other properties that become decidable for a k-synchronizable system because of the regularity of the set of k-synchronous MSCs. We establish the decidability of k-synchronizability; our approach is similar to the one of [4] based on the notion of borderline violation, but we adjust it to adapt to the new characterisation of k-synchronizable executions (Theorem 1). A non k-synchronizable execution e is a borderline violation if e = e · r, r is a reception and e is k-synchronizable. Note that a system S that is not k-synchronizable always admits at least one borderline violation e · r ∈ asEx(S) with r ∈ R: indeed, there is at least one execution e ∈ asEx(S) which contains a unique minimal prefix of the form e · r that is not k-synchronizable; moreover since e is k-synchronizable, r cannot be a k-exchange of just one send action, therefore it must be a receive action. In order to find such a borderline violation, Bouajjani et al. introduced an instrumented system S that behaves like S, except that it contains an extra process π, and such that a non-deterministically chosen message that should have been sent from a process p to a process q may now be sent from p to π, and later forwarded by π to q. In S , each process p has the possibility, instead of sending a message v to q, to deviate this message to π; if it does so, p continues its execution as if it really had sent it to q. Note also that the message sent to π get tagged with the original destination process q. Similarly, for each possible reception, a process has the possibility to receive a given message not from the initial sender but from π. The process π has an initial state from which it can receive any messages from the system. Each reception makes it go into a different state. From this state, it is able to send the message back to the original recipient. Once a message is forwarded, π reaches its final state and remains idle. The following example illustrates how the instrumented system works. Let e 1 , e 2 be two executions of a system S with MSCs respectively msc(e 1 ) and msc(e 2 ). e 1 is not 1synchronizable. It is borderline in S. If we delete the last reception, it becomes indeed 1-synchronizable. msc(e 2 ) is the MSC obtained from the instrumented system S where the message v 1 is first deviated to π and then sent back to q from π. Note that msc(e 2 ) is 1-synchronous. In this case, the instrumented system S in the 1-synchronous semantics "reveals" the existence of a borderline violation of S. msc(e 1 ) For each execution e · r ∈ asEx(S) that ends with a reception, there exists an execution deviate(e · r) ∈ asEx(S ) where the message exchange associated with the reception r has been deviated to π; formally, if e · r = e 1 · s · e 2 · r with r = rec(p, q, v) and s r, then deviate(e·r) = e 1 ·send(p, π, (q, v))·rec(p, π, (q, v))·e 2 ·send(π, q, (v))·rec(π, q, v). A k-synchronizable execution e of S is feasible if there is an execution e · r ∈ asEx(S) such that deviate(e · r) = e . A feasible execution e = deviate(e · r) of S is bad if execution e · r is not k-synchronizable in S. Let e be an execution such that msc(e ) is as depicted on the right. Clearly, this MSC satisfies causal delivery and could be the execution of some instrumented system S . However, the sequence e·r such that deviate(e·r) = e does not satisfy causal delivery, therefore it cannot be an execution of the original system S. In other words, the execution e is not feasible. msc(e ) Lemma 2. A system S is not k-synchronizable iff there is a k-synchronizable execution e of S that is feasible and bad. As we have already noted, the set of k-synchronous MSCs of S is regular. The decision procedure for k-synchronizability follows from the fact that the set of MSCs that have as linearisation a feasible bad execution as we will see, is regular as well, and that it can be recognised by an (effectively computable) non-deterministic finite state automaton. The decidability of k-synchronizability follows then from Lemma 2 and the decidability of the emptiness problem for non-deterministic finite state automata. Recognition of Feasible Executions. We start with the automaton that recognises feasible executions; for this, we revisit the construction we just used for recognising sequences of k-exchanges that satisfy causal delivery. In the remainder, we assume an execution e ∈ asEx(S ) that contains exactly one send of the form send(p, π, (q, v)) and one reception of the form rec(π, q, v), this reception being the last action of e . Let (V, { XY −→} X,Y ∈{R,S} ) be the conflict graph of e . There are two uniquely determined vertices υ start , υ stop ∈ V such that proc R (υ start ) = π and proc S (υ stop ) = π that correspond, respectively, to the first and last message exchanges of the deviation. The conflict graph of e · r is then obtained by merging these two nodes. In order to decide whether an execution e is feasible, we want to forbid that a send action send(p , q, v ) that happens causally after υ start is matched by a receive rec(p , q, v ) that happens causally before the reception υ stop . As a matter of fact, this boils down to deal with the deviated send action as an unmatched send. So we will consider sets of processes C π S and C π R similar to the ones used for e,k = = ⇒ cd , but with the goal of computing which actions happen causally after the send to π. We also introduce a summary node ψ start and the extra edges following the same principles as in the previous section. Formally, let B : P → (2 P × 2 P ), C π S , C π R ⊆ P and e ∈ S ≤k R ≤k be fixed, and let CG(e, B) = (V , E ) be the constraint graph with summary nodes for unmatched sent messages as defined in the previous section. The local constraint graph CG(e, B, C π S , C π R ) is defined as the graph (V , E ) where V = V ∪ {ψ start } and E is E augmented with As before, we consider the "closure" XY of these edges by the rules of Fig. 3 . The transition relation e,k = == ⇒ feas is defined in Fig. 6 . It relates abstract configurations of the form ( l, B, C, dest π ) with C = (C S,π , C R,π ) and dest π ∈ P∪{⊥} storing to whom the message deviated to π was supposed to be delivered. Thus, the initial abstract configuration is (l 0 , B 0 , (∅, ∅), ⊥), where ⊥ means that the processus dest π has not been determined yet. It will be set as soon as the send to process π is encountered. Lemma 4. Let e be an execution of S . Then e is a k-synchronizable feasible execution iff there are e = e 1 · · · e n · send(π, q, v) · rec(π, q, v) with e 1 , . . . , e n ∈ S ≤k R ≤k , B : P → 2 P , C ∈ (2 P ) 2 , and a tuple of control states l such that msc(e ) = msc(e ), π ∈ C R,q (with B (q) = (C S,q , C R,q )), and ( l, B) Comparison with [4] . In [4] the authors verify that an execution is feasible with a monitor which reviews the actions of the execution and adds processes that no longer are allowed to send a message to the receiver of π. Unfortunately, we have here a similar problem that the one mentioned in the previous comparison paragraph. According to their monitor, the following execution e = deviate(e · r) is feasible, i.e., is runnable in S and e · r is runnable in S. However, this execution is not feasible because there is a causal dependency between v 1 and v 3 . In [4] this execution would then be considered as feasible and therefore would belong to set sT r k (S ). Yet there is no corresponding execution in asT r(S), the comparison and therefore the k-synchronizability, could be distorted and appear as a false negative. Recognition of Bad Executions. Finally, we define a non-deterministic finite state automaton that recognizes MSCs of bad executions, i.e., feasible executions e = deviate(e · r) such that e · r is not k-synchronizable. We come back to the "non-extended" conflict graph, without edges of the form Lemma 5. The feasible execution e is bad iff one of the two holds 1. υ start −→ * RS −→−→ * υ stop , or 2. the size of the set Post * (υ start ) ∩ Pre * (υ stop ) is greater or equal to k + 2. In order to determine whether a given message exchange v of CG(e ) should be counted as reachable (resp. co-reachable), we will compute at the entry and exit of every k-exchange of e which processes are "reachable" or "co-reachable". Consider the MSC on the right made of five 1-exchanges. While sending message (s, v 0 ) that corresponds to υ start , process r becomes "reachable": any subsequent message exchange that involves r corresponds to a vertex of the conflict graph that is reachable from υ start . While sending v 2 , process s becomes "reachable", because process r will be reachable when it will receive message v 2 . Similary, q becomes reachable after receiving v 3 because r was reachable when it sent v 3 , and p becomes reachable after receiving v 4 because q was reachable when it sent msc(e) Co-reachability works similarly, but reasoning backwards on the timelines. For instance, process s stops being "co-reachable" while it receives v 0 , process r stops being co-reachable after it receives v 2 , and process p stops being coreachable by sending v 1 . The only message that is sent by a process being both reachable and co-reachable at the instant of the sending is v 2 , therefore it is the only message that will be counted as contributing to the SCC. More formally, let e be sequence of actions, CG(e) its conflict graph and Lemma 6. Let e be a feasible k-synchronizable execution of S . Then e is a bad execution iff there are e = e 1 · · · e n · send(π, q, v) · rec(π, q, v) with e 1 , . . . , e n ∈ S ≤k R ≤k and msc(e ) = msc(e ), P , Q ⊆ P, sawRS ∈ {True, False}, cnt ∈ {0, . . . , k + 2}, such that Comparison with [4] . As for the notion of feasibility, to determine if an execution is bad, in [4] the authors use a monitor that builds a path between the send to process π and the send from π. In addition to the problems related to the wrong characterisation of k-synchronizability, this monitor not only can detect an RS edge when there should be none, but also it can miss them when they exist. In general, the problem arises because the path is constructed by considering only an endpoint at the time. We can finally conclude that: Theorem 4. The k-synchronizability of a system S is decidable for k ≥ 1. In this section, we will apply k-synchronizability to peer-to-peer systems. A peerto-peer system is a composition of communicating automata where each pair of machines exchange messages via two private FIFO buffers, one per direction of communication. Here we only give an insight on what changes with respect to the mailbox setting. Causal delivery reveals the order imposed by FIFO buffers. Definition 4 must then be adapted to account for peer-to-peer communication. For instance, two messages that are sent to a same process p by two different processes can be received by p in any order, regardless of any causal dependency between the two sends. Thus, checking causal delivery in peer-to-peer systems is easier than in the mailbox setting, as we do not have to carry information on causal dependencies. Within a peer-to-peer architecture, MSCs and conflict graphs are defined as within a mailbox communication. Indeed, they represents dependencies over machines, i.e., the order in which the actions can be done on a given machine, and over the send and the reception of a same message, and they do not depend on the type of communication. The notion of k-exchange remains also unchanged. Decidability of Reachability for k-synchronizable Peer-to-Peer Systems. To establish the decidability of reachability for k-synchronizable peer-topeer systems, we define a transition relation for a sequence of action e describing a k-exchange. As for mailbox systems, if a send action is unmatched in the current k-exchange, it will stay orphan forever. Moreover, after a process p sent an orphan message to a process q, p is forbidden to send any matched message to q. Nonetheless, as a consequence of the simpler definition of causal delivery, , we no longer need to work on the conflict graph. Summary nodes and extended edges are not needed and all the necessary information is in function B that solely contains all the forbidden senders for process p. The characterisation of a k-synchronizable execution is the same as for mailbox systems as the type of communication is not relevant. We can thus conclude, as within mailbox communication, that reachability is decidable. Theorem 5. Let S be a k-synchronizable system and l a global control state of S. The problem whether there exists e ∈ asEx(S) and Buf such that Decidability of k-synchronizability for Peer-to-Peer Systems. As in mailbox system, the detection of a borderline execution determines whether a system is k-synchronizable. allows to obtain feasible executions. Differently from the mailbox setting, we need to save not only the recipient dest π but also the sender of the delayed message (information stored in variable exp π ). The transition rule then checks that there is no message that is violating causal delivery, i.e., there is no message sent by exp π to dest π after the deviation. are, therefore, the same. As for mailbox systems, we can, thus, conclude that for a given k, k-synchronizability is decidable. Theorem 6. The k-synchronizability of a system S is decidable for k ≥ 1. In this paper we have studied k-synchronizability for mailbox and peer-to-peer systems. We have corrected the reachability and decidability proofs given in [4] . The flaws in [4] concern fundamental points and we had to propose a considerably different approach. The extended edges of the conflict graph, and the graph-theoretic characterisation of causal delivery as well as summary nodes, have no equivalent in [4] . Transition relations e,k = == ⇒ feas and e,k = == ⇒ bad building on the graph-theoretic characterisations of causal delivery and k-synchronizability, depart considerably from the proposal in [4] . We conclude by commenting on some other related works. The idea of "communication layers" is present in the early works of Elrad and Francez [8] or Chou and Gafni [7] . More recently, Chaouch-Saad et al. [6] verified some consensus algorithms using the Heard-Of Model that proceeds by "communication-closed rounds". The concept that an asynchronous system may have an "equivalent" synchronous counterpart has also been widely studied. Lipton's reduction [14] reschedules an execution so as to move the receive actions as close as possible from their corresponding send. Reduction recently received an increasing interest for verification purpose, e.g. by Kragl et al. [12] , or Gleissenthal et al. [11] . Existentially bounded communication systems have been studied by Genest et al. [10, 15] : a system is existentially k-bounded if any execution can be rescheduled in order to become k-bounded. This approach targets a broader class of systems than k-synchronizability, because it does not require that the execution can be chopped in communication-closed rounds. In the perspective of the current work, an interesting result is the decidability of existential k-boundedness for deadlock-free systems of communicating machines with peer-to-peer channels. Despite the more general definition, these older results are incomparable with the present ones, that deal with systems communicating with mailboxes, and not peer-to-peer channels. Basu and Bultan studied a notion they also called synchronizability, but it differs from the notion studied in the present work; synchronizability and ksynchronizability define incomparable classes of communicating systems. The proofs of the decidability of synchronizability [3, 2] were shown to have flaws by Finkel and Lozes [9] . A question left open in their paper is whether synchronizability is decidable for mailbox communications, as originally claimed by Basu and Bultan. Akroun and Salaün defined also a property they called stability [1] and that shares many similarities with the synchronizability notion in [2] . Context-bounded model-checking is yet another approach for the automatic verification of concurrent systems. La Torre et al. studied systems of communicating machines extended with a calling stack, and showed that under some conditions on the interplay between stack actions and communications, contextbounded reachability was decidable [13] . A context-switch is found in an execution each time two consecutive actions are performed by a different participant. Thus, while k-synchronizability limits the number of consecutive sendings, bounded context-switch analysis limits the number of times two consecutive actions are performed by two different processes. As for future work, it would be interesting to explore how both contextboundedness and communication-closed rounds could be composed. Moreover refinements of the definition of k-synchronizability can also be considered. For instance, we conjecture that the current development can be greatly simplified if we forbid linearisation that do not correspond to actual executions. Automated verification of automata communicating via FIFO and bag buffers On deciding synchronizability for asynchronously communicating systems Verification, Model Checking, and Abstract Interpretation -13th International Conference On the completeness of verifying message passing programs under bounded asynchrony Abstract regular model checking A reduction theorem for the verification of round-based distributed algorithms Understanding and verifying distributed algorithms using stratified decomposition Decomposition of distributed programs into communication-closed layers Synchronizability of communicating finite state machines is not decidable On communicating automata with bounded channels Pretend synchrony: synchronous verification of asynchronous distributed programs Synchronizing the asynchronous Tools and Algorithms for the Construction and Analysis of Systems Reduction: A method of proving properties of parallel programs Analysis of communicating automata ), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made. The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use