Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPU Algorithm Turnaround time :- Amount of time to execute a particular process. Waiting time – amount of time a process has been waiting in the ready.

Similar presentations


Presentation on theme: "CPU Algorithm Turnaround time :- Amount of time to execute a particular process. Waiting time – amount of time a process has been waiting in the ready."— Presentation transcript:

1

2 CPU Algorithm Turnaround time :- Amount of time to execute a particular process. Waiting time – amount of time a process has been waiting in the ready queue Throughput – No. of processes that complete their execution per time unit Average waiting time :- Average waiting time of all the process

3 Criteria's to be used Turnaround time = CPU Burst Time + Waiting time Waiting time = Turnaround time - CBT Average waiting time= Waiting time / count of total processes Throughput time = Total burst time / total count of processes

4 Example Process Burst time 0 80 1 20 2 10 3 20 4 50

5 Gantt Chart

6 Turnaround time for process p3 CPU burst time + waiting time = 80 + 20 + 10 + 20 = 130.

7 Waiting time for all the processes Waiting Time = Turnaround time – CBT For p3 130 - 20 = 110 Waiting Time for process p0 = 0 sec. Waiting Time for process p1 = 80 sec. Waiting Time for process p2 = 100 sec. Waiting Time for process p3 = 110 sec. Waiting Time for process p4 = 130 sec.

8 Average waiting time Hence the average waiting time = (0+80+100+110+130)/5 = 84 ms.

9 Throughput time Throughput time = Total burst time / total count of processes = 180/5 = 36 Milliseconds

10 Example 2 Process Burst time 0 80 1 20 2 10 3 20 4 50 Arrival time = 0

11 Exercise Use SJF Create a Gantt chart illustrating the execution of these processes? What is the turnaround time for process p4? What is the average wait time for the processes?

12 Gantt Chart

13 Turnaround time for process P4 The turnaround time for process P4 is = 100. 10+20+20+50

14 Average Waiting time Waiting time of po+p1+p2+p3+p4 (100+10+0+30+50)/5 = 38 ms

15 Example 3 pCBT Arrival Time 0 80 0 1 20 10 2 10 10 3 20 80 4 50 85 Draw gantt chart using SJF NON-Preemeptive

16 Excercise a. Suppose a system uses RR scheduling Quantum of 15. Create a Gantt chart illustrating the execution of these processes? b. What is the turnaround time for process p3? c. What is the average wait time for the processes?

17 Gantt Chart pCBT Arrival Time 0 80 0 1 20 10 2 10 10 3 20 80 4 50 85

18 Turnaround time for process P3 The turnaround time for process P3 is =160-80 = 80 sec.

19 Waiting time Waiting time for process p0 = 0 sec. Waiting time for process p1 = 5 sec. Waiting time for process p2 = 20 sec. Waiting time for process p3 = 30 sec. Waiting time for process p4 =4 0 sec.

20 Average waiting time average waiting time is (0+5+20+30+40)/5 = 22 sec.

21

22 Do it Yourself pCBT priorityArrival Time 0 80 00 1 20 100 2 10 100 3 20 800 4 50 850

23 Calculate turnaround time of p3 for FCFS, SJF, RR(Quantum =10), Priority Waiting time for each process for each FCFS,SJF,RR,Priority


Download ppt "CPU Algorithm Turnaround time :- Amount of time to execute a particular process. Waiting time – amount of time a process has been waiting in the ready."

Similar presentations


Ads by Google