An Efficient Causal Protocol with Forward Error Correction for Mobile Distributed Systems

Problem statement: Causal ordering is used in Mobile Distributed Systems (MDS) to reduce the non-determinism induced by four main aspects: host mobility, asynchronous execution, unpredictable communication delays and unreliable communication channels. Some causal protocols have been proposed for MDS. All of these protocols in order to ensure the causal order in unreliable channels use the method of Automatic Repeat Request (ARQ). They detect a lost message and carry out the retransmission of this message. This approach was not recommended in a real time mobile distributed system because it increased the transmission delay of the data and the overhead sent in the communication channels. Approach: In this study, we proposed a protocol that ensured the causal order of messages in unreliable and asynchronous MDS. In our protocol, the detection and recovery of lost messages was achieved by the method of Forward Error Correction (FEC) in a distributed form. One interesting aspect of our Causal-FEC protocol was that the redundant information sent in the wired and wireless communication channels is dynamically adapted to the behavior of the system. Results: Our protocol was efficient in terms of the overhead attached per message, the computational cost and the storage control information at a mobile host. Conclusion: The present study is one of the first works on causal algorithms based on forward error recovery in mobile networks.

distributed systems (Alagar and Venkatesan, 1997;Praskash et al., 1996;Kuang et al., 2000;Chandra and Kshemkalyani, 2004;Benzaid and Badache, 2005;Lopez et al., 2008). Most of these causal protocols consider reliable communication channels. However, the loss of messages and the variable latency are inherent characteristics of the wireless communication channels. Some works, in order to tolerate the loss of messages and ensure the causal ordering, use a kind of Automatic Repeat Request method (ARQ) (Acharya and Badrinath, 1996;Alberto and Francesco, 2001;Anastasi et al., 2004). They detect a lost message and carry out the retransmission of this message. This approach is suitable for applications that broadcast discrete data such as images, text and binary files, which are data that tolerate the delay, but are sensitive to the loss of messages. On the other hand, there are applications that broadcast real time discrete and continuous data (e.g., audio and video), which have different transmission characteristics, such as time constrains. Hence, the retransmission of messages is not suitable for such applications because this increment the transmission delay. For this kind of environments a Forward Error Correction scheme (FEC) is preferable over a backward recovery scheme (Perkins, 2003).
In general the protocols that use a FEC approach introduce certain information redundancy in order to identify and recover the lost data. The redundancy in causal protocols represents the number of times that information about a causal message is sent in the system. In this study, we propose a causal protocol that ensures the causal order of messages in unreliable and asynchronous MDS. In our protocol, the detection and recovery of lost messages is achieved by the approach of forward error correction proposed in (Pomares et al., 2009) for non mobile constrained systems. We apply this FEC scheme to the causal protocol MOCAVI presented in (Lopez et al., 2008) in order to support mobile distributed systems over unreliable wireless channels. MOCAVI ensures the causal delivery of messages according to the causal view of the mobile hosts. The protocol MOCAVI is based on the Immediate Dependency Relation (IDR) relation (Pomares et al., 2004). The IDR relation identifies the necessary and sufficient control information to be attached to each message to ensure the causal order in a reliable network. MOCAVI, at the intra-base communication level (wireless connection), only sends as causal overhead timestamped per message, a structure of bits h(m), where each bit in the h(m) is determined according to the IDR. In order to support the loss of messages, we introduce redundancy on the control information attached to the message sent at wireless and wired communication channels. The redundant control information is calculated based on the causal distance (Definition 3) between messages. Instead of restricting the causal information to its immediate predecessors, messages that are IDR related have a causal distance of one (i.e., no intermediate causal message exists between them). The causal information attached to a message concerns messages in its causal past up to a maximal causal distance (greater than one).
One interesting aspect of our Causal-FEC protocol is that the redundant information sent in wireless communication channels is composed by a set of bits, which is dynamically determined according to the behavior of the system and the predetermined causal distance. This redundant information greatly increase the probability that causal order delivery will be obtained, even in the presence of lost messages and significant network delays, by moderately increasing the overhead in the wireless channels. Our causal protocol is efficient in terms of the overhead attached to messages, the computational cost and storage control information on the mobile hosts. The present study is one of the first works on causal algorithms oriented to the forward error recovery over mobile networks.

Preliminaries:
The system model: We consider in this study that an MDS runs over a wireless network infrastructure which consists of two kinds of entities: Base Station (BS) and Mobile Host (MH). A BS has the necessary infrastructure to support and communicate with mobile hosts. The BS communicates with mobile hosts through wireless communication channels. The area covered by a BS is called a cell (Fig. 1).
An MH is a host that can move while retaining its network connection. At any given time, an MH is assumed to be within the cell of at most one BS, which is called its local BS. An MH can communicate with other MHs and BSs only through its local BS. We assume that the wireless communication channels between MHs and BSs are unreliable and asynchronous. The base stations are connected among themselves using wired channels. The BSs and the wired channels constitute the static network. We assume that the wired channels are unreliable (the messages can be lost during its broadcast), with an arbitrary but finite amount of time to deliver messages. Due to system asynchrony and unpredictable communication delays, the messages on an MDS from MH-MH can arrive in a different order as they were sent.
On the other hand, from a logical point of view, we consider that the entities of the MDS are structured into two main communication groups, one conformed by the base stations (GBS = {BS 1 , BS 2 ,…, BS s }) and the other integrated by mobile hosts (GMH = {p 1 , p 2 ,…, p n }), where s and n are the number of base stations and mobile hosts, respectively, in the mobile distributed system. The GMH is subdivided into subgroups (G l ), one for each BS (Fig. 2).
The BSs in the GBS and the mobile hosts in a G l communicate by unreliable asynchronous message passing. We consider a finite set of messages M with m∈M, identified by a tuple m = (p, t), where p is the sender mobile host, such that p∈GMH and t is the logical clock for messages of p when m is sent. When we need to refer to a specific process with its respective identifier, we write p i . The set of destinations of a message m is always GMH.

Background and definitions:
Causal ordering delivery is based on the causal precedence relation defined by (Lamport, 1978). The happened-before relation establishes over a set of events the possible precedence dependencies without using physical clocks. It is a partial order defined as follows: Definition 1: The causal relation "→" is the least partial order relation on a set of events satisfying the following properties: • If a and b are events belonging to the same process and a was originated before b, then a → b • If a is the sent message of a process and b is the reception of the same message in another process, then a → b • If a → b and b → c, then a → c By using Definition 1 we say that a pair of events are concurrently related "a || b" only if ¬ (a→b ∨ b→a).
The precedence relation on messages denoted by m→m' is induced by the precedence relation of events and is defined by: The immediate dependency relation: The Immediate Dependency Relation (IDR) formalized by (Pomares et al., 2004) is the propagation threshold of the control information regarding the messages sent in the causal past that must be transmitted to ensure a causal delivery. We denote it by ↓ and its formal definition is the following: Thus, a message m directly precedes a message m', if and only if no other message m" belonging to M exists (M is the set of messages of the system), such that m" belongs at the same time to the causal future of m and to the causal past of m'.
The IDR is the transitive reduction of the Happened-before relation (Definition 1). This relationship is important because if the delivery of messages respects the order of transmission for all pairs of messages in an IDR, then the delivery of messages respects the causal order for all processes that belong to the group of destinations (p∈GMH). This property is formally defined for the broadcast case as follows:

Property 1:
If m,m' ∈M, m↓m' ⇒ ∀p ∈GMH: delivery(p,m) →deliver(p,m) then m→m'⇒ p∈ GMH: delivery(p,m) →delivery(p,m') Causal information that includes the messages immediately preceding a given message is sufficient to ensure a causal delivery of such message.
The causal distance: The causal distance identifies the number of causal messages that exist in a linearization between a pair of messages in the system (Lopez et al., 2005). Formally, the causal distance is defined as follows: Definition 3: Let m and m' be messages, the distance d(m,m') is defined for any pair m and m' (send(m)→ send(m')), such that d(m,m') is the integer n for some sequence of messages (m i , i = 0...n), with m = m 0 and m' = m n , such that send(m i ) ↓send(m i+1 ) for all i = 0…n-1.

The causal-FEC protocol:
The FEC mechanism: All FEC protocols introduce some kind of redundancy to support the loss of information. The redundancy in causal protocols represents the number of times that information about a causal message is sent in the system. The causal protocol MOCAVI presented in (Lopez et al., 2008), which uses the IDR relation, is efficient because the IDR relation identifies the necessary and sufficient control information that needs to be attached to each message sent over the mobile system. In this protocol, each mobile host p uses a structure of bits in order to establish an immediate dependency relation (Definition 2) among messages. The content of structure of bits at a mobile host p is the only control information attached per message in the wireless channel. Each bit in this structure identifies a causal message m that has a potential IDR with the next message to be sent by p. In this protocol, through the control information stored at the base station and the structure of bits attached to the messages sent in the system, the base stations can determine the immediate dependency relation between messages sent by MHs on different BSs.
Even when this is an efficient protocol, redundant control information is still transmitted in some communication scenarios. Our causal-FEC protocol identifies and uses this inherent redundancy and only adds extra redundancy when it is needed. The purpose of adding extra redundancy is to increase the probability that causal order delivery will be obtained, even in the presence of lost messages and significant network delays.

Analysis of the redundancy and IDR dependencies in mobile environments:
To ensure causal ordering based on the IDR we only need sends control information attached to each message about messages with an immediate dependency relation. For two messages that are IDR-related (m↓m'), the causal distance is equal to one (d(m,m') = 1). Note that for the serial case, a message m has only one immediate predecessor (best case) and that a message m can have at most n immediate predecessor messages, one for each process.
For the serial case, in which the messages are IDRrelated, there is no redundancy in the control information sent. For example, in the serial scenario depicted in Fig. 3, message m 3 only sends information about message m 2 and message m 2 only sends information about message m 1 . In this case, if a message is lost, the causal order delivery can be violated. As shown in Fig. 3, the causal order delivery is violated because at the reception of message m 3 , the base station BS 1 cannot determine if a message preceding m 2 exists or not. With the IDR information on m 3 , base station BS 1 can only detect that it missed message m 2 . In order not to stop the system execution, BS 1 considers message m 2 as lost and then delivers m 3 to mobile host p 1 . In this scenario, m 1 can be delivered after m 3 to mobile host p 1 , which violates the causal ordering. For the concurrent relation, inherent redundancy exists on the control information sent. For example, in the scenario depicted in Fig. 4, messages m 2 and m 3 have the same immediate predecessor m 1 and therefore, m 2 and m 3 send information about message m 1 . If either message m 2 or m 3 is lost, message m 1 can still be detected as shown in Fig. 4. In this scenario, m 2 is lost and m 3 successfully arrives at BS 1 . With the IDR information on m 3 , base station BS 1 determines that m 1 exists, which precedes message m 3 . To deliver m 3 , base station BS 1 establishes message m 1 as lost. In this scenario, m 1 arrives at BS 1 after the delivery of message m 4, but since message m 1 has been established as lost, it is immediately discarded. Therefore, causal order is ensured at mobile host p 1 .

The FEC's propagation constraints for causal ordering:
In order to support the loss of messages, Pomares et al. (2009) propose to increase the redundancy in the control information sent per message by sending information about causally-related messages with a causal distance greater than one. For example, in Fig. 3, if a causal distance of two (causal_distance = 2) is considered, this means that message m 3 must send information about m 2 and m 1 .
According to this approach, in order to be efficient, the redundancy must be increased considering the inherent redundancy introduced by the IDR relation. Formally, in our context the redundancy about a message m, denoted by redundancy p (m), determines the number of times that the information about a causal message m has been seen (received) by a mobile host p. As previously described, the redundancy increases as the number of concurrent messages increases. Taking into account redundancy p (m) with a causal distance greater than one (causal_distance >1), it was established that a message m' must include information about a causal message m (m→m') only if the following propagation constraints are satisfied: PC1: d(m,m')≤causal_distance and PC2: causal_distance>redundancy p (m) With both of these PCs, the control information sent per message is dynamically adapted to the behavior of the system by only introducing redundancy when it is needed. For example, with causal_distance = 2, message m 3 , shown in Fig. 3, must send causal information about m 2 and m 1 because redundancy 4 (m 1 ) equal to one and a causal distance of d(m 1 ,m 3 ) = 2 and d(m 2 ,m 3 ) = 1, respectively. Nevertheless, for the scenario presented in Fig. 4, message m 4 must send information only about messages m 2 and m 3 and not about m 1 , even when d(m 1 ,m 4 ) = 2. This is done because the redundancy 4 (m 1 ) is equal to 2 and therefore, it does not satisfy the second PC.
In a general case, according to the analysis presented in (Perkins, 2003), it is sufficient to take a causal_distance equal to 5 since the probability that three or more consecutive and concurrent messages can be lost is very low.

RESULTS
The algorithm: In our study, we consider that messages can be lost during their transmission over the wireless or wired communication channels, which in some scenarios can cause the causal order to be violated, (Fig. 3). In order to ensure the causal delivery in the mobile distributed system, we increase the redundancy in the sent control information per message by sending information about causally related messages with a causal distance greater than one.
Each time that a message m is received by a base station BS or a mobile host p, we take two corrective actions in order to ensure the causal order at unreliable communication channels. First, we delay the delivery of messages when they do not satisfy the causal dependencies and secondly, we discard messages when their deadlines are exceeded. The deadline of a message m, denoted by deadline(m), can be determined through a centralized method (Baldoni et al., 1996) or a distributed method (Pomares et al., 2009). Here, we do not present how the deadline(m) is calculated, you can refer to these works for details.
Data structure: Each mobile host p uses and stores the following data structures: • mes_received(p) is a counter that is increased each time a message is received by the mobile host p • mes_sent(p) is a counter which is incremented each time a message is sent by the mobile host p • Φ(p) is a structure of bits composed by elements bit_T= 1b. Each bit_T in Φ(p) identifies a message m' in the causal past of p that satisfies, with respect to m, the PC1 and PC2 propagation constraints. The size of Φ(p) fluctuates between 1≤Φ(p)≤n, where n is the number of mobile hosts in the mobile distributed system The structures and variables stored at the mobile host p i are initialized with: Each base station BS uses and stores the following data structures: • mes_sent(BS) is a counter, which is incremented each time a message is sent by the base station BS in its cell The structures and variables stored at the base station BS r are initialized with: The following message structures are used in the MDS by the mobile hosts and base stations (Fig. 5): • The messages sent in the wireless communication channels by mobile hosts to its base station are identified by m and have the following form: m ≡ (i, t, mes_received(p), data, h(m)), where the structures i, t and mes_received(p) have been previously described and: • h(m) is a structure of bits, which is created at the moment of transmission of a message m by mobile host p i . The h(m) structure is composed by elements bit_T = 1b, where bit_T identifies a message m' that satisfies the PC1 and PC2 propagation constraints with respect to m • A message m sent among base stations BSs is denoted by bs(m) and it is composed by a quintuplet bs(m) ≡ (i, t, data, H(m)), where: • data is the content of the message and • H(m) is composed of a set of elements (i, t), which represent messages that satisfy, with respect to m, the PC1 and PC2 propagation constraints. A structure H(m) is created at the moment that a broadcast message is sent by a base station • A message m received by a BS l from a mobile host p∈G l and re-sent by such BS l in its cell, consists of a quintuplet that we call intra(m) ≡ (i, t, data, h'(m)) • h'(m) is a structure of bits, which is created at the moment of transmission of a message m by base station BS. This structure is composed by binary elements bit_T = 1b and bit_F = 0b, where bit-T identifies a message m' that satisfies PC1 and PC2 with respect to m and that the BS l has not ensured its causal delivery to its members and bit-F identifies a message m' that does not satisfy PC1 or PC2 • A message bs(m) received by a BS l and re-sent within its cell, consists of a quintuplet that we call inter(m) ≡ (i, t, data, h'(m))  Return h'(m) } Diffusion: send (m) /* sending of message m to local BS*/  if (t < mes_received(pj) then 2.
Φ(pj) ← Φ(pj) / bit_T endif Protocol description: In the next paragraphs, we describe the steps that are carried out during the diffusion and reception of a message by mobile hosts and base stations in order to ensure the causal order at unreliable wireless and wired communication channels. The protocol specification is given in Table 1-5.

Diffusion of message m by a mobile host p:
The emission of a message m ≡ (i, t, mes_received (p), data, h(m)) by mobile host p to its local base station BS is carried out in four steps. First, the counter mes_sent(p) is incremented by one (Line 1, Table 2). This counter keeps the number of messages sent by mobile host p to local base station BS. Second, the mobile host p creates the structure of bits h(m), which is a copy of structure of bits Φ(p), Line 2, Table 2. Each bit_T in h(m) identifies a message that satisfies, with respect to m, the PC1 and PC2 propagation constraints. Next, the mobile host p attaches h(m) to the message m (Line 3, Table 2). In the following, we will describe how the redundancy in the structure of bits h(m) allow us to support the loss of messages in the wireless communications channels. Finally, the diffusion of message m to local base station BS is done by mobile host p, Line 4, Table 2. update_h'(m)_and_CI ((k, t, d, DC)) endif 13. mes_received (pi) = mes_received (pi) -1 14. ∀ H(m) ← max ((x,y), (k, t)) endif 17.

Reception-sending of message m=(i, t, mes_received(p i ), data, h(m)) by a base station BS:
When a message m ≡ (i, t, mes_received(p), data, h(m)) is received at the local base station BS, it will be immediately discarded if it has already been marked as lost (t<VT (BS)[i]), Lines 2-3, Table 4. If m is not discarded, it is delivered as soon as the FIFO condition becomes true (Lines 5-6, Table 4). The condition FIFO ensures that a message m is delivered until all messages sent before it by the mobile host p, identified by i, have been delivered at BS (t= VT(BS r )[i] +1) or has been established as missing, i.e. their lifetime have expired.
A posteriori, these messages are marked as lost in Line 7, Table 4 and therefore, they will never be delivered. When the FIFO condition becomes true, the message m is delivered to base station BS and the VT (BS) vector is updated into the position that identifies to mobile host p with logical clock t. Afterwards, the base station BS sends message m to the mobile hosts in its cell and to the other base stations in the mobile distributed system. This is done through the diffusion of messages intra(m) and bs(m) by BS, respectively.
The message intra(m) ≡ (i, t, data, h'(m)) is constructed by BS as follows. First, the base station BS forms the structure of bits h'(m), which is created at the moment of transmission of the message m by base station BS to its local mobile hosts, Lines 8-13, Table 4 and Lines 1-7, Table 1. In our study, h'(m) is composed by binary elements bit_T = 1b and bit_F = 0b, where bit_T identifies a message m' that satisfies, with respect to m, the PC1 and PC2 propagation constraints and bit_F identifies a message m' that does not satisfy PC1 or PC2. In this case, it is not necessary to send the control information about m' over wireless and wired channels.
On the other hand, the messages bs(m) ≡ (i, t, data, H(m)) sent by BS to other base stations are constructed as follows. According to the cardinality of the h(m) structure (0≤ | h(m)|≤n-1), the base station BS creates the structure H(m) by adding entries from the CI(p) (Lines 8-11, Table 4) to it. The H(m) structure is composed of a set of elements (i, t), which represent messages that satisfy the propagation constraints (PC1 and PC2) with respect to m.

Reception-sending of message bs(m) ≡ (i, t, data, H(m)) by a base station BS: When a message bs(m) ≡ (i, t, data, H(m)) is received by a base station BS, the BS verifies if bs(m) has been marked as lost (t<VT(BS)[i])
. When this condition becomes true, the message is discarded, Line 3, Table 5; otherwise, the message bs(m) is delivered as soon as the FIFO and causal delivery condition is satisfied. This causal delivery condition ensures that a message bs(m) will be delivered if and only if all messages causally related to it have either been delivered or have been established as missing, i.e. their lifetime has expired. A posteriori, these messages are marked as lost in Lines 7-10, Table 5 and therefore, they will never be delivered.
When the causal delivery condition is satisfied, the message bs(m) is delivered to base station BS, line 6, Table 5. Afterwards, BS carries out the sending of message bs(m) to the mobile hosts located within its cell. This is done through the diffusion of message inter(m) ≡ (i, t, data, h'(m)). In this case, the structure of bits h'(m) attached to message inter(m) is constructed by BS as follows; Line 11, Table 5. For each element m' =(x,y) that belongs to H(m), the base station verifies if an element (k,t,d,DC) ∈ CI(BS r ) exists such that x = k and t≤y. When this condition becomes true, the BS increments by one the causal distance between m' and m, Line 13, Table 5. Later on, if the distance causal between m' and m is equal to the predetermined causal distance (DC = causal_distance), the base station BS deletes the element (k,t,d, DC) that belongs to CI(BS r ) and attaches a bit_F to h'(m); otherwise, the base station BS attaches a bit_T to the structure of bits h'(m), Lines 1-7, Table 1. In our study, each bit_F identifies a message m' that does not satisfy the PC1 and PC2 propagation constraints.

Reception of message intra(m) or inter(m) by a mobile host p:
When a message intra(m) = (i, t, data, h'(m)) or inter(m) = (i, t, data, h'(m)) is received at a mobile host p, it will be immediately discarded if it has already been marked as lost (t<mes_received(p i )), Line 1-2, Table 3. If intra(m) or inter(m) is not discarded, it will be delivered as soon as the FIFO delivery condition becomes true (Line 4-5, Table 3). This delivery condition ensures that a message intra(m) or inter(m) will be delivered if and only if all messages causally related to it have either been delivered or have been established as missing. When the messages that causally precede message intra(m) or inter(m) have been established as missing, the mobile host p carries out the following FEC mechanism. First, the FEC mechanism calculates the amount of messages established as missing, Line 6, Table 3. Later on, in order to ensure the causal delivery, the mobile host p attaches an element bit_T to the structure of bits Φ(p) by each message marked as missing, Lines 7-10, Table 3. Finally, in order to delete the bit_T that identifies a message m' with a causal distance greater than the predetermined causal distance with respect to m, the mobile host p updates its structure of bits Φ(p) with the h'(m) structure attached to message intra(m) or inter(m). This is done by our protocol as follows, Lines 12-14, Table 3. For each element bit_F that belongs to h'(m), the mobile host p must delete an element bit_T of the structure of bits Φ(p). In this case, bit_F identifies a message m' that does not satisfy the PC1 propagation constraint and therefore, it is not necessary to send the control information about m'. Later on, due to the delivery of message intra(m) or inter(m), the mobile host p attaches a bit_T to the structure of bits Φ(p), line 12, Table 3.

Correctness proof:
To show that our protocol ensures the causal delivery (correctness), we provide a correctness proof. In order to do the proof as simple as possible, we divide the correctness proof into two parts: first, we focus on the novel part for the unreliable wireless channels, which is the redundancy control information (bits) attached to the sent messages at wireless channels and the causal information stored at the base stations (Theorem 1). Secondly, we show that with this redundancy information, it is possible to ensure the causal order in mobile distributed systems with unreliable communication channels (Theorem 2).
Consider two messages m k = (p i , a, event, h(m k )) and m l = (p j , b, event, h(m l )), where p i and p j are the sender mobile hosts of m k and m l , respectively, a and b are the sequential ordered logical clocks for messages of p i and p j when m k and m l are sent, respectively. And finally h(m k ) and h(m l ) are the structures of bits when the messages m k and m l are sent, respectively.
Main steps of the proof: The proof is composed by two lemmas and a proposition. The lemmas are intermediate results necessary for our proof: • Lemma 1 shows that if bit_T k belongs to the causal history of a message m l , then the message identified by bit_T k causally precedes message m l • Lemma 2 indicates that the message m k satisfies PC1 and PC2 propagation constraints with the other message m l if and only if the bit_T k belongs to the causal history of the message m l • Proposition 1 shows that through the bits structure (h(m)) attached to the sent message m l and the causal information at the base stations (CI(BS)), we identify messages that satisfy the PC1 and PC2 propagation constraints with respect to m l (Theorem 1)

Lemma 1:
bit_T k ∈ h(m l ) ⇒ m k → m l Proof: By line 2, Table 2, we have that bit_T k ∈ h(m l ) if and only if bit_T k ∈ Φ(p j ) when the sending of m l is carried out by p j . We denote it by send(p j , m l ). By using line 12, Table 3, we have that bit_T k ∈ Φ(p j ) only after the delivery m k = (p i , a, event, h(m k )) at p j . This implies that the delivery of m k precedes the sending of m l (delivery (p j , m k ) →send(p j , m l )). Therefore, m k → m l .◊ Lemma 2: The proof is divided into two steps: First, we show that d(m k , m l )≤ causal_distance ⇒ bit_T k ∈ h(m l ) and second, we show that bit_T k ∈ h(m l ) ⇒ d(m k , m l) ≤ causal_distance Step 1: The proof is by contrapositive. We proof that bit_T k ∉ h(m l ) ⇒∃ m r , m r+1 , m r+2 m n-1 m n ∈ Μ such that m k ↓ m r ↓ m r+1 ↓ m r+2 .…, ↓ m n-1 ↓ m n ↓ m l ; thus, the message m k with respect to message m l has a causal distance greater to the defined causal distance (d(m k ,m l ) > causal_distance)). Let bit_T k ∉ h(m l ), only one event can delete bit_T k of Φ(p j ) before sending m l (send (p j , m l )), this is: By lines 13 and 14, Table 3, bit_T k is removed from Φ(p j ) when the delivery of message m n is carried out with bit_F k ∈ h(m n ) at p j (delivery(p j , m n )). The binary element bit_F k is attached to h(m n ) if and only if the d(m k ,m n ) = causal_distance, Lines 2 and 3, Table 1. This implies that for pair m k and m n a sequence of messages exists such that send(m k )↓send(m r )↓ send(m r+1 )↓send(m r+2 )↓…↓send(m n-1 )↓send(m n ), where the causal distance between m k and m n is equal to the defined causal distance. Thus, the delivery(p j , m n ) at mobile hot p j before the sending of m l deletes the bit_T k of Φ(p j ). Therefore, the d(m k ,m l )>causal_distance because bit_T k ∉ h(m l ).
If this event does not occur, we have that bit_T k ∈ Φ(p j ) when the send(p j ,m l ) is carried out and by Line 2, Table 2, we have that bit_T k ∈ h(m l ).◊ Step 2: The proof is by contradiction. By lemma 1, we know that if bit_T k ∈ h(m l ), then m k → m l with p i ≠ p j . We suppose that there are any messages m r , m r+1 , m r+2 m n-1 m n such that send(p i , m k ) → send(p r , m r ) → send (p r , m r+1 ) → send(p j , m r+2 ) →…….→ send(p j , m n-1 )→send(p j , m n ) → send(p j , m l ) and in addition that d(m k , m n )= causal_distance. The proof considers the following case: • The delivery m k causally precedes to m n (delivery(p j , m k ) → delivery (p j , m n )) at p j . By the step 1, we know that bit_F k ∈ h(m n ). Hence, on the delivery m n at mobile host p j , bit_T k is deleted by Lines 13 and 14, Table 3. When performing the sending of m l (send(p j , m l )) and because of send(p j , m n ) → send(p j , m l ) ⇒ delivery(p j , m r ) →send (p j , m l ), then bit_T k ∉ Φ(p j ) and therefore, bit_T k ∉ h(m l ), which is a contradiction.
The following proposition shows that through the bits attached to the sent messages at wireless channels and the causal information stored at the base stations, we identify messages that satisfy the PC1 and PC2 propagation constraints with respect to m l .

Proposition 1:
bit_T k ∈ h(m l ) ⇒ (i, a) ∈ H(m l ) Proof: By line 23, Table 4, we have that (i, a, k') ∈ CI(BS) only after the delivery of message m k = (i, a, mes_received(p i ), event, h(m k )) at the local base station BS. In this case, k' (by line 17, Table 4) identifies the sent message by the base station to its local mobile hosts. In the delivery of m k at p j with a = k', we have (by Lines 1 and 11, Table 3) that k' = mes_received(p j ) and by Line 12, Table 3, we have that bit_T k ∈ Φ(p). We know by Lemma 2 (Step 2) that if bit_T k ∈ h(m l ), then d(m k , m l ) ≤ causal_distance. On the reception of message m l sent by p j with m l = (p j , b, mes_received(p j ), event, h(m l )) at the base station BS, by Lines 8-13, Table 4, we have (i, a) ∈ H(m l ) because there is in CI(BS) an element (i, a, k') where k'=mes_received(p j ), such that (i,a) identifies to messages m k with d(m k , m l ) ≤ causal_distance.◊ Lemma 3: For all m k , m l ∈Μ, m k → m l such that Src(m k )≠ Src(m l ) and redundancy (m k )≤causal_distance implies that m k = (i,a) ∈ Η(m). This is accomplished by the procedures at the diffusion message by Lines 8, 11 and 18 and at the reception message by Lines 12 and 23, Table 4 and by lines 14 and 19, Table 5.
Theorem 2: (Correctness) for all m k , m l ∈ Μ, m k → m l such that d(m k ,m l ) ≤ causal_distance implies that delivery(m k ) → delivery(m l ).
Proof: Let us consider two messages m 0 and m n such that send(m 0 ) → send(m n ) and both are received by p. We show that they are delivered to p according to causal ordering.
For this proof, we have two general cases. The proof is by induction on the distance d(m 0 ,m n ).

Base case:
d(m 0 ,m n ) =1 and d(m 0 ,m n ) ≤ causal_distance In this case, m 0 is IDR related to m n and from Lemma 3 and since always d(m k , m l ) ≤ redundancy(m k ), we have m 0 ∈ Η(m n ). It follows that line 5, Table 5, will delay the delivery of m n until after the delivery of m 0 .

Induction case:
d(m 0 ,m n ) ≥ 2 and d(m 0 ,m n ) ≤ causal_distance By induction, we have that all messages of the set {m r ∈ Μ: m r-1 ↓m r for all r =1…n-1} that are delivered to p are delivered in causal order. For the induction phase, we have two cases depending on whether m n-1 has been delivered or discarded at p: • For m n-1 delivered at p. We have m n-1 that immediately precedes m n so the base case applies to these messages: m n-1 is delivered before m n and by transitivity m 0 is delivered before m n • For m n-1 discarded at p. In this case m n-1 ∈ Η(m n ) and by Lemma 3 and Line 5, Table 5, it follows that m n is delivered after its lifetime has expired. We have that for a message m r that belongs to the path m 0 to m n-1 implies that the delivery or discarded time of m r is less than or equal to the discarded time of m n-1 , Line 5, Table 5. Consequently, m n is delivered at p after m 0 .
We notice that when a message m n-y such that n-y > causal_distance, we have m n-y ∉ Η(m n ) and therefore, we cannot ensure the causal delivery of m n-y with respect to m n .

DISCUSSION
Overhead analysis: In our protocol, the size of the control information sent over the wired communication channels depends on the number of concurrent messages that immediately precede a message m. In order to be efficient, each entry in H(m) corresponds to the most recent message sent by a mobile host p i and causally received by p j (Lines 14-16, Table 4). This is possible since each message m is sequentially timestamped with its respective local logical clock of mobile host p i (Line 3, Table 2). By knowing the sequential order, a mobile host p j can determine at any message reception if a message or set of messages diffused by p i has been lost, independently of the causal distance.
Since H(m) has only the most recent messages that precede a message m, the overhead per message sent over the wired communication channels in our protocol to ensure causal ordering is given by the cardinality of H(m), which can fluctuate between 0 and n-1 (0≤| H(m)|≤n-1), where n is equal to the number of mobile hosts in the group. In the best case, dealing with the serial case (no concurrency of messages exist), we note that the overhead per message is at most the causal distance established (|H(m)| ≤ causal_distance) and for the case of concurrent messages, the worst case is at most n-1 (|H(m)| ≤ n-1), which is the same boundary for messages that are IDR related (causal_distance = 1).
On the other hand, the control information attached to messages sent over the wireless network and stored at a mobile host can fluctuate between 0 and n-1 bits (0≤|h(m)|≤n-1), where n is equal to the number of mobile hosts in the group. Again, the size of h(m) depends on the number of concurrent messages that immediately precede a message. In the best case, which is the serial case, the size of h(m) is equal to, at most, the causal distance established (|h(m)|≤ causal_distance) and in the worst case, for the case of concurrent messages, the size of h(m) is at most n-1 bits.
We notice that in our Causal-FEC protocol, as for MOCAVI causal protocol in (Lopez et al., 2008), the likelihood that the worst case will occur approaches zero as the number of participants in the group grows. This is because the likelihood that n concurrent messages occur decreases inversely proportional to the size of the communication group. This behavior has been shown in (Pomares et al., 2004). Compared with protocols that are exclusively based on vector clocks (Mattern, 1988), our worst case denotes for them the constant overhead that must always be attached per message.

CONCLUSION
An efficient FEC causal protocol has been presented. The protocol is efficient in terms of the overhead attached to messages, computational cost and storage control information on the mobile hosts. In our study, the redundancy control information attached per message is dynamically adapted to the behavior of the system. We have shown that this control information allows us to perform a causal forward error recovery when messages are lost. Our Causal-FEC protocol is suitable for multimedia cooperative systems in real time since it performs a forward error recovery and it does not require previous knowledge of the behavior of the system.