In: Computer Science
***THIS IS ALL THE INFORMATION THAT I HAVE****
***PLEASE ANSWER ALL QUESTIONS***
***GOOGLE SPREADSHEET COULD BE SCREENSHOT AND UPLOADED****
Five processes, J1, J2, J3, J4 and J5. arrive in the Ready Queue in sequence, one second apart. Each job takes 1 millisecond to load into memory.
Each job will take 10, 2, 3, 1, 5 seconds to run respectively.
Questions
A. Create a Google Sheet where each column represents a Job and reach row represents a second..
B. Show the state of the Ready Queue in the 7th second, the 11th second and the 20th second using the First Come, First Served, Shortest Job Next, Shortest Remaining Time First, and Round Robin with time quantum of 2 seconds.
C. Which one is most efficient? Discuss advantage and disadvantage. Double spaced, one page.
Given 5 processes J1, J2, J3, J4, J5.
Assume time starts from 1s. Each job takes 1 second to load into the memory. So-
J1 will be loaded into memory at 2s, J2 at 3s,J3 at 4s, J4 at 5s and J5 at 6s.
Consider these as arrival time.
In the ready queue, some processes are ready to be run but they are not allotted to the processor for processing. For example, while executing the J1 all other processes J2, J3, J4, and J5 are in the ready queue.
A.
The Gantt chart of each algorithm is below-
The time quantum is 2 seconds.
FCFS-
FCFS schedule processes according to their arrival time. At 2 sec 11 is in ready queue, it will get CPU and it will run for 10 sec and finishes at 12th sec.
J2 arrives at 3sec, J3 at 4sec, J4 at 5sec and J5 at 6sec. So all processes have arrived while J1 is running. Ready queue at 7th and 11th sec- [J2,J3, J4, is] At 12th sec J2rtart running and runs for 2 sec and finishes its execution. At 17a sec j4 starts running and runs till 18th sec so Ready queue at 20th sec= empty.
Shortest Job Next
At time 2sec, J1 arrives and starts execution.
At 3 sec J2 arrives and is added to waiting queue. J1 will continue its execution until finished.
J1 will finish at 12 sec , by then all the processes will be in ready queue.
At 12 sec process with smallest execution time will be chosen and it will start execution.
At 7th sec ready queue - J2, J3, J4, J5.
At 11th sec Ready queue = J2, J3, J4, J5
At 13th sec , J4 has smallest execution time of 1 sec so it will start running until finished.
At 13th sec ready queue = J2, J3, J5. choose J2 with smallest execution time.
At 15th sec ready queue = J5
At 20th sec ready queue = empty
Round Robin
C. Round robin may produce the lowest waiting time, which may be taken as best because of the waiting time.
The shortest job remaining first is also good but if the number of short processes is higher, the long process still have to wait even if we are taking the remaining shortest time.