Top Banner

of 33

SPM - Lecture - Part2 - Queueing (1)

Feb 26, 2018

Download

Documents

Ryu Watanabe
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    1/33

    Copyright : Nahrstedt, Angrave, Abdelzaher, Caccamo 1

    Queueing Systems

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    2/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    2

    Content of This Lecture

    Goals: Introduction to Principles for Reasoning

    about Process Management/Scheduling

    Things covered in this lecture:

    Introduction to Queuing Theory

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    3/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    3

    Queueing Model

    Random Arrivals modeled as Poisson process

    Service times follow exponential distribution

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    4/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    4

    Discussion

    If a bus arrives at a bus stop every 15minutes, how long do you have to waitat the bus stop assuming you start to

    wait at a random time?

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    5/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    5

    Discussion

    The mean value is (0+15)/2 = 7.5 minutes

    What assumption have you made about thedistribution of your arrival time?

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    6/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    6

    Discussion

    The mean value is (0+15)/2 = 7.5 minutes

    What assumption have you made about thedistribution of your arrival time?

    The above mean assumes that your arrival time tothe bus station is uniformly distributed within [0, 15]

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    7/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    7

    Queuing Theory (M/M/1 queue)

    ARRIVAL RATE (Poisson process)

    SERVICE RATE Input Queue

    Server

    the distribution of inter-arrival times between two consecutive arrivals isexponential (arrivals are modeled as Poisson process)

    service time is exponentially distributed with parameter

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    8/33

    M/M/1 queue

    The M/M/1 queue assumes that arrivals are a Poisson process and theservice time is exponentially distributed.

    Interarrival times of a Poisson process are IID (Independent and Identically

    Distributed) exponential random variables with parameter

    Arrival rate CPU

    Service rate

    1t

    2

    Arrival times:

    - independent from each other!

    - each interarrival i follows

    an exponential distribution

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    9/33

    Appendix: exponentialdistribution

    If is the exponential random variable describing the distribution of inter-arrival times between two consecutive arrivals, it follows that:

    The probability density function (pdf) is:

    tetPtA == 1}{)(

    t

    etAdt

    dta

    == )()(

    Arrival rate CPU

    Service rate

    Probability to have the firstarrival within is 1-e-

    t

    cumulative distribution

    function (cdf)

    0

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    10/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    Queueing Theory

    Queuing theory assumes that the queue is in a steady state

    M/M/1 queue model: Poisson arrival with constant average arrival rate (customers per unit time) Each arrival is independent. Interarrival times are IID (Independent and Identically Distributed) exponential

    random variables with parameter What are the odds of seeing the first arrivalbefore time t?

    See http://en.wikipedia.org/wiki/Exponential_distribution

    for additional details

    tetP

    = 1}{

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    11/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    11

    Analysis of Queue Behavior

    Poisson arrivals: probability ncustomers arrive within time interval t is

    ( )

    !n

    te nt

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    12/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    12

    Analysis of Queue Behavior

    Probability ncustomers arrive within time interval t is:

    Do you see any connection between previous formulas and the above one?

    ( )!nte

    nt

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    13/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    13

    Analysis of Queue Behavior

    Probability ncustomers arrive in time interval t is:

    Do you see any connection between previous formulas and the above one?

    Consider the waiting time until the first arrival. Clearly that time is morethan t if and only if the number of arrivals before time tis 0.

    ( )!nte

    nt

    ( ) ( ) t

    t

    ete

    tP

    ==>

    !0

    0

    ( ) ( ) tetPtP =>= 11

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    14/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    14

    Littles Law in queuing theory

    The average number L of customers in a stable system is equal to the averagearrival rate times the average time W a customer spends in the system It does not make any assumption about the specific probability distribution followed by the

    interarrival times between customers

    Wq= mean time a customer spends in the queue

    = arrival rate

    Lq = Wq number of customers in queue

    W = mean time a customer spends in the entire system (queue+server)

    L = W number of customers in the system

    In words average number of customers is arrival rate times average waiting time

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    15/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    15

    Analysis of M/M/1 queuemodel

    1

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    16/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    16

    Analysis of M/M/1 queuemodel

    Quiz: how can we derive the average time W in the system, and the average timeWq in the queue?

    Use Littles theorem

    Time in the system is:

    Time in the queue is:

    Number of customers in the queue is:

    = 1W

    =qW

    =

    1

    2

    qL

    Try to derive them usingLittles Law!

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    17/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    17

    Hamburger Problem

    7 Hamburgers arrive on average every time unit

    8 Hamburgers are processed by Joe on average every unit

    1. Av. time hamburger waiting to be eaten? (Do they get cold?) Ans = ????

    2. Av number of hamburgers waiting in queue to be eaten? Ans = ????

    Queue

    78

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    18/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    18

    Hamburger Problem

    7 Hamburgers arrive on average every time unit

    8 Hamburgers are processed by Joe on average every unit

    1) How long is a hamburger waiting to be eaten? (Do they get cold?) Ans = 7/8

    time units2) How many hamburgers are waiting in queue to be serviced? Ans = 49/8

    Queue

    78

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    19/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    19

    Example: How busy is theserver?

    =2=3

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    20/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    20

    Example: How busy is theserver?

    =2=3

    66%

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    21/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    21

    How long is an eater in thesystem?

    =2

    =3

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    22/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    22

    How long is an eater in thesystem?

    =2=3

    = 1W = 1/(3-2)= 1

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    23/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    How long is someone in thequeue?

    =2=3

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    24/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    24

    How long is someone in thequeue?

    =2=3

    66.

    23

    66. =

    =

    =

    qW

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    25/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    How many people in queue?

    =2=3

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    26/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    26

    How many people in queue?

    =2=3

    33.166.1266.

    1

    2=

    =

    =

    qL

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    27/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    27

    Interesting Fact

    As approaches one, the queue lengthbecomes infinitely large.

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    28/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    28

    Until Now We Looked at SingleServer, Single Queue

    ARRIVAL RATE

    SERVICE RATE

    Input Queue

    Server

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    29/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    29

    Sum of Independent Poisson Arrivals

    ARRIVAL RATE 1

    SERVICE RATE Input Queue

    Server

    ARRIVAL RATE 2

    =1+ 2

    If two or more arrival processes are independent and Poisson with parameter i,then their sum is also Poisson with parameter equal to the sum of i

    C i h N h d A Abd l h

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    30/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    30

    As long as service times areexponentially distributed...

    ARRIVAL RATE

    SERVICE RATE 1

    Input Queue

    Server

    Server

    SERVICE RATE 2

    Combined=1+2

    C i ht N h t dt A Abd l h

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    31/33

    Copyright : Nahrstedt, Angrave, Abdelzaher

    31

    Question: McDonalds Problem

    A) Separate Queues per Server B) Same Queue for Servers

    Quiz: if WA is waiting time for system A, and WB is waiting time for systemB, which queuing system is better (in terms of waiting time)?

    Copyright : Nahrstedt Angrave Abdelzaher

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    32/33

    X = lamda; u = mikro; p = epsilon

    Scenario A; x=2 & u=4

    P = 2/4 = 0.5

    Wq = p/(u-x) = 0.5/(4-2) = 0.5/2 =0.25 seconds

    Copyright : Nahrstedt, Angrave, Abdelzaher

    32

    Copyright : Nahrstedt Angrave Abdelzaher

  • 7/25/2019 SPM - Lecture - Part2 - Queueing (1)

    33/33

    X = lamda; u = mikro; p = epsilon Scenario B; x=2 & u=4

    Xt = x1 + x2+x3 = 6

    Ut = U1+U2+U3 = 12

    P = 6/(3*4) = 6/12 = 0.5 Wq = p/(Ut-Xt) = 0.5/(12-6) = 0.5/6 = 0.0833

    seconds

    Copyright : Nahrstedt, Angrave, Abdelzaher

    33