CIS2168 - Homework 7: Discrete-Event Simulation
Assignment given: October 12, 2010
Due Date: October 25, by 10pm
Write a program to do the discrete-event simulation of a
computer system.
We assume that the system can be represented as
the following queueing network:
---+ +-+ SWITCH
INPUT------>x---->|||--->| |--->x------>OUTPUT
^ ---+ +-+ |
| QUEUE1 CPU |
| +-+ +--- v
+<---| |<---|||<----+
+-+ +---
DISK QUEUE2
To this system arrive jobs. When a job arrives at
QUEUE1 if CPU is free it goes there.
Otherwise it is queued in QUEUE1 until CPU
becomes available. A job spends some time on the cpu, then either the job
completes
or it continues to the disk, after which it returns to the cpu.
Execution of the job continues in this way until it leaves the system.
- The system runs from INITTIME (usually 0) to FINTIME.
- Jobs arrive from input with an interarrival time A that is uniformly
distributed between AMIN and AMAX.
- The probability of going to OUTPUT at SWITCH is P (the routing
probability)
- When jobs get to a server (the cpu and disk are all servers),
if the server is free the jobs move directly
to the server; otherwise they wait in the queue of that server
until their turn to move to the server arrives.
- Scheduling out of the queues is FIFO.
- A job is serviced by SERVERk [cpu is server1, disk is server 2] for an
interval of time S that is uniformly
distributed in the interval SkMIN and SkMAX.
- When a job leaves a server, if there is a job in the queue of that
server it is taken out and executed on that server.
- When FINTIME occurs, the simulation terminates, that is we do not
consider further jobs currently on servers or in queues.
The program will define as constants the following values:
- a seed SEED for the random number generator
- the values of INITTIME, FINTIME,
AMIN, AMAX, P, S1MIN, S1MAX, S2MIN,
S2MAX.
Write to a log file, sim.log, each significant event
[the significant events are the arrival of a new
job into the system, the completion of a job at a server, the termination
of the simulation].
Determine and print out:
- The average and the maximum size of each queue.
- The utilization of each server [= time-the-server-is-busy / total-time;
where total-time = time of termination of the simulation( = FINTIME) -
start time of simulation(= INITTIME)].
- The average and maximum response time of each server
- The average and maximum response time for the whole system.
- The throughput
(number of jobs completed per unit of time) of each server.
Your program should process a reasonable number of jobs, at least one
thousand.
Include a second document, RUNS.txt, describing the data you have
used to test your program, why you chose, and what you have learned from
it. You should
choose reasonable values for the interarrival times and for the server
service times [for simplicity, choose a P defaulted to 0.25, and
use a service time at the disk equal to the service time of real disks].
IF YOU LIKE:
You can do this homework in teams of two if you also provide a graphic
output for the program where the movement of jobs is represented in the
graph. You could represent the jobs by letters, a total of 52, assuming
that at no time more than 52 jobs are in the system.
If you take this option, please send me information on the team
composition by this Friday.