introduction to probability stochastic process … to probability stochastic process queuing systems...

27
Introduction to probability Stochastic Process Queuing systems TELE4642: Week2

Upload: phungtu

Post on 21-Jun-2018

242 views

Category:

Documents


0 download

TRANSCRIPT

Introduction to probabilityStochastic ProcessQueuing systems

TELE4642: Week2

2-2

Overviewn Refresher:

q Probability theoryn Terminology, definitionn Conditional probability, independence

q Random variables and distributionsn Continuous r.v.: Exponentialn Discrete r.v.: Poisson

q Moments and moment generating functions

Network Performance

2-3

Why formal “models” of performance?n Why not just use “common sense” or “intuition”?

q can misleadq may not scale

n Stochastic theory more broadly applicable in the world:q Games: ancient Greeks to modern pokerq Boltzmann / Maxwell: thermodynamic entropyq Quantum mechanics: everything is uncertain!q Shannon: information theoryq Erlang: telephone switch capacity

n Questions pertinent to the Internet:q How to quantify end-to-end loss and delay for Internet traffic?q How big should router buffers be?q How many voice calls can be admitted?q How to tune communication protocol parameters?q How to exploit Internet topology structure?q How to make money? Akamai and Google did J

Network Performance

2-4

Probability: terminologyn A random experiment is an experiment for which the

result is not known a prioriq E.g.: How many “heads” will occur in 10 flips of a fair coin?

n A possible outcome is a sample point

n The sample space S is the set of all sample points, i.e., the set of all possible outcomesq There are 210 = 1024 different outcomes of flipping a coin

10 timesq A simplified sample space with 11 outcomes (0 to 10

occurrences of heads) is valid for our experiment

n An event A is a subset of Sq For example, we could define the event that there are …

n 5 “heads”; an odd number of “heads”; 7 or more “heads”, etc

Network Performance

2-5

( )

=

¥

=å=

=££

1 1')()()(

1)(1)(0)(

i iiii exclusivemutuallysAifAPAPiii

SPiiAPi

Probability: definition

A probability measure defined on S is a function that associates to each possible event A a real number P(A) such that:

Network Performance

Conditional Probability

2-6

n The conditional probability of event A given that event B has occurred, denoted by P(A|B), is defined as

q Q: A coin is tossed twice. What is the probability that both tosses were ‘heads’ given that at least one toss was heads?

n Bayes theorem: Given a partition {G1, G2, …} and event E

q Refining a hypothesis based on additional evidence

)() ()|(

BPBandAPBAP =

å=

j jj

iii GPGEP

GPGEPEGP)()|(

)()|()|(

Network Performance

2-7

Application of Bayes Theoremn Imagine you are a contestant in a game-show. The

host shows you three boxes, one of which has treasure inside, and asks you to pick one. Say you pick box 1. He now opens box 2 and shows that the treasure is not inside that box. He now asks if you want to change your mind. Should you change to box 3 or stay with box 1 to maximize your chances of winning?

q Gi: treasure is in box-iq E: you pick box 1 and the host opens box 2q P(G1) = P(G2) = P(G3) = 1/3q P(E|G1) = ½; P(E|G2) = 0; P(E|G3) = 1q Apply Bayes theorem to determine P(G1|E) and P(G3|E)

Network Performance

Independent events

2-8

n Two events are statistically independentiff P(A|B) = P(A) and P(B|A) = P(B)

n Q: Two fair dice are thrown simultaneously. Let A be the event that the first die shows a 6 and B the event that the sum of the dice is 9. Are A and B independent?q What if B denotes the event that the sum is 7?

Network Performance

2-9

Random Variables

Network Performance

n A random variable X maps each outcome s in the sample space S to a real number X(s)q A random variable is thus a measurement of an

experiment

Continuous random variables

2-10

n Can take on an uncountably infinite number of distinct valuesq Example: time between packet arrivals

n Cumulative distribution function (cdf):

n Probability density function (pdf):)()( xXPxF £=

dxxdFxf /)()( =

ò ¥-=x

dyyfxF )()(

Network Performance

Example: exponential r.v.

2-11

n pdf:n cdf:

n Most commonly used continuous r.v.n Models:

q Time elapsed since arrival of task at a computer systemq Time between arrivals of buses at a bus-stopq Time between arrivals of packets/connections at a network switch

0,)( ³= - xexf xµµ

xexF µ--= 1)( pdf

x

f(x)

Network Performance

Exponential r.v.: memoryless property

2-12

n Memoryless: future is independent of the past!n Mathematically:

n Proof:

tts ee µµ -+-= )(

Network Performance

! " > $ + & " > &) = ! " > $ , ∀$, & > 0

! " > $ + & " > &) = ! " > $ + & ,-. " > & / !(" > &)

= ! " > $ + & / !(" > &)

)= 1234 = !(" > $

2-13

Exercise: Generate Exponential r.v.

Using a uniformly distributed random variable in the interval [0,1) (such as generated by the rand() and drand48() functions), how would you generate an exponential random variable with parameter !?

Method: Equate cdf of the two distributionsAnswer: y = -ln(1-x)/!

where x is uniformly distributed in [0,1) and y is exponential with parameter !.

Network Performance

Discrete random variables

2-14

n Can take on a finite or countably infinite number of valuesq Example: number of packet arrivals in a 1-hour

interval

n Probability mass function (pmf):

n Cumulative distribution function (cdf):

][)( xXPxp ==

å £=

xyypxF )()(

Network Performance

Example: Bernoulli and Binomial r.v.

2-15

n Bernoulli r.v.: P[X=1] = p and P[X=0] = qq Coin toss (biased coin) where 1 denotes head and

0 tail

n Binomial r.v.: sum of n Bernoulli random variablesq Number of heads in n coin tosses

iniqpin

iXP -÷÷ø

öççè

æ== ][

Network Performance

Mean / Moments

2-16

n The mean (or expected value or expectation or first moment) of a continuous r.v. is

q Example: mean of exponential r.v. is 1/µ

n The mean of a discrete r.v. is

q Example: mean of binomial r.v. is np

n Second, n-th moments …n Variance, standard deviation …

ò¥

¥-= dxxxfXE )(][

å"==

kkXkPXE )(][

Network Performance

Stochastic Process

Stochastic Processes

n A stochastic process (or random process) is a family of random variables {X(t): t Î T} indexed by parameter t over index set Tq The typical interpretation is that T is the time dimension and r.v. X is

a function of time

n Continuous-time versus discrete-timeq The r.v. takes new values some point of time in continuous versus

discrete space

n Continuous-value versus discrete-valueq The r.v. takes on continuous versus discrete values

n We will only study stationary processes, i.e. those in equilibrium

2-18Network Performance

Markov Process

n A stochastic process having the Markov property:

q Sample path followed by the process after any time t depends only on the state Xt existing at that time, and not on past history

q We consider: continuous-time, discrete-value

n Important Markov process: Poisson processq Simplest, mathematically well-behaved example of a Markov processq It is a counting process for the number of randomly occurring point-

events observed in a given interval of time, e.g.n Tasks arriving at a processorn Messages arriving to a networkn Customers arriving at a supermarket checkoutn Radioactive particles from a source

2-19

)|();|( sstsuuts xXjXPsuxXjXP ===£== ++

Network Performance

Poisson Process: Definition

Let the r.v. N(t,t) denote number of arrivals in (t,t]Let o(h) denotes an expression f(h) such that

A Poisson process {N(0,t)}, t ≥ 0, with rate l is such that:1. P[N(t,t+h)=0] = 1 - lh + o(h)2. P[N(t,t+h)=1] = lh + o(h)3. P[N(t,t+h)=2] = o(h)4. N(0,t) and N(t,t+h) are independent for all t, h > 0

Every small interval has equal likelihood of arrival occurrencen Arrivals are thus completely random in time

Time-homogeneity property:n for all t: P[N(t, t+t)] = P[N(0,t)] = P[N(t)]

2-20Network Performance

Poisson Process: pmf

2-21

n Claim: The number of arrivals N(t) in any interval of length t is a Poisson r.v. with parameter lt:

!)(])([ ktektNP kt ll-==

tktNkPtNEk

l===å¥

=])([)]([

0

n Claim: Mean number of arrivals in any interval of length t:

n Claim: Inter-arrival time (i.e. time between successive arrivals) is an exponential r.v. with parameter l [Proof?]Ø Time to first arrival is exponential Ø Time to next arrival is exponential

n Claim: Poisson is a limiting approximation of binomial (λt = np) :

!)()1(limitepp

in i

tinin

ll--¥® =-÷÷

ø

öççè

æ

Network Performance

Poisson Process: Superposition

n If k independent Poisson processes A1, ..., Ak, with rates l1, ..., lk, are merged into a single process, A = A1 + … + Ak, , the combined process A is Poisson with rate l= l1 + … + lk

2-22

l1l2

lk

... l+

Network Performance

Poisson Process: Decomposition

n If a Poisson process (with rate l) is split into k other processes by independently assigning each arrival to the ith process with probability pi, where p1 + ... + pk = 1, the resulting k processes are each Poisson with rate pil for the ith process

2-23

p1l

...lp2l

pkl

Network Performance

Queuing systems

Queuing Systems Notation

2-25

n System parameters:q arrival process, service time, service capacity, waiting roomq Kendall notation: a/b/c

• a: inter-arrival time distribution (M: memoryless, G: general)• b: service time distribution (D: deterministic)• c: number of servers• Extra letter can denote waiting room capacity

q E.g.: M/M/1, M/M/c, M/G/1, M/D/1, M/M/1/K, …

n Performance measures:q wait time, sojourn time, number in queue, work in system, …

Input Output

Queue

Server

Network Performance

PASTA: Random Observer Property

n In any queueing system with Poisson arrivals:q Probability that a random arriving customer finds the

system in state A is exactly identical to the probability that the system is in state A.

q PASTA (Poisson Arrivals See Time Averages) property

n This does not hold for arbitrary systems, e.g. consider a system where customers arrive at time 1, 3, 5, …, each requiring one unit time of service, and the system starts idle at time 0.q Each arrival find the system empty, but probability of

empty system is 0.5

2-26Network Performance

Little’s Result

2-27

TNEnE

ltl

== ][][

n The mean number of customers in the system equals the product of the arrival rate and the mean sojourn time in the system

][][ qq EnE tl=

n Can be applied to sub-systems:Ø Queue:

Ø Server:

The server utilisation ρ denotes mean number of customers at the server, which is the same as the fraction of time the server is working

µltlr /][ == sE

Network Performance