Frequently Asked Questions about HW1 Q1: Does anyone know what are we supposed to calculate for the following instruction? "the mean number of customers in the system (in the queue + in service)" Let N(t) be the number of in the system (in the queue + in service) at time t. If N(t) is a continuous function of t, then the mean number of customers in the system between time [T1, T2] is N0 = integral{from T1 to T2, N(t)dt}/(T2 - T1) (1) Now in our simulation, since N(t) is discrete, the integral becomes weighted sum. Let {t0, t1, ..., tn} be the moments when N(t) changes, where t0 = T1, tn = T2. Then N0 = suml{i = 1 to n, N(t)(ti - t(i-1))}/(T2 - T1) (2) Q2: Should a job be counted towards the Mean Number of Jobs during its overhead time? A job should be counted towards the Mean Number of Jobs right after it arrives at the system. Q3: Is the print out going to be graded by an autograder? If so, can someone please specify the format in more detail (i.e. tab-delimited or space-delimited)? This assignment will not be graded by autograder and there is no specific format requirement. Just make the output clear and follow instructions from the homework. Q4: In addition to generating and using our own times, does our program have to be able to deal with your supplied time files (other than debugging purposes)? Yes you program have to be able to deal with supplied time files, as specified in the homework. Q5: Time slice Both RR and SET alorithms use quantum or timeslice. For simulating these two algorithms, it is NOT a good idea to use a periodic timer. This is because these algorithms require that once you start running a job, you should let it consume all the quantum unless it finishes first. If the running is interrupted by arrival of new jobs, you should process the new arrivals first (putting them into the job queue) and resume the CURRENT job. You need to postpone the ending of its quantum because the system spent time not servicing this job. This means the clock that interrupts at the end of each quantum is not ticking at constant rate. It is much easier to use an "alarm clock": when you start a job, set an alarm clock that will go off at the end of the quantum. You then update this alarm clock as you handle other events. Overhead Handling An overhead X can be considered to consists of two parts: X/2: putting a job into the job queue. X/2: starting a job Whenever a job arrives, the system needs to put it into the job queue first, even if it is the one that will run next. 3. Scheduling Algorithms You are to simulate the following scheduling algorithms. In each case, consider three cases: The time X to switch between processes is either 0.0, 0.01, or 0.10. (I.e. each simulation is run 3 times.) This overhead is incurred whenever: (a) there is a task switch from job A to job B or (b) a job arrives to an empty system. If (c) the clock interrupts at the end of a quantum and the same job is resumed, the overhead is X/2. (d) When a job arrives to a busy system, the overhead is X/2 if the currently running job continues (after the arrival of the new job), and is X if the running (currently active) job changes. Logically, you can consider the overhead in item (d) to consist of two parts: X/2 overhead to accept the new job, and put it in the job queue. X/2 overhead to start whichever job starts next, if it is a dif- ferent job. 3.2. Shortest Remaining Processing Time Please simulate the system using SRPT scheduling. At any given time, you are to be running the job with the least remain- ing processing time. Note: Consider the following case: You are running job A. Job B arrives, which is shorter than the remaining time of job A. You enter the task switch overhead to switch to job B. While in the task switch overhead, job C arrives, and C is shorter than the remaining time for B. You should process it the following way: Overhead X/2 to accept job B and put it in the job queue. Overhead of X/2 to accept job C and put it in the job queue. Overhead of X/2 to start job C.