• Aucun résultat trouvé

Considering the total system

Now that every term is multiplied by the length of the string that it represents, all we need to do is substitute the probability of winning forÀ , and the probability of losing for Á . Obviously, the probability of losing is one minus the probability of winning, so substituteÁÃÂÅÄ Æ‘À into Equation 4.5: By solving Equation 4.6 forÀFÂ Ï , we can now see that, in a steady-state environment with

Ù devices, an individual device would expect to worry about once every Ï

½•Ú8Û

4.3 Considering the total system

Unfortunately, when a device worries, it causes the next round not to be a fair race. By picking a timeout from the lower range, all devices that are not already worried are guaranteed (by our current assumptions) to lose the next race. If the value predicted by Equation 4.6 is large, then this effect will just be noise, and should not really cause any trouble. If worrying is a relatively frequent occurrence, however, the unfair races must be accounted for in calculating the expected duration of steady-state.

To deal with this feedback problem, assume the probabilityÀ of a particular device winning a given race is known. Equation 4.6 can be used to turn this into an expected number of rounds,

ÇÝÈ

ÀÊÉ . By invertingÇÈ ÀÊÉ , we get the probability of worrying on any given round. Therefore, the probability of Ù devices all not worrying on a particular round is È Ä9Æ ÇÝÈ ÀÊÉ Õ¶ É Ï Õ¶ . The exponent isÙ ÆbÄ , rather thanÙ , because we are analysing the duration steady state, so we know that at least one device (the one for which the steady state is being analysed) must not be in a state of worry (from the definition of steady state).

The probability of a particular device winning a fair race isÙ Õ¶. The probability of a partic-ular round being fair, given that at least one device (the one we are considering) is not currently worrying, is È ÄËÆ ÇÝÈÀÊÉ Õ¶ É Ï Õ¶. By combining these two probabilities, we find the probability of

1

Safe Number of Missed Rounds (b) System Stability In A Loss-Free Environment

n=2 3 4 6 8 10

Figure 4.1: Corrected and uncorrected expected steady-state duration (on the logarithmic y-axis) against the number of consecutive rounds for which an individual station can fail to send a renewal advertisement without affecting its choice of broadcast timeout (ß , on the x-axis) for two through ten devices (à ). In each pair, the lower curve has used Equation 4.7 to get a more accurate result.

a particular device winning a given round is given by Equation 4.7.

ÀFÂâá

General solutions to Equation 4.7, givingÀ in terms of é andÙ , are difficult to write down, let alone work with, so a little function (Appendix B) was written to approximate its solution using Newton’s method. LetÀê represent the value ofÀ that satisfies Equation 4.7.

Substituting the solutions to Equation 4.7 back into Equation 4.6 gives a realistic expected duration for steady-state, given values for é andÙ . Naturally, asé gets large, Equation 4.6 gets large, and Equation 4.7 approachesÀëÂê Ï . That is to say that as devices worry less frequently, they cause fewer unfair races, so assuming all races to be fair is increasingly valid for larger values ofé . This convergence is shown in Figure 4.1, which plotsÇÝÈ Ï É and the correctedÇÝÈÀìÉê .

4.3. CONSIDERING THE TOTAL SYSTEM 43

10 100 1000

2 4 6 8 10 12 14

Expected Rounds Between Panics

í

Number of Devices

Rounds Between Panics for b=10, 11, 12

Predicted (b=10) Predicted (b=11) Predicted (b=11) Simulation (b=10) Simulation (b=11) Simulation (b=12)

Figure 4.2: Comparing the results predicted in Equation 4.7 with the observed behaviour of a discrete event simulation.

Equation 4.7 now allows an “ideal timeout” (one that will allow steady-state to be main-tained during almost all of any given execution time) to be calculated. A system-designer can choose the largest number of devices expected to be joined into one group, define what a long time is, and work backwards to find a suitable choice for é . For example, if groups are not expected usually to involve more than five members, and would like steady-state to last at least a hundred rounds between incidences of worrying, Figure 4.1 shows thatéÂ}Ä î would be suf-ficient. In fact if, in the case stated above, the expiry time is set to allow fourteen rounds of non-renewal to pass before devices start to worry, devices can expect to go some 122 rounds between instances of worry.

Figure 4.2 shows predicted values against the values observed in a discrete event simulation.

The predicted curve is a good approximation of the observed behaviour until the number of devices gets close toé . This is to be expected, since this situation will mean that some device is always worrying, meaning that there is a chance of a device choosing a short timeout, but still

not winning the next race. Simulated behaviour will be discussed in more detail in Chapter 5.

This result is both good and bad. On the good side, it allows us to study the behaviour of the system under the assumption that a steady-state can exist, and occurrences like lost packets and the arrival of a new device can be treated as perturbances of that steady-state. On the not-so-good side, the above example showed that for five devices to maintain steady-state more or less indefinitely under ideal conditions will require timeouts on the order of twenty rounds.

That means that the time to notice the absence of a device is about twenty times longer than the time to notice its presence. For such a small example-system, better performance should be expected.

Happily, this is not the end of the story. Causing a device to worry and send a message earlier than usual is not so bad. Yes, if this is a frequent occurrence, the average offered network load will be slightly higher, but is that bad? Section 4.4 addresses that question.