You are on page 1of 29

Single server model

Queue Server

I/O Controller
Arrivals And
device

1
• Timesys = Timeq + Times

2
• Times = Average time to server
task

• Timeq = Average time per task in


the queue

• Timesys= Aver time /task

• Arrival Rate = λ = Average number of


arriving tasks

• Lengths = Average number of task in service

• Lengthq = Average length of queue

• Lengthsys= Lengths +Lengthq

3
• Server Utilization

= Arrival Rate x Times

4
Example#1

• Problem Statement
Suppose an I/O system with a single
disk gets on average 100 I/O
requests/second. Assume that
average time for a disk to service an
I/O request is 5ms. What is the
utilization of the I/O system?
5
Solution

• Time for an I/O request = 5ms


=0.005sec
Server utilization = 100 x 0.005
= 0.5

6
Poisson Distribution

• Probability (k)= (e-k x ak) /k!

a= Rate of events x Elapsed time

7
Variance
C2 =
(Arithmetic mean time)2

8
Average Residual Service Time

= ½ x weighted mean time x (1+C2)

9
• All the tasks in the queue ahead of
the new task must be completed.

• Each task takes on average Times.

• A task on server takes average


residual service time to complete.

• The chance that the server will be


busy is called server utilization.
10
• Timeq = Lengthq x Times
+ (Server utilization
x Average residual service time )
Suppose:

Server utilization = β

Average residual = λ
service time
11
• Timeq = server utilization x times
+ (Arrival time x Time q) x Times

• Timeq = β x Times
+ (Arrival time x Timeq) x Times

• Timeq = (Times x β ) / (1 – β)

12
Example#2

• For the system of previous


example having server utilization
of 0.5, what is the mean number
of I/O requests in the queue?

13
Solution

(Server utilization )2
Lengthq =
(1- Server utilization )

Lengthq = (0.5) 2 / (1-0.5)= 0.5


14
Example#3

Suppose a processor sends 10 disk I/O


per second, these requests are
exponentially distributed, and the average
service time of an older disk is 10ms.
Answer the following questions:

 What is the number of requests in the queue?


 What is the average time a spent in the queue?
 What is the average response time for a disk
request? 15
Solution
Average number of arriving tasks/second = 20

Average disk time = 10ms = 0.01sec

Sever utilization = 20 x 0.01=0.2

Timeq = 10ms x 0.2/(1-0.2) = 2.5ms

Average response time = 2.5+10=22.5ms

16
M/M/m Model of Queuing
Theory
Arrival Rate x Time
Utilization =
Nserver

17
M/M/m Model of Queuing
Theory
• Lengthq = Arrival Rate x Timeq

(Time s x (Ptasks>= Ns))


• Timeq =
Ns x (1- utilization)

18
M/M/m Model of Queuing
Theory

Ns x utilization
Probtasks>= Ns = x Prob 0task
Ns! x (1-utilization)

19
Example#4
• Suppose instead of a new, faster disk,
we add a second slow disk, and
duplicate the data so that read can be
serviced by either disk. Let’s assume
that the requests are all reads.
Recalculate the answers to the earlier
questions, this time using an M/M/m
queue.
20
Solution

• The average utilization of the two disks is


given as;

Arrival rate x Times


Server utilization = ----------------------------
Ns
= (40 x 0.02) / 2
= 0.4
21
Probability of no tasks in
the queue
(2 x utilization)2
Prob0tasks = 1+ -------------------------
2! x (1- utilization)
-1
(2 x utilization)n
+ ---------------------
n!
22
-1
(2x 0.4) 2
Prob0tasks = 1 + ---------------- + (2 x 0.4)
2! X (1- 0.4)

= (1 + 0.533 + 0.800 ) -1

= 2.333-1

23
(2 x utilization)2
Prob tasks >=Ns = ------------------------- x Prob0tasks
2! x (1- utilization)

(2x 0.4) 2
= ---------------- x 2.333-1
2! x (1- 0.4)

= 0.229
24
Time waiting in the queue:

Prob tasks >=Ns


• Time q = Times x ----------------------------
Ns x (1- utilization)

= 0.020 x 0.229/ ( 2 x 0.6)


= 3.8msec

Average response time = 20msec + 3.8msec


= 23.8msec

25
Bench Mark=C: Complex query OLTP

Data Size (GB) = 100-3000

Performance metric = New order transaction


per minute

Date of 1st result = 1992

26
TPC-C
TPC-C is measured

• In transaction per min (tpm).

• In price of system, including


hardware, and software.
27
Synchronous I/O
The operating system

• requests the data

• Then switches to another process

• When requested data arrives, then


operating switches back to the
requesting process. 28
Asynchronous I/O

• Allows the processor to make


continuous requests.

• Shares the same philosophy as


caches in out-of- order CPUs.

29

You might also like