Peer to Peer Networks Lecture notes – 1 Introduction and Motivation: A client who wants to receive data from a server connects to the internet network through LANs and routers. The data transfer is done using packets in a store and forward manner; each node becomes as a collection of queues. Delays and waiting times are mentioned with respect to these queues. R R R R R R Different applications have different requirements on transfer time. For example VOIP applications need higher transfer rate as delays are more noticeable to the user. Assuming there were no queues on the path from client to server, data could’ve crossed the net at the speed of light (assuming no packet loss) - the delay is mostly in the routers’ queues. We’ll discuss those queues as part of Queueing Theory- it is applicable to packets queues as well as other queues. We’ll discuss different aspects of queues such as waiting time, number of waiting items, and the mean value of both. We’ll use stochastic models and random variables during our analysis. Stochastic Models inputs: The random variable has two parameters: (a) packet size/effort/service time, and (b) arrival time. Each may have different distribution parameters. The queue itself may have different behaviors/policies: LIFO, FIFO, Priority Queue etc. All these are inputs to the model. Packet size Arrival time Stochastic Models outputs: We’re interested in understanding the overall queue performance. Particularly we’re interested in delay, utilization and queues sizes. We’ll come to see these outputs are highly correlated. One of the tools we’ll use is generating functions. We’d like to transform the ‘distributed world’ to the ‘generating functions world’ since mathematical operations are easier to perform on generating functions. Then we’ll convert the result back and get the final output wanted. (*) generating functions can be found at Appendix I of the course book Queuing systems, Vol 1 By Kleinrock. Discrete Generating Functions: Giving a set of functions ๐0 , ๐1 , ๐2 … ๐๐ sequence ๐0 , ๐1 , ๐2 , … the generating function would be defined as: ∞ ๐น(๐) = ∑ ๐๐ โ ๐ ๐ ๐=0 This function is also known as Z-Transform. |๐๐ | ๐→∞ ๐ ๐ Note that ๐๐ has to converge in order for ๐น(๐) to be defined: for some a, lim →0 We use the term ‘match’ to describe the connection between the sequence function and its transform and use the notation: ๐น(๐) ⇔ ๐๐ . Examples for Discrete functions: Generationg functions examples: ๏ท Define ๐๐ = Pr[๐ ๐๐๐๐๐๐ก๐ ๐๐ ๐๐ข๐๐ข๐] ๐๐ = Pr[๐ ๐๐๐๐๐๐ก๐ ๐๐ ๐๐ข๐๐ข๐] (indexes are discrete). Note that ๐น(1) = ∑∞ ๐=0 ๐๐ . ๏จso when discussing distribution functions ๐น(1) = 1. But ๐๐ is a distribution sequence. Therefore ๐น(1) = 1 ๏ท 1 ๐๐ ๐ = 0 First we examine Un described as: ๐๐ = { 0 ๐๐กโ๐๐๐ค๐๐ ๐ it’s easy to see that the matching function would be ๐ญ(๐) = ๐. ๏ท 1 ๐๐ ๐ = ๐ Define a selective-function(sequence) ๐๐−๐ = { 0 ๐๐กโ๐๐๐ค๐๐ ๐ it’s easy to see that the matching function would be ๐ญ(๐) = ๐๐ ๏ท Define δ๐ to be δ๐ = 1 ๐๐๐ ๐๐ฃ๐๐๐ฆ ๐ ∈ ๐ต under some constraints on Z and using the geometric series equation we get: ∞ ๐ ๐น(๐) = ∑ 1 โ ๐ ๐ = ๐−๐ ๐=0 ๏ท Define ๐๐ = ๐ด โ ๐ผ ๐ - a function sequence with geometric factor ๐ผ ๐ results: ∞ ๐จ ๐น(๐) = ∑ ๐ด โ ๐ผ ๐ โ ๐ ๐ = ๐ − ๐ถ๐ ๐=0 Selected Z transforms -- OPERATORS: ๏ท Convolution: We say โ๐ is a convolution of ๐๐ and ๐๐ if โ๐ = ๐๐ โ ๐๐ define the convolution operator as: ๐ โ๐ = ๐๐ โ ๐๐ = ∑ ๐๐−๐ โ ๐๐ ๐=0 It’s interesting to see that the matching generating function is: ๐ป(๐) ∞ = ∑ โ๐ โ ๐ ๐ ๐=0 ∞ ๐ ∞ ๐ ∞ ๐ ∞ ๐ = ∑ ๐ ∑ ๐๐−๐ โ ๐๐ = ∑ ∑ ๐๐−๐ โ ๐๐ โ ๐ = ∑ ∑ ๐๐−๐ โ ๐๐ โ ๐ = ๐=0 ∞ ๐ ๐=0 ∞ ๐=0 ๐=0 ๐=0 ๐=๐ ∞ ∞ = ∑ ๐ ๐ ∑ ๐๐−๐ โ ๐๐ โ ๐ ๐−๐ = ∑ ๐ ๐ โ ๐๐ ∑ ๐๐−๐ โ ๐ ๐−๐ = ๐=0 ∞ ๐=๐ ๐=0 ∞ ๐=๐ = ∑ ๐ ๐ โ ๐๐ ∑ ๐๐ข โ ๐ ๐ข = ๐บ(๐) ⋅ ๐น(๐) ๐=0 ๐ข=0 Concluding convolution matches multiplication on the Z plane: ๐๐ โ ๐๐ ⇔ ๐ญ(๐) ⋅ ๐ฎ(๐) ๏ท ๐๐+1 matching function: ∞ ∞ ∞ ∞ ๐=0 ๐ข=1 1 1 1 ∑ ๐๐+1 โ ๐ = ∑ ๐๐+1 โ ๐ = ∑ ๐๐+1 โ ๐ ๐+1 = ∑ ๐๐ข โ ๐ ๐ข = (๐น(๐) − ๐0 ) ๐ ๐ ๐ ๐ ๐=0 ๐ ๐=0 ๐๐+๐ ⇔ ๐ (๐ญ(๐) − ๐๐ ) ๐ ๏ท Derivation match: ∞ ∞ ๐ ๐ญ(๐) 1 ๐−1 = ∑ ๐ โ ๐๐ โ ๐ = ∑ ๐ โ ๐๐ โ ๐ ๐ ๐ ๐ ๐ ๐=0 ๐=0 ∞ ๐๐น(๐) ⇒ ๐ = ∑ ๐ โ ๐๐ โ ๐ ๐ ๐๐ ๐=0 concluding that ๐ โ ๐๐ ⇔ ๐ โ note that when Z=1 result the sum: value when ๐๐ is a density function: ๏ท ๐ ๐ญ(๐) ๐ ๐ ๐๐น(๐) ๐๐ = ∑∞ ๐=0 ๐ โ ๐๐ which is similar to the mean ๐ฌ= ๐ ๐ญ(๐) | ๐ ๐ ๐=๐ Giving the last property By the calculation given in the last equation we can easily find the fn series sequence item by item: ๐ญ๐ = ๐๐ and ๐๐ = ๐ ๐ญ(๐) | ๐ ๐ ๐=๐ … or in general, ๐ ๐ ๐ ๐ญ(๐) ๐๐ = โ | ๐! ๐ ๐๐ ๐=๐ Discrete Inverse: Goal: Given ๐น(๐), how can we find ๐๐ ? Method I: Using line 18 of table I – the derivation property – we could find the elements one by ๐ one by the following formula: ๐๐ = ๐! โ complexity of high order derivation. ๐ ๐ ๐ญ(๐) | . ๐ ๐๐ ๐=๐ This method is less preferable due to the ๐(๐) Method II: Given ๐น(๐) = ๐ท(๐) presented as a polynomial quotient, we can present both polynomials as multiplication of simple polynomials of the form (1 − ๐ผ1 ๐)๐1 (1 − ๐ผ2 ๐)๐2 … ๐ด ๐ด Therefore we could get the quotient to the form: (1−๐ผ 1๐)๐1 + (1−๐ผ 2๐)๐2 + โฏ 1 1 Finally we can use the match from the table In most of our cases, we will use the following identity to find the original sequence : ๐จ โ ๐ถ๐ ⇔ ๐จ ๐ − ๐ถ๐ ๐จ The table actually also provides solution for the quadratic case as well(๐−๐ถ๐)๐. (*) full table of more interesting connections can be found in the course book: Table I.2 Example (from course book) Given G(๐) find ๐๐ . ๐บ(๐) = 4 โ (1 − 8๐) (1 − 4๐)(1 − 2๐)2 We first want to factorize G(Z) to a sum of first and second degree polynomial. ๐ด11 ๐ด22 ๐ด21 ๐บ(๐) = + + (1 − 4๐) (1 − 2๐) (1 − 2๐)2 The book gives a formula to calculate the coefficients: ๐ด11 = ๐บ(๐)(1 − 4๐)| 1 = −16; ๐ด21 = ๐บ(๐)(1 − 2๐)2 | ๐ง= 4 ๐ง= 1 2 = 12; ๐ด22 = โฏ = 8 And so the final result is: −16 8 12 ๐บ(๐) = + + ⇔ ๐๐ = −16 โ 4๐ + 12(๐ + 1) โ 2๐ + 8 โ 2๐ (1 − 4๐) (1 − 2๐) (1 − 2๐)2 Example summary: 1. factorize to polynomial 2. Use each factor as the denominator in a sum of products equation 3. Find coefficients using the formula from the book. ๐จ 4. Use the known relation ๐จ โ ๐ถ๐ ⇔ ๐−๐ถ๐ to form a close phrase that describes all the series elements. Continuous Generating functions - Laplace transform ๐(๐)(−∞, ∞) Definition: ∞ ๐น ∗ (๐ ) = ∫ ๐(๐ก) โ ๐ −๐ ๐ก ๐๐ก −∞ Back to distribution world – we won’t have negative times, so we can use a simpler definition: ∞ ๐น ∗ (๐ ) = ∫ ๐(๐ก) โ ๐ −๐ ๐ก ๐๐ก 0 Selected Laplace transforms: ∞ ๏ท Once again we start with a simple case: ๐น ∗ (0) = ∫−∞ ๐(๐ก) ๐๐ก if f is a density function, ๐ญ∗ (๐) = ๐ this may be highly useful for self checking: (a) transformed correctly and (b) found a true density function, by assigning s=0. ๏ท ๐(๐ก) = ๐ด โ ๐ −๐ผ๐ก ∞ ∞ ๐น ∗ (๐ ) = ∫ ๐ด โ ๐ −๐ผ๐ก โ ๐ −๐ ๐ก ๐๐ก = ๐ด ∫ ๐ −(๐ผ+๐ )๐ก ๐๐ก = 0 0 Note: while in discrete plane we used the form form ๏ท ๐ด ๐ผ+๐ ๐ด 1−๐ผ๐ ๐ด ๐ผ+๐ - in the continuous plane we will use the . Convolution: ๐ โ(๐ก) = ๐(๐ก) โ ๐(๐ก) = ∫ ๐(๐ก − ๐ฅ)๐(๐ฅ) ๐๐ก๐๐ฅ 0 as before – we see that: ๐(๐ก) โ ๐(๐ก) ⇔ ๐น(๐ ) โ ๐บ(๐ ) ๏ท Mean value: as in the discrete case, the mean value in the continuous case could be retrieved by deriving the transformed function: − ๐๐น ∗ (๐ ) ๐๐ ∞ |๐ =0 = ∫0 ๐ก โ ๐(๐ก) ๐๐ก This is the expected value. Note: Tables 3+4 in the book show additional useful examples which are similar to tables 1+2 mentioned in the discrete case. Continuous Inverse: Technique is going to be very similar to the discrete case: ๐ ∗ (๐ ) (… ) ๐ด1 ๐ด2 → → + +โฏ ∗ (… )(… )(… ๐ท (๐ ) ) ๐ผ1 + ๐ ๐ผ2 + ๐ From the last stage it is easy to inverse the function using the transform tables. ๐น ∗ (๐ ) =