Lab Assignment 1 COP 4600: Operating Systems Principles

16
Lab Assignment 1 COP 4600: Operating Systems Principles Dr. Sumi Helal Professor Computer & Information Science & Engineering Department University of Florida, Gainesville, FL 32611 [email protected]

description

Lab Assignment 1 COP 4600: Operating Systems Principles. Dr. Sumi Helal Professor Computer & Information Science & Engineering Department University of Florida, Gainesville, FL 32611 [email protected]. Lecture Overview. Go over Lab Assignment 1, one more time. Queuing Theory 101 - PowerPoint PPT Presentation

Transcript of Lab Assignment 1 COP 4600: Operating Systems Principles

Page 1: Lab Assignment 1 COP 4600:  Operating Systems Principles

Lab Assignment 1COP 4600: Operating Systems Principles

Dr. Sumi HelalProfessor

Computer & Information Science & Engineering Department

University of Florida, Gainesville, FL [email protected]

Page 2: Lab Assignment 1 COP 4600:  Operating Systems Principles

Lecture Overview

• Go over Lab Assignment 1, one more time.

• Queuing Theory 101

• Simulation 101

Page 3: Lab Assignment 1 COP 4600:  Operating Systems Principles

Assignment

• λ = arrival rate, follows an arrival process

• μ = service rate, follows a service process

• ρ = utilization = λ/μ

λ μ

• Simulate a single queue/single server system, with a FIFO queuing discipline

• Report on the performance of the system

• Compare with analytic models.

Page 4: Lab Assignment 1 COP 4600:  Operating Systems Principles

Queuing Theory 101

• Must already know: – Random Variables– Basics of Probability

• Today, we will study & learn: – Probabilistic Processes– Little Law – M/M/1 analytic models

Page 5: Lab Assignment 1 COP 4600:  Operating Systems Principles

Exponential Process

• Suitable for describing time between successive events (e.g., arrival, service).

Time between Events

Pro

bab

ilit

y

P T > t( ) = e−λt T is a continuous Random Number

1

λ

Page 6: Lab Assignment 1 COP 4600:  Operating Systems Principles

Example

• Assume average time between arrival (or average inter-arrival time) is 45 sec.– Question: what is the prob. that inter-arrival

time is > 60 sec.?– Answer:

1

λ=1

45= 0.0222

P T > 60( ) = e−0.0222×60

= 0.2636

Page 7: Lab Assignment 1 COP 4600:  Operating Systems Principles

2636.060 TP

1

λ

Example

Page 8: Lab Assignment 1 COP 4600:  Operating Systems Principles

Poisson Process

• Poisson is suitable for describing arrivals or occurrence of events.

• Describes prob. of n arrivals in any time interval.

• If arrival process follows Poisson distribution, then the random variable representing inter-arrival time must follow the Exponential distribution.

Pt n( ) =λ t( )

ne−λt

n!

Page 9: Lab Assignment 1 COP 4600:  Operating Systems Principles

Quiz

• To make sure you follow so far, answer the following question:

– Prove that the probability that inter-arrival times are greater than the average inter-arrival time (that is > 1/λ), is 0.37, for any exponential distribution.

Page 10: Lab Assignment 1 COP 4600:  Operating Systems Principles

Definitions

• W = Average job wait time in the queue

• L = Average queue length

• N = Throughput (number of jobs completed per unit time)

Page 11: Lab Assignment 1 COP 4600:  Operating Systems Principles

Little’s Law:

L = λ •W

• Proof: – Shaded area is identical (=9 in

example)

1 2 3

Time inSystem(W)

Job# (N)

123

1 2 3 4 5 6 7

# in System(L) 1

23

Time (T)

lii=1

T

∑ = τ jj=1

N

lii=1

T

∑NT

=τ jj=1

N

∑NT

L

N=W

T

L =N

T•W

L = λ •W

Page 12: Lab Assignment 1 COP 4600:  Operating Systems Principles

Analytic Solutions

• Utilizing Little Law

• Utilization:

• L:

• W:

ρ =λμ

ρ1− ρ

μ − λ

1

μ − λ

• Quiz to check if you understand the implication of ρ• Calculate L and W for

ρ=0.09 (system under-utilized)

• Calculate the same for ρ=0.90 (system highly utilized)

• Calculate the same for ρ=0.999 (system over-utilized)

Page 13: Lab Assignment 1 COP 4600:  Operating Systems Principles

Effect of ρ – A Reality that Must be considered in any Operating System Design

λμ−= 1W

Page 14: Lab Assignment 1 COP 4600:  Operating Systems Principles

Simulation 101

• You have two independent events• At end of processing an independent event,

you must re-generate it. • All future events generated should be put in

an event list.• Simulation loop simply finds the next event

that will take place sooner in the future; remove it & process it. And yes, advance the clock to that selected next event.

Page 15: Lab Assignment 1 COP 4600:  Operating Systems Principles

Simulation 101

• At each new iteration in the simulation loop you check for exist criterion.

• You most update your counters and statistics every time: – The Clock is changed– A new job enters the system– A job exits the system– When the simulation loop exits.

Page 16: Lab Assignment 1 COP 4600:  Operating Systems Principles

Simulation 101

• Generating exponentially distributed random variables:– Use inverse inverse transform sampling as

follows: • X is RV with standard Uniform distribution [0,1],

then follows the exponential distribution with average arrival rate .

−ln(X) /λ

λ