CIS4307 - Homework 1: Discrete-Event Simulation

Assignment given: September 1, 2009
Due Date: September 21, by 10pm

Hints, Suggested format of Log File,

Write in C 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:

                         +-+      +--
              +<---------| |<-----|||<---+
              |          +-+      +--    ^
              |         CPU2    QUEUE2   |
              v    ---+           +-+    |      
  INPUT------>x---->|||---------->| |--->x------>OUTPUT
       SWITCH1^    ---+           +-+    |SWITCH2
              |   QUEUE1          CPU1   |
              |    +-+    +---           v
              +<---| |<---|||<-----------+      
                   +-+    +---      
	           DISK   QUEUE3
To this system arrive jobs. When a job arrives at QUEUE1 if CPU1 is free it goes there. Otherwise it is queued in QUEUE1 until CPU1 becomes available. A job spends some time on the cpu, then either the job completes, or it continues to CPU2, or it continues to the disk, after which it returns to CPU1. Execution of the job continues in this way until it leaves the system.

The program will read from a file, sim.init, the following values:

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 - the termination of a job is not an event, it is a consequence of a job terminating at CPU1 and not going to CPU2 or DISK]. [Here is the suggested format for the log file.]

Print out the values of SEED, INITTIME, ..

Determine and print out:

Run the program a number of times with different values for the parameters and random seed. Examine in correspondence the utilizations and queue sizes. If for a given choice of parameters by changing the random seed we obtain utilization and size values that are stable [i.e. do not change much, say, change at most 10%], then we have a good simulation.

Your program should process a reasonable number of jobs, at least one thousand.

As part of the homework submit a document, README.txt, from two to three double-spaced pages plus (may be) diagrams, describing your program. Your description is addressed to a technical manager whom you want to understand what you have done, the alternatives that you had, why you made the choices you made, and how you tested your program.

Include also a second document, RUNS.txt, describing the data you have used to test your program and what you have learned from it. You should choose reasonable values for the interarrival times and for the server service times. If you can, for a given choice of service times and of routing probability, determine what is the smallest reasonable interarrival time [how should we define this "reasonable"?].

In writing your program do not forget what you learned about object oriented programming and program design. Try to define queues and servers and their combination as objects.

Place your homework in the Drop box for the course in Blackboard. The homework will be graded by the TA on a scale of 0 to 20. The RUNS.txt file will be evaluated separately by the instructor for an additional 0 to 5 points.