In: Computer Science
The following table lists the characteristics of three processes that require service in a time-sharing system Assume that no time is required to choose the next process and perform a context switch. For each algorithm, show the process that is running in each time interval
| 
 Process Name  | 
 Arrival Time  | 
 Burst/CPU Time  | 
 Priority  | 
 Start Time  | 
 End Time  | 
 Turnaround (TA) Time  | 
 WTA  | 
 Wait  | 
| 
 P1  | 
 2  | 
 8  | 
 1  | 
|||||
| 
 P2  | 
 4  | 
 5  | 
 4  | 
|||||
| 
 P3  | 
 6  | 
 2  | 
 3  | 
| p4 | 3 | 4 | 2 | 
d) Preemptive Shortest Job First (Shortest Remaining Time
First (SRTF))
| 
 Time  | 
 0  | 
 1  | 
 2  | 
 3  | 
 4  | 
 5  | 
 6  | 
 7  | 
 8  | 
 9  | 
 10  | 
 11  | 
 12  | 
 13  | 
 14  | 
 15  | 
 16  | 
 17  | 
 18  | 
 19  | 
 20  | 
 21  | 
| 
 Process  | 
d) Priority Scheduling (PRI): Preemptive
| 
 Time  | 
 0  | 
 1  | 
 2  | 
 3  | 
 4  | 
 5  | 
 6  | 
 7  | 
 8  | 
 9  | 
 10  | 
 11  | 
 12  | 
 13  | 
 14  | 
 15  | 
 16  | 
 17  | 
 18  | 
 19  | 
 20  | 
 21  | 
| 
 Process  | 
d) Round Robin: Time Quantum =2, context switch =1.
| 
 Time  | 
 0  | 
 1  | 
 2  | 
 3  | 
 4  | 
 5  | 
 6  | 
 7  | 
 8  | 
 9  | 
 10  | 
 11  | 
 12  | 
 13  | 
 14  | 
 15  | 
 16  | 
 17  | 
 18  | 
 19  | 
 20  | 
 21  | 
| 
 Process  | 
In case of any queries, please revert back. I will solve them ASAP. PS. Experts dont know when a question was posted. We solve it as soon as we see it.
| Process Name | Arrival Time | Burst Time | Priority | 
| P1 | 2 | 8 | 1 | 
| P2 | 4 | 5 | 4 | 
| P3 | 6 | 2 | 3 | 
| P4 | 3 | 4 | 2 | 
A.) Shortest Remaining Time First(Shortest Job first that is Preemptive) :-
1. This first process Comes at Time 2. So, till then, the CPU is empty.
2. Now P1 arrives and has Shortest Remaining time of 8 seconds. So, it goes at time=2
3. However at time = 3, P4 arrives and preempts P1. P1 now has 7 seconds left. P4 enters CPU at t=3
4. When P2 enter at t=4, P4 has remaining 3 seconds and so P2 waits at it has burst time of 5.
5. At t=6, P3 enters and sees that it has burst time of 2, but P4 has only 1 second left. So, it waits 1 second.
6. At t=7, P3 enters with shortest burst time. At t=8, P2 enters with burst time of 5. At t=14, P1 enters.
| T | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 
| P | - | - | P1 | P4 | P4 | P4 | P4 | P3 | P3 | P2 | P2 | P2 | P2 | P2 | P1 | P1 | P1 | P1 | P1 | P1 | P1 | - | 
B.) Priority Scheduling Preemtive :-
1. This first process Comes at Time 2. So, till then, the CPU is empty.
2. Now P1 arrives and is only process so enters. It has priority 1 which is highest and so first completes and leaves at t=9. rest processes arrive and wait.
3. Next according to priority is P4, then P3 and then P2
| T | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 
| P | - | - | P1 | P1 | P1 | P1 | P1 | P1 | P1 | P1 | P4 | P4 | P4 | P4 | P3 | P3 | P2 | P2 | P2 | P2 | P2 | - | 
C.) Round Robin. Time Quantum = 2.
Job is changed every 2 seconds,
1. P1 executes for 2 seconds. Now at t=4, there are P4 and P2. P4 enters then P2. At t=6, P3 has joined.
Then robin goes like P1[6],P4[2],P2[3].
P1[4], P2[1]
P1[2]
| T | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 
| P | - | - | P1 | P1 | P4 | P4 | P2 | P2 | P3 | P3 | P1 | P1 | P4 | P4 | P2 | P2 | P1 | P1 | P2 | P1 | P1 | - |