Question: 2. Round-Robin Simulation 2.1. Problem Description We reviewed a Round-Robin strategy for effectively sharing processes on a single CPU. In the starting code, the number
2. Round-Robin Simulation 2.1. Problem Description We reviewed a Round-Robin strategy for effectively sharing processes on a single CPU. In the starting code, the number of initial processes was fixed and additional processes were added randomly. You are to enhance this program to read a series of instructions for the introduction of processes at specific launch times. The instruction format follows: AT ADD where and are in milliseconds. Both are integers. The instructions will come in order of increasing . Do not assume that the first process will start at time 0. The last instruction will be simply DONE. Simulate the Operating System scheduling starting at simulation time 0 milliseconds. Use a time slice of 10 milliseconds. Before executing the next time slice, add any/all processes that should have started at or before the current time to the end of the active list of processes. For example: Instructions: AT O ADD Process1 64 AT 12 ADD Process2 35 AT 20 ADD Process3 47 AT 38 ADD Process4 16 DONE Execution trace: @00010 0:[] @00010 Added new Process Process1: 64} @00020 1:[{Process1: 54}] @00020 Added new Process {Process2: 35} @00020 Added new Process {Process3: 47} @00030 3:[{Process2: 35}, {Process3: 47}, {Process1: 44}] 200040 3:[{Process3: 47}, {Process1: 44}, {Process2: 25}] 200040 Added new Process {Process4: 16} When all the processes have completed execution, print the number of time slices and the completion time (in milliseconds). Your output must include the names of all the team members. A sample set of commands is available in ProcessSequence1.txt. The output is shown below in Required Output. Your program will be tested with this input and several others so test it well. 2.2. Notes Start with the partially implemented code found with this assignment: CircularlyLinkedList.java Process.java Round RobinSimulation.java You will not need to modify CircularlyLinkedList.java or Process.java. Turn in only your modified source file: AdvRoundRobinSimulation.java. Make sure your class is not in a package (that is, it is in the default package). 2.3. Required Main Class AdvRoundRobinSimulation 2.4. Required Input A series of user entered process instructions as described in the Problem Description. Read the input until the instruction DONE is seen. 2.5. Required Output For the instruction file ProcessSequence1.txt, your output should look like the following (input is in GREEN). Round Robin Simulation - Team Member 1, Team Member 2, Team Member 3, ... AT 4 ADD P1 64 AT 12 ADD P2 35 AT 20 ADD P3 47 AT 38 ADD P4 16 AT 49 ADD P5 12 AT 50 ADD P6 81 AT 140 ADD P11 71 AT 142 ADD P12 24 AT 143 ADD P13 32 AT 157 ADD P14 9 AT 345 ADD P15 20 DONE @00010 :[1] 200010 Added new Process {P1: 64} @00020 1:[{P1: 54}] @00020 Added new Process {P2: 35} @00020 Added new Process {P3: 47} @00030 3:[{P2: 35}, {P3: 47}, {P1: 44}] W00040 3:[{P3: 47}, {P1: 44}, {P2: 25}] @00040 Added new Process {P4: 16} 200050 4:[{P1: 44}, {P2: 25}, {P4: 16}, {P3: 37}] @00050 Added new Process {P5: 12} @00050 Added new Process {P6: 81} 200060 6:[{P2: 25}, {P4: 16}, {P3: 37}, {P5: 12}, {P6: 81}, {P1: 34}] @00070 6:[{P4: 16}, {P3: 37}, {P5: 12}, {P6: 81}, {P1: 34}, {P2: 15}] @00080 6:[{P3: 37}, {P5: 12}, {P6: 81}, {P1: 34}, {P2: 15}, {P4: 6}] 200090 6:[{P5: 12}, {P6: 81}, {P1: 34}, {P2: 15}, {P4: 6}, {P3: 27}] @00100 6:[{P6: 81}, {P1: 34}, {P2: 15}, {P4: 6}, {P3: 27}, {P5: 2}] @00110 6:[{P1: 34}, {P2: 15}, {P4: 6}, {P3: 27}, {P5: 2}, {P6: 71}] @00120 6:[{P2: 15}, {P4: 6}, {P3: 27}, {P5: 2}, {P6: 71}, {P1: 24}] @00130 6:[{P4: 6}, {P3: 27}, {P5: 2}, {P6: 71}, {P1: 24}, {P2: 5}] 200140 5:[{P3: 27}, {P5: 2}, {P6: 71}, {P1: 24}, {P2: 5}] @00140 Added new Process {P11: 71} @00150 6:[{P5: 2}, {P6: 71}, {P1: 24}, {P2: 5}, {P11: 71}, {P3: 17}] @00150 Added new Process {P12: 24} @00150 Added new Process {P13: 32} @00160 7:[{P6: 71}, {P1: 24}, {P2: 5}, {P11: 71}, {P3: 17}, {P12: 24}, {P13: 32}] @00160 Added new Process {P14: 9} @00170 8:[{P1: 24}, {P2: 5}, {P11: 71}, {P3: 17}, {P12: 24}, {P13: 32}, {P14: 9}, {P6: 61}] 200180 8:[{P2: 5}, {P11: 71}, {P3: 17}, {P12: 24}, {P13: 32}, {P14: 9}, {P6: 61}, {P1: 14}] @00190 7:[{P11: 71}, {P3: 17}, {P12: 24}, {P13: 32}, {P14: 9}, {P6: 61}, {P1: 14}] @00200 7:[{P3: 17}, {P12: 24}, {P13: 32}, {P14: 9}, {P6: 61}, {P1: 14}, {P11: 61}] 200210 7:[{P12: 24}, {P13: 32}, {P14: 9}, {P6: 61}, {P1: 14}, {P11: 61}, {P3: 7}] @00220 7:[{P13: 32}, {P14: 9}, {P6: 61}, {P1: 14}, {P11: 61}, {P3: 7}, {P12: 14}] @00230 7:[{P14: 9}, {P6: 61}, {P1: 14}, {P11: 61}, {P3: 7}, {P12: 14}, {P13: 22}] @00240 6:[{P6: 61}, {P1: 14}, {P11: 61}, {P3: 7}, {P12: 14}, {P13: 22}] @00250 6:[{P1: 14}, {P11: 61}, {P3: 7}, {P12: 14}, {P13: 22}, {P6: 51}] 200260 6:[{P11: 61}, {P3: 7}, {P12: 14}, {P13: 22}, {P6: 51}, {P1: 4}] @00270 6:[{P3: 7}, {P12: 14}, {P13: 22}, {P6: 51}, {P1: 4}, {P11: 51}] @00280 5:[{P12: 14}, {P13: 22}, {P6: 51}, {P1: 4}, {P11: 51}] @00290 5:[{P13: 22}, {P6: 51}, {P1: 4}, {P11: 51}, {P12: 4}] @00300 5:[{P6: 51}, {P1: 4}, {P11: 51}, {P12: 4}, {P13: 12}] 200310 5:[{P1: 4}, {P11: 51}, {P12:4}, {P13: 12}, {P6: 41}] @00320 4:[{P11: 51}, {P12: 4}, {P13: 12}, {P6: 41}] 200330 4:[{P12: 4}, {P13: 12}, {P6: 41}, {P11: 41}] @00340 3:[{P13: 12}, {P6: 41}, {P11: 41}] @00350 3:[{P6: 41}, {P11: 41}, {P13: 2}] @00350 Added new Process {P15: 20) 200360 4:[{P11: 41}, {P13: 2}, {P15: 20}, {P6: 31}] @00370 4:[{P13: 2}, {P15: 20}, {P6: 31}, {P11: 31}] 600380 3:[{P15: 20}, {P6: 31}, {P11: 31}] @00390 3:[{P6: 31}, {P11: 31}, {P15: 10}] @08480 3:[{P11: 31}, {P15: 10}, {P6: 21}] @08410 3:[{P15: 10}, {P6: 21}, {P11: 21}] @08420 2:[{P6: 21}, {P11: 21}] @08430 2:[{P11: 21}, {P6: 11}] @08440 2:[{P6: 11}, {P11: 11}] @00450 2:[{P11: 11}, {P6: 1}] @08460 2:[{P6: 1}, {P11: 1}] @08470 1:[{P11: 1}] Simulation ended at 00480. 11 Processes were completed in 47 time slices. 2. Round-Robin Simulation 2.1. Problem Description We reviewed a Round-Robin strategy for effectively sharing processes on a single CPU. In the starting code, the number of initial processes was fixed and additional processes were added randomly. You are to enhance this program to read a series of instructions for the introduction of processes at specific launch times. The instruction format follows: AT ADD where and are in milliseconds. Both are integers. The instructions will come in order of increasing . Do not assume that the first process will start at time 0. The last instruction will be simply DONE. Simulate the Operating System scheduling starting at simulation time 0 milliseconds. Use a time slice of 10 milliseconds. Before executing the next time slice, add any/all processes that should have started at or before the current time to the end of the active list of processes. For example: Instructions: AT O ADD Process1 64 AT 12 ADD Process2 35 AT 20 ADD Process3 47 AT 38 ADD Process4 16 DONE Execution trace: @00010 0:[] @00010 Added new Process Process1: 64} @00020 1:[{Process1: 54}] @00020 Added new Process {Process2: 35} @00020 Added new Process {Process3: 47} @00030 3:[{Process2: 35}, {Process3: 47}, {Process1: 44}] 200040 3:[{Process3: 47}, {Process1: 44}, {Process2: 25}] 200040 Added new Process {Process4: 16} When all the processes have completed execution, print the number of time slices and the completion time (in milliseconds). Your output must include the names of all the team members. A sample set of commands is available in ProcessSequence1.txt. The output is shown below in Required Output. Your program will be tested with this input and several others so test it well. 2.2. Notes Start with the partially implemented code found with this assignment: CircularlyLinkedList.java Process.java Round RobinSimulation.java You will not need to modify CircularlyLinkedList.java or Process.java. Turn in only your modified source file: AdvRoundRobinSimulation.java. Make sure your class is not in a package (that is, it is in the default package). 2.3. Required Main Class AdvRoundRobinSimulation 2.4. Required Input A series of user entered process instructions as described in the Problem Description. Read the input until the instruction DONE is seen. 2.5. Required Output For the instruction file ProcessSequence1.txt, your output should look like the following (input is in GREEN). Round Robin Simulation - Team Member 1, Team Member 2, Team Member 3, ... AT 4 ADD P1 64 AT 12 ADD P2 35 AT 20 ADD P3 47 AT 38 ADD P4 16 AT 49 ADD P5 12 AT 50 ADD P6 81 AT 140 ADD P11 71 AT 142 ADD P12 24 AT 143 ADD P13 32 AT 157 ADD P14 9 AT 345 ADD P15 20 DONE @00010 :[1] 200010 Added new Process {P1: 64} @00020 1:[{P1: 54}] @00020 Added new Process {P2: 35} @00020 Added new Process {P3: 47} @00030 3:[{P2: 35}, {P3: 47}, {P1: 44}] W00040 3:[{P3: 47}, {P1: 44}, {P2: 25}] @00040 Added new Process {P4: 16} 200050 4:[{P1: 44}, {P2: 25}, {P4: 16}, {P3: 37}] @00050 Added new Process {P5: 12} @00050 Added new Process {P6: 81} 200060 6:[{P2: 25}, {P4: 16}, {P3: 37}, {P5: 12}, {P6: 81}, {P1: 34}] @00070 6:[{P4: 16}, {P3: 37}, {P5: 12}, {P6: 81}, {P1: 34}, {P2: 15}] @00080 6:[{P3: 37}, {P5: 12}, {P6: 81}, {P1: 34}, {P2: 15}, {P4: 6}] 200090 6:[{P5: 12}, {P6: 81}, {P1: 34}, {P2: 15}, {P4: 6}, {P3: 27}] @00100 6:[{P6: 81}, {P1: 34}, {P2: 15}, {P4: 6}, {P3: 27}, {P5: 2}] @00110 6:[{P1: 34}, {P2: 15}, {P4: 6}, {P3: 27}, {P5: 2}, {P6: 71}] @00120 6:[{P2: 15}, {P4: 6}, {P3: 27}, {P5: 2}, {P6: 71}, {P1: 24}] @00130 6:[{P4: 6}, {P3: 27}, {P5: 2}, {P6: 71}, {P1: 24}, {P2: 5}] 200140 5:[{P3: 27}, {P5: 2}, {P6: 71}, {P1: 24}, {P2: 5}] @00140 Added new Process {P11: 71} @00150 6:[{P5: 2}, {P6: 71}, {P1: 24}, {P2: 5}, {P11: 71}, {P3: 17}] @00150 Added new Process {P12: 24} @00150 Added new Process {P13: 32} @00160 7:[{P6: 71}, {P1: 24}, {P2: 5}, {P11: 71}, {P3: 17}, {P12: 24}, {P13: 32}] @00160 Added new Process {P14: 9} @00170 8:[{P1: 24}, {P2: 5}, {P11: 71}, {P3: 17}, {P12: 24}, {P13: 32}, {P14: 9}, {P6: 61}] 200180 8:[{P2: 5}, {P11: 71}, {P3: 17}, {P12: 24}, {P13: 32}, {P14: 9}, {P6: 61}, {P1: 14}] @00190 7:[{P11: 71}, {P3: 17}, {P12: 24}, {P13: 32}, {P14: 9}, {P6: 61}, {P1: 14}] @00200 7:[{P3: 17}, {P12: 24}, {P13: 32}, {P14: 9}, {P6: 61}, {P1: 14}, {P11: 61}] 200210 7:[{P12: 24}, {P13: 32}, {P14: 9}, {P6: 61}, {P1: 14}, {P11: 61}, {P3: 7}] @00220 7:[{P13: 32}, {P14: 9}, {P6: 61}, {P1: 14}, {P11: 61}, {P3: 7}, {P12: 14}] @00230 7:[{P14: 9}, {P6: 61}, {P1: 14}, {P11: 61}, {P3: 7}, {P12: 14}, {P13: 22}] @00240 6:[{P6: 61}, {P1: 14}, {P11: 61}, {P3: 7}, {P12: 14}, {P13: 22}] @00250 6:[{P1: 14}, {P11: 61}, {P3: 7}, {P12: 14}, {P13: 22}, {P6: 51}] 200260 6:[{P11: 61}, {P3: 7}, {P12: 14}, {P13: 22}, {P6: 51}, {P1: 4}] @00270 6:[{P3: 7}, {P12: 14}, {P13: 22}, {P6: 51}, {P1: 4}, {P11: 51}] @00280 5:[{P12: 14}, {P13: 22}, {P6: 51}, {P1: 4}, {P11: 51}] @00290 5:[{P13: 22}, {P6: 51}, {P1: 4}, {P11: 51}, {P12: 4}] @00300 5:[{P6: 51}, {P1: 4}, {P11: 51}, {P12: 4}, {P13: 12}] 200310 5:[{P1: 4}, {P11: 51}, {P12:4}, {P13: 12}, {P6: 41}] @00320 4:[{P11: 51}, {P12: 4}, {P13: 12}, {P6: 41}] 200330 4:[{P12: 4}, {P13: 12}, {P6: 41}, {P11: 41}] @00340 3:[{P13: 12}, {P6: 41}, {P11: 41}] @00350 3:[{P6: 41}, {P11: 41}, {P13: 2}] @00350 Added new Process {P15: 20) 200360 4:[{P11: 41}, {P13: 2}, {P15: 20}, {P6: 31}] @00370 4:[{P13: 2}, {P15: 20}, {P6: 31}, {P11: 31}] 600380 3:[{P15: 20}, {P6: 31}, {P11: 31}] @00390 3:[{P6: 31}, {P11: 31}, {P15: 10}] @08480 3:[{P11: 31}, {P15: 10}, {P6: 21}] @08410 3:[{P15: 10}, {P6: 21}, {P11: 21}] @08420 2:[{P6: 21}, {P11: 21}] @08430 2:[{P11: 21}, {P6: 11}] @08440 2:[{P6: 11}, {P11: 11}] @00450 2:[{P11: 11}, {P6: 1}] @08460 2:[{P6: 1}, {P11: 1}] @08470 1:[{P11: 1}] Simulation ended at 00480. 11 Processes were completed in 47 time slices