Programming skills that I want you to be able to demonstrate.

Can you delete all of the code in the main() method of the program that I shared with you today (queue.c) except for the call to exit(0) and then:

  • add code that creates an empty queue
  • write a loop that creates N processes and adds them to the queue
  • compute the arrival times of processes (in the same loop or in a second loop) (this is the sum of the process' inter arrival time and the arrival time of the process that it follows into the system—there is a special case for the first process)
  • compute the time at which service begins for each process (this is the larger of two numbers: the time at which the process arrives and the time at which service for the process ahead of it is completed—the first process is a special case) 
  • compute the time at which service for each process is completed (this is the sum of the time at which service begins and the time required for service)
Then can you also compute some statistics. Select one (or more) of the following statistics or come up with your own:

  • mean time required to serve each process
  • variance (or standard deviation) of times required to serve processes
  • mean time between the arrival of successive processes
  • variance (or standard deviation) of interarrival times
  • mean time that each process waits before receiving service
  • maximum time that any process waits before receiving service
  • histogram of service times, interarrival times, or wait times—for example, you could create an array of integers whose first element will hold a count of the number of processes whose service time is in the interval [0.0, 1.0), whose second element will hold a count of the number of processes whose service time is in the interval [1.0 , 2.0), and so on.

You do not have to do all of this work in your C program. You could write a C program that prints data to standard output (the screen), use Unix I/O redirection to put the data into a text file, and then import the data into a spreadsheet program. Then use the statistical functions and plotting functions of the spreadsheet.

I encourage you to work together. Collaboration is good! Teaching you how to work in teams is one of my highest goals. So long as you acknowledge the help that you receive, there is no such thing as cheating on this assignment. Ask for help. Offer help. Among you there is much knowledge and skill.

Last modified: Monday, November 30, 2015, 8:59 PM