• Non ci sono risultati.

Counting on Anonymous Dynamic Networks through Energy Transfer ?

N/A
N/A
Protected

Academic year: 2021

Condividi "Counting on Anonymous Dynamic Networks through Energy Transfer ?"

Copied!
12
0
0

Testo completo

(1)

Counting on Anonymous Dynamic Networks through Energy Transfer ?

G. A. D

I

L

UNA

, R. B

ALDONI

, S. B

ONOMI

, I. C

HATZIGIANNAKIS

,

Cyber Intelligence and Information Security Research Center and Dipartimento di Ingegneria Informatica, Automatica e Gestionale Antonio Ruberti

Universit´a degli Studi di Roma La Sapienza, Roma, Italy {baldoni, bonomi, diluna}@dis.uniroma1.it

Computer Technology Institute & Press “Diophantus” (CTI) Patras, Greece

{ichatz}@cti.gr

Abstract. This paper addresses the problem of counting the size of a network where (i) processes have the same identifiers (anonymous nodes) and (ii) the network topology constantly changes (dynamic network). Changes are driven by a powerful adversary that can look at internal process states and add and remove edges in order to contrast the convergence of the algorithm to the correct count. The paper proposes two leader-based counting algorithms.

Such algorithms are based on a technique that mimics an energy-transfer between network nodes.

The first algorithm assumes that the adversary cannot generate either disconnected network graphs or network graphs where nodes have degree greater than D. In such algorithm, the leader can count the size of the network and detect the counting termination in a finite time (i.e., conscious counting algorithm). The second algorithm assumes that the adversary only keeps the network graph connected at any time and we prove that the leader can still converge to a correct count in a finite number of rounds, but it is not conscious when this convergence happens.

Keywords: Anonymous Networks, Dynamic Networks, Counting Algorithms, Dynamic Graph Adversary.

?

This paper will appear at ICDCN14 under the title “ Conscious and Unconscious Counting on Anonymous Dynamic Networks ”

(2)

1 Introduction

Computing global properties of a distributed system based on a static topology (i.e. counting the nodes belonging to the system) is of primary importance to build applications that take decisions locally at each node, based on global information. As an example, making a distributed near-optimal load balancing among the nodes of the system cannot be computed without knowing the network size. Additionally, knowing the size of the network is needed to ensure distributed termination of algorithms (e.g, terminating broadcast). Recently, dynamic distributed systems have attracted a lot of interest [5,8], due to the fact that static ones do not capture anymore the new kind of software applications designed to run on top of emerging environment like mobile and sensors networks. In this environment, the topology of the network connecting the distributed system participants constantly changes. The high dynamicity of the topological connections between processors brings new challenges for solving problems that were already solved on the top of static distributed systems. Moreover, privacy concerns are becoming more and more important and they could be addressed considering models where processors does not have unique IDs [18]. In this paper we consider the problem of counting the size of anonymous dynamic network. More specifically, we study round-based computations under worst-case dynamicity as originally introduced by [17] and then refined in [14]. We consider that the network graph is controlled by a dynamic graph adversary that, at each round, may introduce or remove any number of edges, still ensuring the graph remains connected. Communication along edges is assumed to be bidirectional and nodes are not aware of which edges are made available by the adversary at each round. Messages are then delivered to current sender’s neighbors, as chosen by the adversary; nodes change their states, and the next round begins. Each node runs a deterministic algorithm that generates messages based on processes internal state that the adversary is able to read.

Counting on anonymous static networks with broadcast has been proved to be non-solvable when there is no leader available [16]. The authors also conjectured that counting in networks under dynamic graph adversary without having knowledge (or estimation) of some network characteristics is impossible. In this work, we introduce a technique for computing the size of an anonymous network that is resilient to a dynamic graph adversary. The technique mimics an energy-transfer and it is embedded in a leader-based algorithm to circumvent the impossibility result. Informally the technique works as follows: each node v

i

is assigned with a fixed energy charge, stored in the variable e

vi

, and during each round it discharges itself by disseminating energy around to its neighbors i.e., e

vi

decreases of a value k ≤ e

vi

/2, then this quantity k is equally split among the neighbors of v

i

and this value is added to v

i

’s neighbors variable.

The leader acts as a sink collecting energy (i.e., energy is not transferred by the leader to neighbors). Our technique enforces, at each round, a global invariant on the sum of energy among networks’ nodes (i.e., P

vi

e

vi

= #nodes), that resorts to the fact that energy is not created or destroyed in the anonymous dynamic distributed system (energy conservation property). Considering the behavior of the nodes, the energy is eventually transferred to the leader and stored there. The leader measures the energy received to count the size of the network. In particular, we present a leader-based algorithm that employs the energy-transfer technique and is tolerant to the dynamic graph adversary additionally constrained by the fact that it cannot generate graphs including nodes with a degree over a certain bound.

At the best of our knowledge, the algorithm proposed in this work is the first algorithm that provides, in a finite time, an exact count on an anonymous dynamic network with broadcast. In the worst-case, the algorithm requires exponential time to complete and the leader is always able to detect when the counting is over (conscious counting). As second result, we show that the conjecture presented in [16] is not valid when considering counting algorithms that are not able to detect the time at which the convergence happens (unconscious counting). To this aim, we present an unconscious leader-based algorithm exploiting the energy transfer technique that is able to reach the correct count being resilient to the dynamic graph adversary. The rest of the paper is organized as follows: Section 2 presents relevant previous work, and in Section 3 we formally define both the anonymous network model, the dynamic graph adversary and the counting problem specifying the properties of convergence and consciousness. Using the energy transfer technique, in Section 4 we present a counting algorithm, namely A

D

, resilient to a dynamic graph adversary with bounded degree.

Finally, Section 5 shows a counting algorithm A

N oK

, that is able to count the size of the network under dynamic graph adversary, however such algorithm does not verify the consciousness property. Section 6 concludes the paper.

2 Related Work

To the best of our knowledge, the only other work that discusses the problem of counting and naming in an anonymous

network with worst-case adversary is [16]. However, the authors just provided an algorithm that knowing an upper

(3)

bound on the maximum degree of graphs generated by the adversary, makes possible to each node to compute an upper bound on the size of the network. This algorithm is used as basic building block in our counting algorithm as shown in Section 4. In the rest of the section we consider other works done in the contexts of anonymous static networks, fully identifiable dynamic networks and adversary models that are related to our problem.

Static anonymous networks. The question concerning which problems can be solved on top of an anonymous net- work, where all nodes have the same identifier, has been pioneered by Angluin in [2]. Yamashita and Kameda [18]

proposed several characterizations for problems that are solvable under certain topological constraints when consider- ing known the size of the network. Further investigation led to the classification of computable functions [4,18]. The work presented in [7] has been the first one that removed the assumption of knowing the network size n and provided characterizations of the relations that can be computed with arbitrary knowledge.

Fraigniaud et al. [11] assumed a unique leader in order to break symmetry and assign short labels as fast as possible.

To circumvent the further symmetry introduced by broadcast message transmissions they also studied other natural message transmission models as sending only one message to a single neighbor. Recently, Chalopin et al. [9] have studied the problem of naming static anonymous networks in the context of snapshot computation; such work uses the notion of “graph covering” [4,18], that is usable only on static topologies and is not defined for highly dynamic system like the one studied in our work.

Finally, Aspnes et al. [3] studied the relative power of reliable anonymous distributed systems with different communication mechanisms: anonymous broadcast, read-write registers, or read-write registers plus additional shared- memory objects.

Dynamic distributed systems where all processes have distinct identifiers. Distributed systems with worst-case dynamicity were first studied in [17] by introducing the 1-interval connectivity model. They studied flooding and routing problems in asynchronous communication and allowed nodes to detect local neighborhood changes. Under the same model, [14] studied the problem of counting in networks where nodes have unique IDs and provided an algorithm that requires O(n

2

) rounds using O(log n) bits per message.

Adversarial vs Random dynamic graph. The gossiping model [12,13] can be seen as a dynamic graph where, at each round, each node randomly selects some neighbors to execute the view exchange. The adversarial model considered in this paper differs from random dynamic graph since in our case the adversary is able to read the state of nodes and compute the set of best edges to add/remove in order to break the correctness of the counting while the gossip adversary simply selects nodes randomly without any strategy.

3 System Model and Problem Specification

We consider a distributed system composed by a finite set of processes V (also called nodes). Nodes in V are anony- mous, i.e., they initially have no identifier and execute a deterministic round-based computation. We assume the set V remains the same throughout the computation.To ease of presentation, in the following we sometimes refer to pro- cesses using names as v

i

but such names cannot be used by processes themselves in the algorithms.

Every round is divided in three phases: (i) send where processes send all the messages for the current round, (ii) receive where processes receive all the messages sent at the beginning of the current round and (iii) computation where nodes process received messages and prepare those that will be sent in the next round. Rounds are synchronous and they are controlled by a fictional global clock accessible to all the nodes. Thus, all nodes have access to the current round number via a local variable that we usually denote by r. Processes have a local view of the network, i.e. they know a subset of processes called neighbors. Processes are arranged in a communication network and they can communicate only by exchanging messages trough an anonymous broadcast primitive. Such primitive ensures that a message m sent by node v

i

at the beginning of a certain round r will be delivered to all its neighbors during round r.

Dynamic Network and the Dynamic Graph Adversary. The communication network is dynamic, i.e. its topology

changes along time due to possible nodes or communication links failures. A dynamic network is modeled by a

dynamic graph G(r) = (V, E(r)), where V is the set of nodes (or processors) and E : IN → P(E

0

), where E

0

=

{{u, v} : u, v ∈ V }, is a function mapping a round number r ∈ IN to a set E(r) of bidirectional links drawn from E

0

[14]. The neighborhood of a node v

i

at round r is denoted by N

vi

(r) = {u : {u, v} ∈ E(r)}.

(4)

Intuitively, a dynamic graph G(r) is an infinite sequence G(1), G(2), . . . of instantaneous graphs, whose edge sets are subsets of E

0

chosen by an adversary. If there are no topology properties imposed on the graphs generated by the adversary (e.g., upper/lower bound on the degree of a node, bound on the diameter of the network), the adversary can generate any graph ranging from a fully connected one to a graph composed by all singleton nodes.

In the paper, we assume that the dynamic graph/network G(r) = (V, E(r)) is 1-interval connected as defined in [14]. A network is 1-interval connected if for all r ∈ IN, the static graph G(r) is connected. Thus, the adversary can change arbitrarily the graphs in the sequence (by adding and removing edges) while ensuring that each graph G(r) in the sequence is connected. Additionally, the adversary is able to read each process state building thus a sequence of graphs that could prevent an algorithm to be correct. We call such adversary, dynamic graph adversary. In addition, we also consider a less powerful adversary that generates only instances G(r) = (V, E(r)) where the number of neighbors that each node v

i

may have is always bounded by a constant upper bound D (i.e. ∀v

i

∈ V, ∀r ∈ N, |N

vi

(r) | ≤ D). We call this adversary dynamic graph adversary with bounded degree. For the easy of presentation and whenever it does not generate confusion, in the remaining of the paper we will use the term adversary and dynamic graph adversary interchangeably.

The Counting Problem. The counting problem can be formalized by the following properties:

Let g be a variable representing a guess on the size of the network at a process v.

– Convergence: There exists a round r after which at least one process p has permanently a correct guess on the size of the network, i.e., g = |V |.

– Consciousness: If a node v has a correct guess g on |V |, then there exists a round r

0

(with r

0

≥ r) such that v is aware about the correctness of the guess.

In the following, given a counting algorithm A, we will say that it is conscious if it is able to satisfy both the properties; on the contrary, if it satisfies only the convergence property we will say that it is unconscious.

4 Conscious Counting Algorithm resilient to a Dynamic Graph Adversary with Bounded Degree

This section presents a distributed algorithm, denoted as A

D

, that assumes (i) the existence of a leader node starting from a different initial state and (ii) all other nodes execute identical programs. In addition, A

D

assumes that the bound on nodes degree D (which limits the powerfulness of the adversary) is known by all processes.

A

D

is composed by a sequence of iterations i = 0 . . . ` run by the leader and each iteration takes several rounds.

Each iteration i starts considering two parameters: (i) the upper bound on nodes degree D and (ii) an upper bound K

i

on the network size; then, the algorithm computes a guess for the network size. If the guess matches the current considered bound K

i

, then the algorithm terminates and K

i

corresponds to the size of the network |V |. Otherwise iteration i + 1 is started taking D and K

i+1

= K

i

− 1 as inputs.

Let us notice that, starting from the upper bound D on nodes degree, an upper bound K

0

, to be used in the first algorithm iteration, can be easily computed (e.g. by using the algorithm shown in [16]). Thus, the hard part of A

D

is to compute the guess on the network size at the end of each iteration. To this aim, A

D

employs the idea of energy-transfer and exploits the invariant on the energy globally stored in network: the sum of the energy stored by each node at the end of each round remains constant during the algorithm execution. Note that the energy we are considering is not the real energy that nodes may have but it is rather an abstraction used to explain the details of the algorithm.

At the beginning of each iteration i (with i ≥ 0), every node is assigned with a fixed energy charge, and during each round r it discharges itself by disseminating the energy to its neighbors. The leader acts as a sink collecting energy (i.e., it does not transfer energy to its neighbors).

Considering the behavior of the nodes, the energy is eventually transferred to the leader. The leader measures the

level of energy received to verify if the energy level matches the bound K

i

considered in the current iteration i. More

specifically, the leader starts iteration i of A

D

algorithm by assuming that the network has size K

i

and computes the

first round r f inal

i

where, in the worst case, it should have received strictly more than K

i

− 1 energy by all the others

(5)

1

1 2⇥ 3

e

2

e

1

e

3

e

0

= 1 1

2 + (5 3) 1 2 +

X

5 i=1

e

i

Fig. 1: Send, Receive and Update of energy for a non leader node

(see Lemmas 2,3). If at round r f inal

i

, the leader has received such amount of energy then it outputs |V | = K

i

. Otherwise the algorithm starts iteration i + 1 with K

i+1

= K

i

− 1.

AlgorithmAD– Conscious Counting Algorithm resilient to a Dynamic Graph Adversary with Bounded Degree.

(Step 1) The algorithm starts taking as inputD and computes an upper bound K on the network size by running an estimation algorithm as the one shown in [16];

(Step 2) The leader and the anonymous nodes start the step 2 at roundr start;

leader : The leadervlmaintains the following local variables:evl← 1 representing the initial energy charge, rcvvl ← ∅ is a set variable where vlstores all the messages received during each round,i← 0 is the iteration number, Ki← K is the upper bound on the network size at iteration i, r initi← r start is the starting round of iterationi, r f inaliis the termination round of iterationi when the leader will be able to either validate the guess (i.e.,|V | = Ki) or not (i.e.,|V | < Ki) - see Lemmas 2, 3.

start iteration i at round r initi: takeD and Kias inputs

The leader computes the minimumR∈ N+such thatR satisfies Ki−(1−(B−1B )R)Ki< 1, where B = (2D)Kand setsr f inali← r initi+ RKi. for each roundr:

– Send phase of roundr: at the beginning of each round, vlbroadcasts aENERGY RELEASE(0) message releasing no energy.

– Receive and Computation phases of roundr:ENERGY RELEASE(e0) messages are stored in the rcvvlvariable. At the end of the round, when all the messages have been received,vlupdates, its local energy charge as follows:

evl← evl+ received

where received is the sum of all the charges received by neighbors (i.e., P

e0 ∈rcvvl

e0).

– When(r = r f inali) % Terminating Condition % if(Ki− evl< 1)

thenvlterminates and broadcasts forKiroundsSTOP(Ki) message to other nodes and then it outputs count← Ki;

elsevlsends a messageRE-START(r f inali+ Ki) to other nodes declaring that it will start a new iteration. This message is broadcast for Kirounds and thenvlstarts iterationi + 1 considering the new bound Ki+1= Ki− 1 and r initi+1= (r f inali+|Ki|).

anonymous node: Each non leader nodevimaintains the following local variables:evi← 1 representing the initial energy charge of vi,rcvvi← ∅ is a set variable wherevistores all the messages received during each round.

for each roundr:

– Send phase of roundr: at the beginning of each round, vibroadcasts aENERGY RELEASE(evi2D) message, releasing at most half of its energy to its neighbors (at mostD).

– Receive and Computation phases of roundr:

switch

case(∃ m =STOP(count)∈ rcvvi)

vibroadcastsSTOP(count) for count rounds, then vistops to execute the algorithm and outputs the valuecount.

case(∃ m =RE-START(r0)∈ rcvvi)

vibroadcastsRE-START(r0) until the current round is r0and thenviinitializes all local variables.

default %rcvvicontains onlyENERGY RELEASE(e0) messages % viupdates its local energy charge as follows:

evi← evi− released + recharged + received =

where the energy released is given by the the quantity of energy sent to its current neighbors (i.e.(D×evi2D)), the energy recharged is the amount of energy not effectively released due a possible neighborhood over estimation (that, in the current round, is smaller thanD) and computed by considering the difference between the estimated number of neighborsD and the effective ones|rcvi| (i.e. (D − |rcvvi|) ×evi2D). Thus,

evi← evi− D ×evi

2D + (D − |rcvvi|) ×evi

2D+ X

e0 ∈rcvvi

e0

(6)

v l v 1

e 1 e

1

2D

v l

v 1

e1

e1

2D

v 2 Set of nodes with non

zero energy

e1

(2D)2

v 3

v l

v 1 v 2

Set of nodes with non zero energy

v |V | 1

e1

(2D)|V | 2 e1

(2D)|V | 1

Fig. 2: Lower bound on the energy received by the leader from a single node

Figure 1 shows the execution of a generic round r at node v

i

with initial energy 1 where D = 5 and the number of v

i

neighbors is 3.

Correctness Proofs. In the following, we will prove that protocol A

D

is correct. We first prove in Lemma 1 the existence of the following invariant: the global energy stored in the system is preserved (i.e. the sum of all the energy variables e

vi

at each v

i

∈ V remain constant). Note that, this is a fundamental property to ensure the correctness of the guess computed and returned by the leader. Then, in Lemma 2, we derive a lower bound on the energy that the leader will receive during the computation. Finally, in Lemma 3, we prove the terminating condition that the leader has to verify in order to check if the bound matches the network size. From these results Theorem 1 naturally follows. In the following, we use the notation e

rvi

to indicates the quantity of energy stored at round r in v

i

∈ V .

Lemma 1. (Invariant - Energy Conservation) At the end of each round, the sum of the energy over all the nodes of the anonymous dynamic network is an invariant and it is equal to the total energy present in the system at the beginning of the computation.

Proof. Let us notice that energy is created only during the initialization phase and then it is only transferred. Thus, in the following, we will prove that energy is never lost. For ease of presentation, in the prove we refer only to the energy e

rvi

stored at non-leader nodes (i.e. v

V \ {v

l

}) as v

l

does not send energy. At the beginning of each round r, every v

i

sends

e

r vi

2D

energy to the set of its neighbors (i.e. the released energy is D ×

e

r vi

2D

). However, v

i

does not know the exact number of current neighbors N

vi

(r) but it just know an upper bound on them. Thus, while sending the energy, due to a possible over estimation of its neighborhood, v

i

may transfer more energy that the one will never received by other processes (loss of energy of (D − |N

vi

(r) |) ×

e2Dvi

). However, v

i

will know the exact number of neighbors by counting the number of received messages in the current round ( |N

vi

(r) | = |rcv

vi

|) and it will compensate the extra energy released.

Thus, v

i

will have a remaining energy of

e

r vi

2

+ e

rvD−|N2Dvi(r)|

. The energy initially possessed by v

i

was e

rvi

, at the end of r the sum of energy over nodes in N

vi

(r) ∪ {v

i

} is e

rvi

. Iterating this reasoning over all nodes we have that the conservation of energy is not violated.

2

Lemma 1

Lemma 2. Let G(r) = (V, E(r)) be a dynamic anonymous graph, let K be an upper bound on the network size and let R ∈ N

+

. Given the algorithm A

D

, at the end of round r

RK

, the energy stored at the leader is at least e

RKvl

≥ (1 − (

BB−1

)

R

) |V |, where B = (2D)

K

.

Proof. Let us first compute the energy that a single node v

i

provides to the leader v

l

when it is the only one releasing energy (i.e. v

i

has an energy charge of e

vi

= 1 while all the other non-leader nodes v

j

has no energy and e

vi

= 0).

At round 0, v

i

transfers e =

2D1

to each of its neighbors. Due to 1-interval connectivity, v

i

has at least one neighbor v

j

that will receive such energy charge and will update its residual energy to e

0vj

2D1

. As a consequence, an additional node (i.e. v

j

) will have a quantity of energy greater than 0, no matter of the adversary move.

At round 1, due to the adversary action, v

i

and v

j

may change their neighbors and a node v

k

, with no energy,

may become neighbor of v

j

. Due to the rules of the algorithm, v

j

will transfer to v

k

a quantity of energy at least

e

j

(2D)e

(2D)1 2

. Let us notice that the such quantity is a lower bound on the energy that an empty node may

receive after 2 rounds.

(7)

Iterating the reasoning, it is possible to define the lower bound on the energy that the leader v

l

received from v

i

after

|V |−1 rounds in case v

i

is the only one releasing energy, i.e. e

|V |−1vl

(2D)1|V |

. Considering the individual contribution of each node in V , we obtain e

|V |−1vl

(2D)|V ||V |

. However, node contributions interfere and the real quantity of energy that each of them transfers to the leader at each round is greater than the computed one; thus the formula above represents a lower bound on the energy transferred from all nodes to the leader after |V | − 1 rounds.

Due to Lemma 1, e

|V |−1vl

+ P

vi∈V \{vl}

e

|V |−1vi

= |V |, this implies that after |V | − 1 rounds, the energy not stored at the leader is, at most, |V | − e

|V |−1vl

.

Using the same argument, after 2( |V | − 1) rounds the lower bound on the energy that the leader stores is e

2(|V |−1)vl

|V |−e

|V |−1 vl

(2D)|V|

+ e

|V |−1vl

. We can use the same argument even if the distribution of energy at round r = |V | is different from the uniform initial distribution, the basic idea is to consider the contribution that each node has to send to the leader independently, then summing up these contribution we will end up with the same bound.After R( |V | − 1) rounds, the energy at the leader is at least e

R(vl|V |−1)

|V |−e

(R−1)(|V |−1) vl

(2D)|V |

+ e

(R−1)(|V |−1)

vl

that is a recurrence equation with boundary condition e

0vl

= 0.

Solving the equation we obtain: e

R(|V |−1)vl

≥ |V | × (1 − (

b−1b

)

R

) where b = (2D)

|V |

, that is a lower bound on the energy of the leader after R × (|V | − 1) rounds. Let us recall that K ≥ |V |, thus we can compute a lower bound for the energy in the leader after RK rounds on a network of size |V |, with B = (2D)

K

since

|a|b

|a|B

the following inequality holds:

e

Rvl|V |

≥ |V | × 1 −

 (2D)

|V |

− 1 (2D)

|V |



R

!

2

Lemma 2

Lemma 3. Let G(r) = (V, E(r)) be a dynamic anonymous graph, let K

i

be an upper bound on the network size.

Given the algorithm A

D

, at the end of each iteration i, the leader can either accept or reject the hypothesis |V | = K

i

. Proof. Let us note that the algorithm outputs the exact count when the upper bound K

i

is equal to the real network size |V |. Initially, K

i

is set by running the algorithm in [16] that has been proved to provide an upper bound on the network size (i.e. K

0

≥ |V |). The leader can compute the difference ∆

r

as follows

r

= K

i

− e

rvl

≥ K

i

− 1 −

 B − 1 B



R

! K

i

that is the difference, at round r = RK

i

, between the total energy stored in a network of size |V | = K

i

and the lower bound on the minimum amount of energy that the leader has to receive after r rounds if |V | = K

i

(as computed in Lemma 2).

According to the algorithm, the leader computes the minimum R

0

∈ N

+

such that r f inal

i

= R

0

K

i

satisfies

r f inali

< 1. At round r f inal

i

two cases are possible:

1. The energy accumulated in the leader e

r f inalvl i

is less or equal than K

i

− 1: in this case, we have necessary that

|V | < K

i

. By construction, in fact, R

0

is selected in such a way that the quantity ∆

r f inali

< 1; thus, if the real network size is K

i

, the leader must collect e

r f inalvl i

> K

i

−1. On the contrary, the only possibility is that |V | < K

i

since in this case the quantity of energy in V will not allow the leader to reach a value e

r f inalvl i

= K

i

− 1 +  with

 > 0.

2. The energy accumulated in the leader e

r f inalvl i

= K

i

− 1 +  (with  > 0): this implies that there are at least K

i

nodes in V . Considering that K

i

is an upper bound we have that necessary |V | = K

i

.

2

Lemma 3

Theorem 1. Let G(r) = (V, E(r)) be a dynamic anonymous graph and let K

0

be an upper bound on the network

size. If the adversary is a dynamic graph adversary with bounded degree and any process v

i

∈ V knows the upper

bound D on the number of neighbors, then the algorithm A

D

satisfies the consciousness and convergence properties

(8)

Proof. Let us first prove the convergence property. A

D

, during the Step 1, computes an upper bound K

0

on the size of the network (i.e. K

0

≥ |V |) and then it moves to Step 2 starting a sequence of iteration I = {i

0

, ..., i

f inal

}, each one taking as input an upper bound K

ix

. According to Lemma 3, at the end of an iteration i

x

, the leader checks the terminating condition, evaluates the hypothesis K

ix

= |V | and in case of rejection, it decreases by one the upper bound considered in the following iteration. Considering that (i) K

0

is an upper bound on the real network size and (ii) every iteration i

x+1

starts with a new upper bound K

ix+1

= K

ix

− 1 it follows that, in a finite number of iterations, A

D

will evaluate the real size of the network accepting the hypothesis K

i

= |V |.

The consciousness is also ensured by Lemma 3, considering that when the leader accepts the hypothesis K

i

= |V | starts to disseminate a

STOP

message letting the algorithm terminate at each node.

2

T heorem 1

4.1 Complexity and Discussion

Theorem 2. Let G(r) = (V, E(r)) be a dynamic anonymous graph and let K

0

be an upper bound on the network size. If the adversary is a dynamic graph adversary with bounded degree and any process v

i

∈ V knows the upper bound D on the number of neighbors, then the algorithm A

D

outputs the correct size of the network after at most O(e

K20

K

02

(K

0

− 1)) rounds.

Proof. The claim follows from Lemma 2 and Lemma 3 by considering that each iteration i of the algorithm lasts

R

(K

i

) × K

i

, where ∆

R

(K

i

) is the number of K

i

− 1 rounds that the algorithm has to execute in order to check the hypothesis |V | = K

i

(cfr. Lemma 3). Moreover, we have that the maximum number of iterations is K

0

(i.e., the worst case obtained starting from evaluating the hypothesis on the size |V | = K

0

when the real size is |V | = 1). ∆

R

(K

i

) can be computed by solving ∆

r f inali

< 1 inequality obtaining:

R

(K

i

) ≥

&

log(

K1

i

) log(

B−1B

)

' + 1

where B = (2D)

Ki

.

Let us notice that, in the worst case, D = K

i

, so we have ∆

R

(K

i

) = Θ



log 1 Ki

 log

(

1−Ki−Ki

)



. Since the limit lim

Ki→+∞



R(Ki) eK2i

 =

0 we have that the number of rounds for each iteration is O 

e

Ki2

(K

i

− 1) 

this seamlessly leads to the theorem.

2

T heorem 2

The complexity aforementioned is a direct consequence of the energy release mechanism where each non leader node transfers half of its energy at each round. Let us suppose to modify the algorithm in such a way that each node sends the whole energy to its neighbors. In this case the problem became equivalent to token circulation, the trivial example is a chain {v

1

, v

2

, ..., v

n

}, that is transformed at odd rounds in v

2

, v

1

, ..., v

n

and in even rounds as v

1

, v

2

, ..., v

n

, this dynamic adversary will prevent the initial energy present in v

1

to reach other nodes apart v

2

. On the contrary halving the energy allow us to obtain the bound on energy dissemination (See Lemma 2). Let us remark that changing the quantity of energy sent by nodes (i.e. sending a fraction different from

12

) does not change the complexity from being exponential since the termination round is only influenced by a multiplicative factor.

5 Unconscious Counting resilient to a Dynamic Graph Adversary

This section shows that the impossibility of designing a counting algorithm without any network knowledge assump- tion (i.e., impossibility of designing a counting resilient to a dynamic graph adversary) presented in [16] does not hold if if we consider unconscious counting algorithms. To prove such claim, we will propose an algorithm, namely A

N oK

, that is able to eventually count the number of processes in the dynamic anonymous network without having any assumption on the network. A

N oK

is actually a modification of the algorithm presented in Section 4 where nodes have to cope with the uncertainty about the number of neighbors (and thus, with the uncertainty about the energy they have to release in each round).

A

N oK

works in the following way: each non-leader node v

i

starts, at round r

0

, with energy quantity e

vi

← 1 and

(9)

it transfers half of its current energy to the neighbors. However, v

i

has no knowledge about the network and thus it cannot know the exact number of neighbors at round r before receiving messages, but it can only guess such number.

Thus, v

i

supposes to have D

max

neighbors and it broadcasts a quantity of energy

2D1

max

(as if there are really D

max

neighbors). Then v

i

starts to collect messages transmitted by its neighbors at the beginning of the round and it stores such messages in a local variable rcv

vi

. At the end of the round, v

i

updates its energy, as in the previous algorithm, to preserve the quantity of energy over all the network.

Notice that, if the real number of neighbors at round r is lower than the estimation (i.e., |rcv

vi

| ≤ D

max

) then the global energy conserved among all the processes is still constant (this is due to the compensation done by v

i

at the end of the round, based on the effective number of received messages). On the contrary, if the number of neighbors is greater than the estimation (i.e., |rcv

vi

| > D

max

) then, there is the release of a local surplus of energy. As an example, consider the case where v

i

has energy e

vi

the estimation of neighbors is D

max

= 2 and the real number of neighbors is |rcv

vi

| = 8. When v

i

sends

e4vi

to each neighbors, the total amount of energy transferred is twice the energy stored by v

i

(i.e., the energy transferred is 8 ×

e4vi

= 2e

vi

while node v

i

had only e

vi

residual energy). However, since v

i

adjusts its local residual energy considering the number of received messages |rcv

vi

|, it follows that its residual energy will become negative and globally the energy is still preserved. Considering the previous example at the end of the round v

i

stores a residual energy −e

vi

.

Unfortunately, the local surplus of positive/negative energy could create, in the leader, a temporary value of energy e

vl

that is greater than |V | or negative. Moreover, the adversary could change, at each round, the degree of nodes in order to avoid the convergence of the leader. To overcome these issues each processes stores locally the highest number of neighbors it has ever seen and it uses the double of such number as D

max

. In this way, the surplus of local negative/positive energy that the adversary can create is upper bounded by a function f ( |V |): each node v

i

can increase D

max

at most log( |V |) times, from 1 to |V |. This implies that the worst case adversary cannot create an infinite surplus of local energy. Thus, the adversary could delay the convergence of the count only a finite number of rounds.

AlgorithmAN oK– Unconscious Counting resilient to a Dynamic Graph Adversary.

leader : The leadervlmaintains the following local variables: (i)evl← 1 representing the initial energy charge and (ii) rcvvl← ∅ is a set variable where vl

stores all the messages received during each round. (iii)countvl← 0 this variable is used to keep trace of the latest estimated count.

for each roundr:

– Send phase of roundr: at the beginning of each round, vlbroadcasts aENERGY RELEASE(0) message releasing no energy.

vlbroadcastsCOUNT(devle, r).

– Receive and Computation phases of roundr:ENERGY RELEASE(e0) messages are stored in the rcvvlvariable. At the end of the round, when all the messages have been received,vlupdates, its local energy charge as follows:

evl← evl+ X

e0 ∈rcvvl

e0

vlsetscountvl← devle

anonymous node: Each non leader nodevimaintains the following local variables: (i)evi← 1 representing the initial energy charge of vi, (ii)rcvvi← ∅ is a set variable wherevistores all the messages received during each round and (iii)Dmax← 1 is an integer variable storing the maximum number of neighbor vihas ever had (initially set to1 as it has no knowledge about the network). (iv) countvi ← 0 this variable is used to keep trace of the latest count estimate seen by the node (v)r countvi ← 0 is the round number associated with the latest count accepted.

for each roundr:

– Send phase of roundr: at the beginning of each round, vibroadcasts aENERGY RELEASE(2Dmaxevi ) message, releasing at most half of its energy to its neighbors.

– Receive and Computation phases of roundr:

for each messagem∈ rcvvisuch thatm is anENERGY RELEASEmessage,viupdates its local energy charge as in the previous algorithm:

evi ← evi− Dmax× evi 2Dmax

 + (Dmax− |rcvvi|) × evi 2Dmax

+ X

e0 ∈rcvvi

e0

In addition, if|rcvvi| > Dmax,vialso updates the maximum number of neighbors it has ever saw by settingDmax← 2|rcvvi|.

for each messagem∈ rcvvisuch thatm is anCOUNTmessage, if the round number inm is greater than r countviupdatescountviandr countvi with the content ofm.

Correctness Proofs. In the following, we will prove that protocol A

N oK

converges to the exact count in a finite

number of rounds. We first prove that the quantitive of negative energy that the dynamic adversary is able to create

(10)

is bounded by a function of the network size |V | (Lemma 4 ). From this result, we prove that the leader will obtain the correct count in a finite but unknown number of rounds (Lemma 6), so we will prove that A

N oK

respects the convergence property, but not the consciousness. Let us notice that since the energy transfer mechanism is the same of A

D

the global invariant on energy still holds, so Lemma 1 keeps holding for A

N oK

too. Moreover, it is clear that for each round r the leader will receive energy from its neighbors. So, even if it is not possible to have a bound like the one obtained in Lemma 2, it is straightforward to see that the absolute value of the sum of energy that the leader receives is a monotonically increasing function.

Lemma 4. Let G(r) = (V, E(r)) be a dynamic anonymous graph. During any execution of A

N oK

, the amount of negative energy that can be generated is finite. Moreover, during any round r a single node v

i

∈ V with energy e

rvi

can create at most ( |V | − 2)e

rvi

negative energy.

Proof. Let us focus on the negative energy that can be generated during the execution of the algorithm by a generic node v

i

∈ V . Let E

n

: {r

i,1

, r

i,2

, ...., r

i,t

} be the set of rounds (not necessarily consecutive) in which v

i

creates negative energy; we will show that the number t is finite. For the generic round r

i,j

∈ E

n

we must have that |rcv

vi

| >

2D

max

; this follows by imposing

e2

+ ( |rcv

vi

| − D

max

)

e2

< 0. This means that we have at least |rcv

i

| ≥ 2D

max

+ 1, and at the end of round r

i,j

the number D

max

will be doubled. Since |rcv

i

| ≤ |V | and D

max

≥ 1, we have that the condition |rcv

i

| > 2D

max

could happen at most log( |V |) times. So, t ≤ O(log(|V |)). Moreover, the negative energy created by a node v

i

with energy e during a single round is at most ( |rcv

vi

|−2D

max

)e that is maximized when

|rcv

vi

| = |V | and D

max

= 1. 2

Lemma 4

Lemma 5. Let G(r) = (V, E(r)) be a dynamic anonymous graph. During any execution of A

N oK

, for any  ∈ R

+

there exists a round r

|V,|

after which the amount of negative energy that could be transferred to the leader in the following rounds is less than .

Proof. Due to the invariant on energy (Lemma 1), we have that the negative energy that each node could create is related to the energy that the nodes already possess (since the sum of negative and positive energy has to be equal zero). In addition, for Lemma 1 and for the monotonically increasing energy received by the leader, we have that, if no negative energy is created, the absolute value of energy in V \ {v

l

} is a monotonically decreasing function of r. The maximum amount of negative energy that can be created starting from round r is bounded (see lemma 4) and from the previous consideration it is a monotonic function f of P

∀v∈V \{vl}

|e

rv

|. From Lemma 2 we have that ∀

1

∈ R

+

∃r

1

∈ N

+

| P

∀v∈V \{vl}

|e

rv1

| ≤ 

1

, since f is monotonic exists 

1

such that f (

1

) ≤ . 2

Lemma 5

Lemma 6. Let G(r) = (V, E(r)) be a dynamic anonymous graph and let us consider an execution of A

N oK

. Then,

∀v

i

lim

r→∞

count

vi

= |V |. So A

N oK

is a counting algorithm that respects the convergence property.

Proof. Lemma 5 shows that there exists a round r

|V,|

after which the maximal amount of negative energy that can be created in the network is bounded by a quantity  that can be made arbitrarily small. For energy conservation Lemma, this means that the total amount of negative and positive energy in V \ {v

l

} is bounded at each round by a monotonically decreasing function of the round number. So lim

r→∞

( |V | − e

rvl

) = 0, this means that there exists a round r such that ∀r

0

≥ r holds |V | − e

rv0l

< 1. So the variable count

vl

will be equals to |V | ∀r

0

≥ r. This means that

A

N oK

respects the convergence property. 2

Lemma 6

The previous Lemma has an interesting implication: there exists a round r such that ∀r

0

≥ r holds |V | − e

rv0l

< 1.

However, this condition is not detectable by any node in the network. As a consequence, A

N oK

respects convergence property but not conscious property. Unconscious algorithms can be used in any practical context where the safety of the application does not depend by a correct count and where liveness and/or fairness need just an eventually correct count (e.g. fair load balancing). In a companion paper [15], we show a performance evaluation of A

N oK

and we propose an heuristics to let A

N oK

terminate together with the comparison between the basic A

N oK

and the heuristic- based one.

Energy vs Mass Conservation. Our idea of energy transfer and the principle of energy conservation is similar to the

one used in [13] where a global invariant called conservation of mass is used and a push-only mechanism is employed

to implement a gossip-based protocol for aggregation. Despite the similarities in the principle, the underling graph

(11)

considered in [13] is obtained trough a sampling function while our model is governed by a worst case adversary (as discussed in Section 2). Moreover, Kempe et Al. assume that each node knows in advance the number of neighbors for the message-exchange while in our model this is not possible. As a consequence, they obtain probabilistic bounds on the convergence time and each node of the system converges to the average of the inputs value while in our algorithm the leader always absorbs energy converging to the correct count and the other nodes converge to zero.

6 Conclusion

We presented a distributed (deterministic) algorithm that assumes the existence of a unique leader node in order to precisely count the number of nodes of the network. The leader node executes a different code from the rest of the nodes and acts as a sink for the energy transfer. This algorithm is resilient to an adversary that can change the communication graph at any round with the constraint of not creating disconnected graphs or graphs including nodes with a degree that exceed a given bound.

Secondly, we have shown that the conjecture presented in [16] stating that “in dynamic networks ensuring 1- interval connectivity we cannot count even with a leader” is still valid but only if the count is conscious. We have indeed presented an algorithm that is able to unconsciously count the size of the network. Thus the conjecture can be reworded as follows “in dynamic networks ensuring 1-interval connectivity we cannot count consciously even with a leader”. This leaves open an interesting problem concerning the existence of a conscious counting algorithm resilient to a dynamic graph adversary only constrained to ensure 1-interval connectivity.

Let us finally remark that our algorithms work in a ever changing dynamic graph. This continuous dynamic be- havior is similar to the churn analyzed in [6] for building regular registers. We believe that these forms of dynamic behaviors are the natural way to think about dynamic distributed systems with respect to distributed systems whose form of dynamic behavior eventually stabilizes such as [1,10].

References

1. M. K. Aguilera, I. Keidar, D. Malkhi, and A. Shraer. Dynamic atomic storage without consensus. J. ACM, 58(2):7, 2011.

2. D. Angluin. Local and global properties in networks of processors (extended abstract). In STOC, pages 82–93. ACM, 1980.

3. J. Aspnes, F. E. Fich, and E. Ruppert. Relationships between broadcast and shared memory in reliable anonymous distributed systems. Distrib. Comput., 18(3):209–219, February 2006.

4. H. Attiya, M. Snir, and M. K. Warmuth. Computing on an anonymous ring. J. ACM, 35(4):845–875, October 1988.

5. R. Baldoni, M. Bertier, M. Raynal, and S. Tucci Piergiovanni. Looking for a definition of dynamic distributed systems. In PaCT, pages 1–14, 2007.

6. R. Baldoni, S. Bonomi, and M. Raynal. Implementing a Regular Register in an Eventually Synchronous Distributed System Prone to Continuous Churn. IEEE Transaction on Parallel Distributed Systems, 23(1):102–109, 1 2012.

7. P. Boldi and S. Vigna. Computing anonymously with arbitrary knowledge. In PODC, pages 181–188. ACM, 1999.

8. A. Casteigts, P. Flocchini, W. Quattrociocchi, and N. Santoro. Time-varying graphs and dynamic networks. CoRR, abs/1012.0009, 2010.

9. J. Chalopin, Y. M´etivier, and T. Morsellino. On snapshots and stable properties detection in anonymous fully distributed systems (extended abstract). In SIROCCO, volume 7355, pages 207–218. Springer, 2012.

10. G. Chockler, S. Gilbert, V. Gramoli, P. M. Musial, and A. A. Shvartsman. Reconfigurable distributed storage for dynamic networks. J. Parallel Distrib. Comput., 69(1):100–116, 2009.

11. P. Fraigniaud, A. Pelc, D. Peleg, and S. P´erennes. Assigning labels in unknown anonymous networks. In PODC, pages 101–111. ACM, 2000.

12. M. Jelasity, A. Montresor, and ¨ O. Babaoglu. Gossip-based aggregation in large dynamic networks. ACM Trans. Comput. Syst., 23(3):219–252, 2005.

13. D. Kempe, A. Dobra, and J. Gehrke. Gossip-based computation of aggregate information. In FOCS, pages 482–491, 2003.

14. F. Kuhn, N. Lynch, and R. Oshman. Distributed computation in dynamic networks. In STOC, 2010, pages 513–522, New York, NY, USA, 2010. ACM.

15. G. Di Luna, S. Bonomi, I. Chatzigiannakis, and R. Baldoni. Counting in Anonymous Dynamic Networks: An Experimental Perspective. In ALGOSENSORS (to appear), 2013, http://www.dis.uniroma1.it/˜midlab/articoli/main_

2.pdf.

16. O. Michail, I. Chatzigiannakis, and P. G. Spirakis. Naming and counting in anonymous unknown dynamic networks. In (to

appear) 15th International Symposium on Stabilization, Safety, and Security of Distributed Systems, 2013.

(12)

17. R. O’Dell and R. Wattenhofer. Information dissemination in highly dynamic graphs. In DIALM-POMC, pages 104–110, New York, NY, USA, 2005. ACM.

18. M. Yamashita and T. Kameda. Computing on an anonymous network. In PODC, pages 117–130, New York, NY, USA, 1988.

ACM.

Riferimenti

Documenti correlati

For a real number x whose fractional part is not 1/2, let hxi denote the nearest integer

[r]

(American Mathematical Monthly, Vol.118, November 2011) Proposed by Harm Derksen and Jeffrey Lagarias (USA).. The Farey series of order n is the set of reduced rational fractions j/k

[r]

[r]

As an application, we prove tightness under diffusive rescaling for general pinning and wetting models based on random

o-regular functions from a topological space S to a finite directed Graph G (see Background we go on (see [3J,[4J and [5])with the stu- dy of normalization theorems for

Then we have studied the abundance gradients along the Galactic disk produced by our best cosmological model and their dependence upon several parameters: a threshold in the surface