Consider the following jobs: Job # Arrival time Run time A05 B24 C35 D53

Job # Arrival time Run time
A05
B24
C35
D53
a)      Using the SJF method, compute the completion times of the above jobs, average turn around time and average waiting time.
b)     Using the SRTF (Shortest Remaining Time first) method, compute the the completion times of the above jobs, the average turn around time and the average waiting time. Note that SRTF is SJF with preemption. Completion time - arrival time = turnaround time
c)       Using the Round Robin method (with Quantum = 2), compute the completion times of the above jobs and the average waiting time.
Ans;) a) Using the SJF (shortest-job-first shcheduling) alogirithm. We would schedule these processes according to the following Gantt chart.
5345
ADBC
05 8 12 17
Completion time for process A = 5
Completion time for process B =12
Completion time for process c = 17
Completion time for process D = 8
Turn around time = T(completion) - T(Arrival)
Turnaround time for process A = 5-0 = 5 mr
Turnaround time for process B = 12-2 = 10 mr
Turnaround time for process A=17-3 = 14mr
Turnaround time for process A=8-5 = 3mr
Total Turnaround time = 5+ 10 + 14 + 3 = 32
Average turnaround time = 32/7 = 8.00 mr
Average waiting time :
Waiting time for process A = 0 mr
Waiting time for process B = 6 mr
Waiting time for process C = 9 mr
Waiting time for process D = 0 mr

Total waiting time = 0+6+9+0 = 15 Average waiting time = 15/4 = 3.75 mr
b) A preemptive SJF algorithm will pre-empt the currently executing process, whereas a non preemptive SJF algorithm will allow the currently running process to finish its CPU burst. Preemptive SJF scheduling is sometimes called shortest - remaining time - first scheduling.
It is the processes arrive at the ready queue at the times shown and need the indicated burst times, then the resulting preemptive SJF (SRTF) schedule is as depicted in the following Gantt chart.
5345
ADBC
05 8 12 17
Aboe gantt chart is some as the SJF scheduling Gantt chart. Then all the results will be same.
c)  Gantt Chart:
ABCDABCDAC
0246 8 10 12 14 15 16 17
CompletiontimeforA=16
Completion time for B= 12
Completion time for C= 17
Completion time for D =15
Average waiting time:
Waiting time for process A = 0 +6+5 = 11 mr Waiting time for process B = 0+6 = 6 mr Waiting time for process C = 1+6+4 = 11 mr Waiting time for process D = 1+6 = 7 mr Total waiting time = 11+6+11+7 = 35 Average waiting time = 35/4 = 8.75 mr.
Consider the following jobs: Job # Arrival time Run time A05 B24 C35 D53 Consider the following jobs: Job # Arrival time Run time A05 B24 C35 D53 Reviewed by enakta13 on August 28, 2012 Rating: 5

Search your question

Powered by Blogger.