CS457 - System Performance Evaluation - Winter 2008
Questions and Comments
- Midterm: Q5e
- Assignment 3
Lecture 21 - A Final Simulation
Processor Sharing
Time-slicing model: pre-emptive multi-tasking
For example, three classes of jobs
- Jobs with active I/O: long think times, very little processing
- Interactive jobs without active I/O: substantial processing that will
come to an end before long
- Batch jobs
Single server, three queues, needs a scheduling algorithm (discipline)
- Typical: try to provide some service to each
- Each queue has an importance, w(r), which means that it gets ... of the
processor (Exercise for the reader: Fill in ... in a reasonable way.)
- In the example below each queue is of equal importance.
Important state
- number of non-empty queues,
m
- number of jobs currently in each queue, N(r), r=1...M
Initialization
- The usual
- All queues empty
- One request (job) of each type in event-set
Arrival
- increment N(r)
- add request to queue
- if at head of queue,
- increment m
- reschedule existing departure events
- one more queue shares the processor
- scheduled departure events will occur later
- multiply time remaining (dep-time - clock) by m/(m-1)
- What about dividing by zero?
- start-service
Departure
- remove job from queue, decrement N(r)
- if N(r) == 0
- decrement m
- reschedule existing departure events
- one less queue shares the processor
- scheduled departure events will occur earlier
- multiply time remaining (dep-time - clock) by m/(m+1)
- What about multiplying by zero?
- else
Start-service
- work out departure time
- schedule departure event
Something is unrealistic about this model. What is it?
- no rescheduling within a queue
- A3 takes that into account
Something is unintuitive about this model. What is it?
- I have been justifying this approach in terms of implementation
simplicity and efficiency.
- But these qualities are starting to recede as things get more complex.
For example, queue-dependent importance.
- This is always the case.
Random Numbers
Text: chapter 12 & 29
Random Variables
The mathematical foundation for random number is the random variable,
which is a variable that has different values on different occasions.
- A probability distribution determines what values a random variable
gets, and how often
- Discrete versus continuous random variables
- We usually assume that the random variables we want are independent and
identically distributed (iid or IID).
- Why is this assumption reasonable?
- Think about where we get the distributions from.
- Most random variables we use have underlying distributions that are
non-negative.
- Random variables are normally written as capitals.
Random variable concepts
- Cumulative distribution function (cdf or CDF):
- F(x) = P(X <= x)
- F(0) = 0
- F(infinity) = 1
- Probability density function (pdf or PDF):
- Continuous distributions only
- F(x) = \int_0^x f(x') dx'
- Mean: \mu = E(X) = \int_0^\infinity x'f(x')dx'
- Variance: \sigma^2 = X((X-E(X))^2) = \int_0^\infinity (x'-E(X))^2
f(x')dx'
- Probability mass function (pmf or PMF):
- Discrete distributions only: x takes a value fro a countable set
{x1, x2, x3, ...} where ... may or may not terminate
- P(X = xi) = pi
- \sum_i pi = 1
- F(x) = \sum_(xi<=x) pi
- Mean: E(X) = \sum_i xi pi
- Variance: \sum_i (xi - E(X) )^2 pi
In discrete event simulation we model quantities like interarrival time or
service time as IID random variables
- As a result we need to generate random variables from random number
generators, which are discussed in a future lecture.
Return to: