Beruflich Dokumente
Kultur Dokumente
http://pages.cpsc.ucalgary.ca/~mahanti/teaching/F05/CPSC531/
CPSC 531:
Objective
Under simulation fundamentals via examples
Time-shared computer model
Multi-teller bank with jockeying
Job shop model
Get a grip of simlib
CPSC 531:
CPSC 531:
Problem Specification
Terminals think and then issue jobs
Think times exponentially distributed - 25 s
Job service times also exponentially distributed - 0.8 s
Job processing rule: round-robin
Each visit to CPU is q = 0.1 sec. (a quantum)
If remaining processing requirement > q sec., it gets q sec, then
kicked out
If remaining processing requirement q sec., it gets what it
needs, returns to its terminal
Swap time:
CPSC 531:
Problem Specification
Response time of a job = (time job returns to
terminal) (time it left its terminal)
Initially, computer empty and idle, all n jobs in
the think state at their terminals
Stopping rule: 1000 response times collected
Output:
Job Arrival
CPU
Processing
End
Simulation
Terminals
CPSC 531:
In CPU, if remaining service time > 0 then job has this much CPU
time needed after current CPU pass; if remaining service time
0, job will be done after this pass
CPSC 531:
CPSC 531:
}
} while (next_event_type != EVENT_END_SIMULATION);
CPSC 531:
Yes
CPU idle?
No
Return
CPSC 531:
10
if (list_size[LIST_CPU] == 0)
start_CPU_run();
CPSC 531:
11
CPSC 531:
12
CPSC 531:
13
Things to do
Look at the simlib code for the time shared
computer model
CPSC 531:
14
Multi-teller Bank
Interarrival times:
Expon (mean = 1 min.)
Service times:
Expon (mean = 4.5 min.)
New arrivals:
If theres an idle teller, choose leftmost (idle) teller
If all tellers are busy, choose shortest queue (ties leftmost)
Initially empty and idle
Termination: close doors at time 480 min.
If all tellers are idle at that time, stop immediately
If any tellers are busy, operate until all customers leave
service
CPSC 531:
15
Jockeying Rules
Suppose teller
above
Then either teller i becomes idle, or queue i becomes
one shorter
Maybe a customer at the end of some other queue j (
i) moves to teller i (if now idle) or the end of the nowshorter queue i
For each teller/queue k, let nk = number of customers
facing (in queue + in service) teller k just after teller i
finishes service
Procedure:
CPSC 531:
16
Performance Metrics
Estimate
Time-average total number of customers in (all)
queues
Average, max delay of customers in queue (s)
Whats the effect of the number of tellers?
CPSC 531:
17
CPSC 531:
18
queue(s)
timest variables: none use filest for timeaverage number in queues since time-average of
total = total of time averages (details in book)
Random-number streams:
1 = interarrival times, 2 = service times
CPSC 531:
19
CPSC 531:
20
CPSC 531:
21
CPSC 531:
22
else {
/* The queue is not empty, so start service on a customer. */
list_remove(FIRST, teller);
sampst(sim_time - transfer[1], SAMPST_DELAYS);
transfer[3] = teller; /* Define before event_schedule. */
event_schedule(sim_time + expon(mean_service, STREAM_SERVICE),
EVENT_DEPARTURE);
}
/* Let a customer from the end of another queue jockey to the end of this
queue, if possible. */
jockey(teller);
CPSC 531:
23
CPSC 531:
24
Things to do
Look at the simlib code for the multi-teller
bank model
CPSC 531:
25
CPSC 531:
26
(contd.)
Estimate
Average total delay in queues for each job type separately
Overall average total delay in queues over all job types,
weighted by their (known) probabilities of occurrence
For each machine group separately:
Average delay in queue there (all job types lumped together)
Time-average number of jobs in queue (all job types together)
CPSC 531:
27
CPSC 531:
28
29
Things to do
Look at the simlib code for this problem
Next class continue with Statistical Models
First assignment will be out this weekend
CPSC 531:
30