Queuing Theory - Advanced Operating System - Lecture Slides, Slides of Computer Science

These are the lecture Slides of Advanced Operating System which includes Virtual Memory Performance, Resident Set Management, Allocating Pages, Page Fault Frequency Algorithm, Working Set Strategy, Thrashing, Replacement Policy, Multiprogramming Level etc. Key important points are: Queuing Theory, Long Term Averages, Queuing Model, Interesting Values, Arrival Rate, Random Values, Exponential Distribution, Poisson Arrival Rate, Math Notes, Poisson Example

Typology: Slides

2012/2013

Uploaded on 03/20/2013

dharmaketu
dharmaketu 🇮🇳

4.6

(165)

99 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Queuing Theory
1
Queuing Theory
Queuing Theory
Queuing theory is the mathematics of
waiting lines.
It is extremely useful in predicting and
evaluating system performance.
Queuing theory has been used for
operations research. Traditional queuing
theory problems refer to customers visiting
a store, analogous to requests arriving at a
device.
Long Term Averages
Queuing theory provides long term
average values.
It does not predict when the next event will
occur.
Input data should be measured over an
extended period of time.
We assume arrival times and service
times are random.
Assumptions
Independent arrivals
Exponential distributions
Customers do not leave or change
queues.
Large queues do not discourage
customers.
Many assumptions are not always true, but
queuing theory gives good results anyway
Queuing Model
S
Tq
Tw
W
Q
λ
Interesting Values
Arrival rate (λ) — the average rate at
which customers arrive.
Service time (s) — the average time
required to service one customer.
Number waiting (W) — the average
number of customers waiting.
Number in the system (Q) — the average
total number of customers in the system.
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Queuing Theory - Advanced Operating System - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Queuing Theory

Queuing Theory

  • Queuing theory is the mathematics of waiting lines.
  • It is extremely useful in predicting and evaluating system performance.
  • Queuing theory has been used for operations research. Traditional queuing theory problems refer to customers visiting a store, analogous to requests arriving at a device.

Long Term Averages

  • Queuing theory provides long term average values.
  • It does not predict when the next event will occur.
  • Input data should be measured over an extended period of time.
  • We assume arrival times and service times are random.

Assumptions

  • Independent arrivals
  • Exponential distributions
  • Customers do not leave or change queues.
  • Large queues do not discourage customers.

Many assumptions are not always true, but queuing theory gives good results anyway

Queuing Model

S

Tq

Tw

W

Q

Interesting Values

  • Arrival rate (λ) — the average rate at which customers arrive.
  • Service time (s) — the average time required to service one customer.
  • Number waiting (W) — the average number of customers waiting.
  • Number in the system (Q) — the average total number of customers in the system.

More Interesting Values

  • Time in the system (Tq) the average time each customer is in the system, both waiting and being serviced.
  • Time waiting (Tw) the average time each customer waits in the queue. Tq = Tw + s

Arrival Rate

  • The arrival rate, λ, is the average rate new customers arrive measured in arrivals per time period. Common units are access/second
  • The inter-arrival time, a , is the average time between customer arrivals. It is measured in time per customer. A common unit would be seconds/access.

a = 1 / λ

Random Values

  • We assume that most of the events we are interested in occur randomly. - Time of a request to a device - Time to service a request - Time user makes a request
  • Although events are random, we may know the average value of the times and their distribution.
  • If you flip a coin, you will get heads 50% of the time.

Exponential Distribution

  • Many of the random values are exponentially distributed. Frequency of Occurrence = e -t
  • There are many small values and a few large values.
  • The inter-arrival time of customers is naturally exponentially distributed.

Exponential Distribution

0

1

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Poisson Arrival Rate

If customers are arriving at the exponentially distributed rate λ, then the probability that there will be k customers after time t is:

t

k

k e k

t P t

= !

( ) ( )

Why is there Queuing?

  • The arrivals come at random times.
  • Sometimes arrivals are far apart. Sometimes many customers arrive at almost the same time. When more customers arrive in a short period of time than can be serviced, queues form.
  • If the arrival rate was not random, queues would not be created.

Utilization

  • Utilization (represented by the Greek letter rho, ρ) is the fraction of time the server is busy.
  • Utilization is always between zero and one

0 ≤ ρ ≤ 1

  • If a bank teller spends 6 hours out of an 8 hour day counting money, her utilization is 6/8 = 0.

Calculating Utilization

  • Utilization can be calculated from the arrival rate and the service time.

ρ = λ * s

It is important that the units of both the arrival rate and the service time be identical. It may be necessary to convert these values to common units.

Little’s Formula

  • The number in the system is equal to the arrival rate times the average time a customer spends in the system.

Q = λ * Tq

  • This is also true for just the queue.

W = λ * Tw

M/M/1 Formulas

Tq

s

ρ

Q

Tw

s

ρ

1 ρ ρ

2

W

Application of Little’s Formula

  • Multiplying the formulas on the left by λ gives the formula on the right.

Q

s

Tq =

0

2

4

6

8

10

12

14

16

18

20

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Utilization

Tq

Solution Process

  1. Determine what quantities you need to know.
  2. Identify the server
  3. Identify the queued items
  4. Identify the queuing model
  5. Determine the service time
  6. Determine the arrival rate
  7. Calculate ρ
  8. Calculate the desired values

Example

  • Consider a disk drive that can complete an average request in 10 ms. The time to complete a request is exponentially distributed. Over a period of 30 minutes, 117,000 requests were made to the disk. How long did it take to complete the average request? What is the average number of queued requests?

Solution

  • Determine what quantities you need to know.
    • The average request time is Tq
    • The number of queued jobs is W
  • Identify the server
    • The disk drive is the server
  • Identify the queued items
    • Disk requests
  • Identify the queuing model
    • M/M/

Solution (cont.)

  • Determine the service time

™S = 10 ms = 0.01 sec / request

  • Determine the arrival rate

™λ = 117,000 request / (30 min * 60 sec/min) = 65 requests / sec

  • Calculate ρ

™ρ = λ*s = 0.01 sec/request * 65 req/sec = 0.

Solution (cont.)

  • Time to complete the average request

ms

s TQ 28. 6 1 0. 65

  1. 01

1

= −

= −

=

The average length of the queue

2 2

ρ

ρ

W

M/D/1 Formulas

ρ

ρ

s

Tq^ ρ ρ

ρ

2

Q

s

Tw

2 ( 1 )

2

W =

M/D/1 Example

  • An ATM network sends 53 byte packets over a 155 Mb/sec line. It always takes 2.74 ms to send a packet. Each second 145,000 packets are sent. How long does a packet wait to be sent?

M/D/1 Solution

  • Determine what quantities you need to know.

The average time spent in the queue, Tw.

  • Identify the server

The transmission line.

  • Identify the queued items

Packets (not bits or bytes)

  • Identify the queuing model

M/D/

M/D/1 Solution

  • Determine the service time 2.74x10-6^ seconds
  • Determine the arrival rate 145,000 packets/second
  • Calculate ρ ρ = 145,000 * 2.74x10-6^ = 0.
  • Calculate the desired values
  1. 03 * 10 sec 2 ( 1 0. 3973 )

7

6 −

s ρ

Tw

Multiple Servers

S

S

S

Multiple Servers

  • Customers arrive and join a single queue.
  • Whenever any of the servers is idle, it serves the first customer on the single queue.
  • All of the servers must be identical. Any customer can be served by any server.
  • When there are N servers, the model is

M/M/N

Multiple Server Utilization

  • The server utilization for an N server system is:

ρ = λ s / N

This is the average utilization for all N servers.

Intermediate Value K

  • To make calculations easier, we first compute the value K.

=

=

N

i i

s

N

i i

s

i

i

K

0!

( )

1

0!

( )

λ

λ

K Calculation

  • The first term (i = 0) is always 1
  • Note that the value in the denominator is equal to the numerator plus the last term.
  • Since the denominator is always larger than the numerator, the value K must always be less than 1.
  • The value K is an intermediate that simplifies calculations. It has no intrinsic meaning.

Multiple Servers Busy

The probability that all servers are busy is

N

sK

K C λ −

1

1

This is the probability that a new customer will have to wait in the queue.

M/M/N formulas

s N

Cs Tq + −

= ( 1 ρ )

Q C λ s ρ

ρ

( 1 − ρ)

= N

Cs Tw ρ

ρ

W C

note: ρ = λ s / N

Example

  • Assume that you have a printer that can print an average file in two minutes. Every two and a half minutes a user sends another file to the printer. How long does it take before a user can get their output?

Multiple Arrival Streams

  • Exponentially distributed arrival streams can be merged. The total arrival rate is the sum of the individual arrival rates.

λa

λb

λa + λb

Dividing Customer Streams

  • An exponentially distributed arrival stream can be divided. The sum of the separated arrival rates must equal to original arrival rate.

λ

λ/

λ/

Linking Multiple Queues

  • The exit rate of a system is equal to the arrival rate.
  • The output from one queuing system can feed into another.

λ λ

The time through the system is the sum of the time through each queuing component.

Multiple Queue Example

  • Consider a network with a computer connected to a router which is connected to a server. The computer can send a packet in 12 ms while the router can send it to the server in 7 ms. Programs on the computer generate 40 packets/second. The router receives a total of 100 packets/second.
  • How long does it take for a packet to get to the server?

Computer (^) 12 ms Router (^) 7 ms Server

40 pkt/sec (^) 100 pkt/sec

Multiple Queue Solution

  • Determine what quantities you need to know

Sum of Tq for both networks

  • Identify the servers

The computer transmitter and the router

  • Identify the queued items

Packets

  • Identify the queuing model

both M/M/1 queues

Multiple Queue Solution

  • Determine the service time 12ms for the computer, 7 ms for the router
  • Determine the arrival rate 40 pkt/sec for computer, 100 pkt/sec for router
  • Calculate ρ ρcomputer = 400.012 = 0.48 ρrouter =1000.007 = 0.
  • Calculate the desired values Tqcomputer =0.012/(1-0.48) = 0.0231 sec Tq router =0.007/(1-0.7) = 0.0233 sec Total=46.4ms

Reusing a Server

  • Consider a file server. Requests use the network to get to the server, then use the disk, then the network again to get back.
  • The load on the network is doubled.

λ λ

λ

λ

Net Disk 2 λ