• Aucun résultat trouvé

Section 4.1 defined “worrying” to describe the situation when a device sees an advertisement in which one or more of its services is absent or scheduled to expire in less than a given time, and Equation 4.7 was presented as a way to predict the time between instances of devices worrying.

Now we address the question of what happens when a worrying situation arises.

When a device worries, it chooses its next scheduled broadcast-time from an earlier range than usual. It makes analysis easier if there is no overlap between the usual range ï , and the shorter rangeïëð, so let’s go with that assumption for now. Assume also, for now, that no packets are lost.

Under these assumptions, even if a device worries only one round before its services ex-pire, no unusual behaviour will be exhibited, except for one shorter-than-usual broadcast round.

Consider the case where ï ÂòñóĈô,õ Äö÷, ïëð°Âøñúùûõ Ä ô3É , and ٠¥ö devices. Assume that, from the way an entry from ï is chosen, the usual lowest choice ï ê is twelve. The system contin-ues with devices broadcasting every twelve seconds or so, until deviceü receives a broadcast showing its services will expire in fifteen seconds. ü worries, and chooses its next broadcast time from ï ð; this time it chooses nine seconds. At the same time thatü chose that timeout, the other four devices also choose their next broadcast times (since they are synchronised by

4.4. WHEN DEVICES WORRY 45 the receipt of the same broadcast), but those times are all chosen from the intervalñýĈôûõ Ĉö÷. Nat-urally, nine seconds later, ü wins the broadcast race; all five devices then synchronise on the new broadcast, and schedule their next broadcast for ten to fifteen seconds in the future. An observer would have to be paying very close attention to see anything unusual in the observable behaviour caused by this whole process.

If, as in the above situation, devices begin to worry only one round before their services expire, and two devices begin worrying as a result of the same broadcast packet, only one will renew its services in time. But how often will this happen? If steady state has been continuous for more thané rounds, then each device has had at least one broadcast separated ï ê from any other broadcast. Remember, we are still considering only a loss-free network, and uniform assignment of configuration parameters among the devices so, for one round of worrying to be insufficient, two devices would both have to lose the sameé rounds in a row, after broadcasting consecutively, separated by less time than the most recent winning timeout value (causing them to begin worrying as a result of receiving the same broadcast packet.)

Although we are assuming that all rounds are the same duration, there is of course some variation in the exact time between broadcasts, with some rounds being slightly longer than others. This is relevant because, for two devices to worry as a result of receiving the same packet, their expiry times must have both crossed their worry threshold in the time since the previous packet was sent. Therefore, the gap between their renewals (some é rounds earlier) must have been less than the gap between the current broadcast and the previous. This condition may come about due to a previous case of worry, or just due to the nature of random number selection, but there is enough randomness in the whole process that it is reasonable to say that it’s about an even chance whether any particular gap between transmissions is longer or shorter than any particular preceding gap. This gives us the factor of

¾

in Equation 4.8.

The only other thing that must occur, given the correct timing, is for the winners of the race

é rounds and éËþ¹Ä rounds in the past to be different, and for these particular two devices both to have lost the previousé rounds. Because we are starting from steady state, and devices are uniformly configured, this is Ï Õ¶Ï (the chance that they are different) times the number of ways to choose é winners fromÙ Æÿ devices divided by the number of ways to choose é winners fromÙ devices.

Putting this all together gives us the following:

Consider again the example from the end of Section 4.1, in which five devices were present, andé was set at 14, meaning that more than a hundred rounds of steady-state would be expected to pass before any device worried. The probability of this worrying actually causing any sig-nificant effect is, by Expression 4.8, È

É

È

É

or 0.03%. This result means that, even given the necessary conditions for trouble, there is less than one chance in 3190 that anything bad will result.

In the current example, the smallest advertisement interval ever chosen is eight seconds, and the largest is fifteen. Since this means that three advertisements can never have happened in an interval shorter than any single advertisement interval, a maximum of two devices could ever be caused to worry as the result of a single broadcast. (Again ignoring the possibility of two preexisting groups merging very quickly. This and other unusual events will be discussed later.) To incorporate the earlier timing estimates into the probability of having two devices begin to worry on the same round, we have now seen enough to begin with the claim that it is a rare event. Because it is rare, we need not consider the feedback problems encountered with Equation 4.6. Furthermore, if one device is going to worry on a given round, then we know it did not broadcast on any of theé rounds leading up to that round. Therefore, the probability of a second device having lost the sameé fair races is actually lower than the probability of a device losing an arbitrary é fair races. This observation, considered implicitly in the formation of Expression 4.8, would lead to an expected probability of two devices worrying on any particular round to be given by the following:

 á Äÿ ã á Ù

Calculating a value for Equation 4.9 with our ongoing example of five devices gives about a

ô ®

ôûÄ chance (per round) of any particular device remaining worried for more than one round if é is ten. Furthermore, recall that a round of worrying is shorter than a normal round, so configuring worry to start, in this case, sixteen seconds before expiry would give the device a second chance to broadcast before expiring.