• Tidak ada hasil yang ditemukan

The C OUNTER F LOODING Algorithm

4.2 Applications of the Gas Station Problem

5.1.2 The C OUNTER F LOODING Algorithm

such adjacent nodes inV(t). Members ofV(d,t) andV(d,t) are marked by↑and, respectively.

Denote byE(d,t) the set of all edges connecting the nodesuV(d,t) to the nodes vV(d,t). In the Figure, these edges cross the dot-dashed line. ConsidereE(d,t) connectingu andv. Two types of events trigger a message transmission fromu to v: (a) whenudetects the presence ofv at timetc, the eventc(u,tc)∈Cuis generated, and (b) when a new messagemreachesu at timetm and convertsuinto the setV(d,tm), the eventm(u,tm) is generated. If a message has been previously received, no event is generated.

V

V (t)

V (t) V(t) d

v

0

d

V

d

FIGURE5.4 V(d,t)(↑),V(d,t)(↓),E(d,t), andVd

Now, we will attempt to analyze the relationship betweent,tm, andtc. We know that the two nodesu andv are already connected at timet, so tc <t. Further, since uV(d,t) at timet, the message must have already arrived atu before t, which means tm <t. However, clearly we can only have eithertm <tc ortc <tm, as shown in Figure 5.5.

tm

tc t

t

tm tc

V(t) d

v

0

d

V

d

FIGURE 5.5 Two possible orders betweent,tc, andtm

In the first case oftm <tc, the connection is established afteru already receives and stores the message, while in the second case oftc <tm, the message arrives after con- nection betweenu andv is established. In both cases, the messagem is transmitted fromutov at time max(tm,tc). Let us consider these two mutually exclusive cases:

(a) If the message is transmitted attc, then by assumption4of HDN, the message must reachv beforetc+τ. Next, by assumption5, we can guarantee that up to time tc+τ:

(i) the connectioneestablished at timetc cannot be broken, and (ii) the nodev cannot leave the network. Otherwise, either one of these will produce an event inCu less than τapart from the previous event. Therefore, attc+τ, the nodevcan be guaranteed to be inV.

Let us setτm in assumption6to a very large number for now, in effect retaining the messagem indefinitely at the nodes that have received it. Consequently, att+2τ, the nodev is still inV. If the case we just described — that the message is transmitted attc

— is true for at least one edgee (and a terminal nodev), then att+2τ, the setVgrows by one node, andVshrinks by one node compared to their sizes att.

(b) If the message is transmitted attm, then the situation is more complicated to prove.

During the maximum transit timeτrequired bymto reachv fromu, the edgee might disconnect itself; or, the target nodev itself might leave the network before it receives the message. In fact, these events might take place sometime attdeven beforetm, which meanstc <td <tm<t!

We invoke assumption2to prove that such a failure cannot happen onallthe edges inE(d,t). If failure does not occur on the edgee, then again by assuming a largeτm, a successful message transmission onemust increase the size ofVby one, and decrease the size ofVby one attm+2τ.

To prove this claim, consider the separate timelines shown in Figure5.6, one for each edge inE(d,t), all aligned with marks placed at timet. A message traveling along an edgeeis represented by an interval [tm,tm+τ] that is placed on the timeline such that tmttm+τ. Since several edges may originate from the same node and thus have the sametm, some intervals may occupy identical horizontal locations on their timelines.

t tm

t+τ

FIGURE 5.6 The timelines forE(t) showing transit and dead regions

For a particular edge eE(d,t), let td denote the time when eithere disconnects, or v leaves the network. Sincee exists at t, thentd >t. Ifttd <tm+τ, then the message fails to reach v. For∀eE(d,t), call the region [td,td +τ] the dead region d(e,td). Again, since several edges may head toward the same node and as a resullt have

the same disconnection timetd, some of these dead regions may occupy identical time regions.

Select two of the timelines with the maximum and minimum values oftm, denoted by tm bytm andtm, along with the associated intervals. The two intervals must overlap because they both contain t, otherwise it will contradict the original assumption that all intervals are aligned at timet. Next, if these two extreme intervals overlap, then the other non-extreme intervals withtm obeyingtm<tm <tmmust also overlap with at least one of them.

Suppose dead regions exist in allthe intervals. Using the above argument, then the dead regions of the maximum and minimum intervals must also overlap because both of them must contain the time markert+τ. Just as before, we claim that the dead regions of all intervals must also then overlap att+τ. But this means that the nodes inV(d,t+τ) are completely disconnected from those nodes inV(d,t+τ). Since at least one of the destination nodes must be inV(d,t+τ), this contradicts assumption2.

Therefore, to preserve connectivity, there must be at least one interval without a dead region. A messagemsuccessfully transmitted along the edge associated with this inter- val will convert one nodevfromVintoVsometime between the edge’stm andtm+τ.

Assuming a largeτm as before, att+2τ, v remains inV. This implies that the setV grows by one node, and the setVshrinks by one node from their original sizes at time t.

So far, we have been assuming thatdVd is part ofV(t). These destination nodes are separated from the nodesuV(d,t) by zero or more nodesvV(d,t). For now, assume thatd 6∈V(d,t). At least one of the nodes inV(d,t) must remain connected toV(d,t) to satisfy assumption2. Consequently, one of the nodes inV(d,t) then joins V(d,t+2τ) at a later time. This proves that|V(d,t+2τ)|>|V(d,t)|whendV(d,t).

This process is repeated untildV(d,t) (or equivalently, untilN(d,t)∩V(d,t)6=∅).

WhendV(d,t), then it will have received a message from a node inV(d,t) att+2τ.

OncedV(t), then one of its neighborsnN(d,t) are also inV(t) and assumption2 is automatically met. Consequently, the remaining nodes inV(t) may or may not be in contact with the other nodes inV(t). This proves that|V(d,t+2τ)| ≥ |V(d,t)|when dV(t).

Imagine the same process happening in parallel to all the destination nodes inVd as shown in Figure5.7. Nodes inV(t) may leaveV(t) and become isolated, but when they re-enter the network att>t, they will be inV(t). The nodes inV(t) is converted to V(t+2τ) one by one.

V

V (t)

V (t) V(t) d

v

0 d

V

d

FIGURE5.7 The arrows indicate allowable transitions of the network nodes in the setsV(t), V(t),V(t), andV\V(t) for HDN.

The arrows in Figure5.7indicate these transitions. Since|V|is finite, the entireVd is guaranteed to ultimately joinVat some timet, at which pointV(t >t) may or may

not grow further. We have proved Lemma11.

Having proven the preceding Lemma11, we now prove that the CFA is a solution to the HDN problem. The algorithm requires one input ¯V and intercepts two types of events:

the connectivity-driven eventsc(v,t) and the message-driven eventsm(v,t). When the message is first received at v, the counterk is reset to 0, and the message is retrans-

mitted toN(v,t). Ifv is notified of a neighborhood change with the arrival ofc(v,t), it increments the counterkby one until it reaches the maximum 2 ¯V.

Theorem 12. The CFA solves the HDN problem in less than2τV time unit.¯

To prove that the CFA is a solution to the HDN problem, we have to prove two things.

First, we have to prove that a message sent from the source using the CFA under the HDN assumption is guaranteed to reach the destination nodes. However, this was already proved in Lemma11. The counterkis used to ensure that the CFA does not broadcast after termination.

Second, we have to prove that the CFA ends in finite time. Consider one destination noded. In the worst case scenario,|V(t)|is equal to 1 att=0 (whereV(0) contains only the sourcev0), is equal to 2 att=1, is equal to 3 att=2, and so on, up tot=2τ( ¯V1) where|V(t)|=|V| ≤V¯. Therefore, we can say that byt=2τV¯, the message has reached the destination nodes. In other words, the CFA terminates in less than 2τV¯ time unit.

The CFA can also be extended to support multiple messages simultaneously. From the listing, we can see that if the simple counterkis converted into an arraykmindexed by the message, then it terminates after allkm=V¯.

So far, we assume a large value of message retention timeτm to ensure that when a node inV(t) leavesV(t), it returns intoV(t) some timet>t later. However, while these nodes need to pass many messages over its lifetime, realistically, most HDN nodes only have a limited amount of storage which also storesN(v,t) used to detectc(v,t).

Therefore, the nodes cannot keep their messages indefinitely — a large value ofτm. From Theorem12, if the nodes have access to a synchronized network clock, then they need to keep only messages 2τV¯ and younger (relative to the origination timestamps).

Otherwise, messages 4τV¯ and younger (relative to the localreceipttime) are needed.

There are other flooding and routing algorithms in [1] that use slightly modified as- sumptions. For example, the LISTFLOODINGalgorithm (LFA) does not assume that ¯V is available. Instead, it assumes that the nodes have unique identifiers used to estimate ¯V.

Since these algorithms also use the CFA as their main ingredient, they too can be eas- ily extended using Lemma11to solve the modified HDN problems. Thus, we omit this derivation.

Finally, we observe that the connectivity assumption of a HDN can be relaxed even further without affecting the reliability of the CFA! Assumption2can be restated as:E(t) is such that at any timet, there is at least one connection between one node inV(t) and another node inV(t).

The proof of this assertion is quite simple and sketched as follows. By requiring that at least one node inV(t) is connected to a node inV(t) at all times, we can use the same argument as in Lemma11and state that|V(d,t+2τ)| ≥ |V(d,t)|. Since the number of nodes inV is finite, eventuallyd will be connected to a node inV. In the worst case scenario, the nodes inVdare the last nodes to receive the message, implying an identical upper bound.