Refer to the following table of processes and respective run
Solution
Given processing times are:
P1: 2
P2: 1
P3: 4
P4: 5
P5: 8
FCFS:
As all the processes came at a time at time 0, FCFS go with the queue ordering.
Response time is the time required by a process once it enters the READY queue, how long
it has to wait to enter the RUN state for the first time.
So, P1 will not have to wait at all. So, P1 has 0 response time.
P2 will have to wait till P1 finishes. So, P2 has 2 response time.
P3 will have to wait till P2 finishes. So, P3 has 3 response time.
P4 will have to wait till P3 finishes. So, P4 has 7 response time.
P5 will have to wait till P4 finishes. So, P2 has 12 response time.
SJF:
In the shortest job first, The job with the shortest burst time will be put into run state.
And once it is kept into run state, it will run to completion.
So, the jobs will be executed in the order: P2, P1, P3, P4, and P5.
So, P2 will not have to wait at all. So, P2 has 0 response time.
P1 will have to wait till P2 finishes. So, P1 has 1 response time.
P3 will have to wait till P1 finishes. So, P3 has 3 response time.
P4 will have to wait till P3 finishes. So, P4 has 7 response time.
P5 will have to wait till P4 finishes. So, P5 has 12 response time.
RR:
In Round Robin technique, each process is given a time quantum, and once the assigned time
quantum exhausts, the processor will be pre-empted by the next process in ready state.
So, the jobs will be executed as the order they were in the ready queue for the first time.
Given this algorithm assumes the quantum slice of 2 units.
So, P1 will not have to wait at all. So, P1 has 0 response time.
P2 will have to wait for 2 units of time. So, P2 has 2 response time.
P3 will have to wait for 1 unit(Note that P2 will finish off before its time quantum exhausts.).
So, P3 has 3 response time.
P4 will have to wait for 2 units of time. So, P4 has 5 response time.
P5 will have to wait for 2 units of time. So, P5 has 7 response time.
TICKTOCK:
As specified this algorithm executes based on priority, and the given priorities are:
P1 = 3, P2 = 1, P3 = 4, P4 = 2, P5 = 3. And the larger the number, the higher the priority.
And the processes will run to completion once enters into running state.
So, the processes will be executed in the order: P3, P1, P5, P4, P2.
Note that P1, and P5 has the same priority, and can be selected at random.
So, P3 will not have to wait at all. So, P3 has 0 response time.
P1 will have to wait till P3 finishes. So, P1 has 4 response time.
P5 will have to wait till P1 finishes. So, P5 has 6 response time.
P4 will have to wait till P5 finishes. So, P4 has 14 response time.
P2 will have to wait till P4 finishes. So, P2 has 19 response time.
