Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is pseudocode for a program that simulates this process. Itreads the list o

ID: 3613011 • Letter: H

Question


Here is pseudocode for a program that simulates this process. Itreads the list of jobs from a file. Each job has a readytime, aname, a priority, and a need(the amount of time it needs to havethe cpu before it is finished). The jobs are on the file inorder of readytime. The simulation program prints out the name andfinish time of each job, in the order in which they finish.

while not past the end of the file
read job and enQ job into jobqueue
t=0 //start the time at 0
initialize queues hiQ and loQ to be empty.

loop while one of the 3 queues is not empty
    if both ready queues are empty, runJob=null
elseif hiQ is empty, deQ loQ into runJob
else, deQ hiQ into runJob

if runJob is null
advance t to the time on the front jobin jobqueue //cpu idle
elseif runJob needs more than timeslice
advance t tot+timeslice         //timespent executing newJob
        runJob.need -=timeslice
else
    advance t tot+runJob.need      //time spentfinishing newJob
    print runJob.name and t
        runJob=null   //runJob is done -- don't put back in queue
    while jobqueue is not empty and its front hadreadytime<=t   
        deQ jobqueue into newJoband enq newJob onto its proper queue
if runJob != null, enQ runJob into itsqueue  

Trace this pseudocode for the following file contents. (Each line in the file contains the name, readytime,priority, and need of a job.) Show a separate picture of the 2queues just before each deQ is done. Also show the output. Use 10 + yourlastname.length() as the TIMESLICE.

Explanation / Answer

Trace this pseudocode for the following file contents. Seems like there should be some sort of file in order to be able totrace anything out. Can you post the file contents?