Presentation is loading. Please wait.

Presentation is loading. Please wait.

Process Control Management Prepared by: Dhason Operating Systems AICT004-3-2.

Similar presentations


Presentation on theme: "Process Control Management Prepared by: Dhason Operating Systems AICT004-3-2."— Presentation transcript:

1 Process Control Management Prepared by: Dhason Operating Systems AICT004-3-2

2 Operating Systems Process Control Management Slide 2 of 18 Topic & Structure of the lesson Non-preemptive algorithms Calculations using non-preemptive scheduling algorithms

3 Operating Systems Process Control Management Slide 3 of 18 Learning Outcomes At the end of this lecture YOU should be able to: - list non-preemptive scheduling algorithms - perform calculations using non-preemptive algorithms

4 Operating Systems Process Control Management Slide 4 of 18 Key Terms you must be able to use If you have mastered this topic, you should be able to use the following terms correctly in your assignments and exams: first come first serve / first in first out shortest job first priority

5 Operating Systems Process Control Management Slide 5 of 18 First Come First Serve ( FIFO / FCFS) the simplest CPU scheduling non-preemptive algorithm a process that requests for the CPU first is allocated the CPU the implementation of the FIFO policy is easily managed with a FIFO queue the average waiting time for FIFO is quite long once the CPU has been allocated for the process, the process keeps the CPU until termination or by requesting for I/O

6 Operating Systems Process Control Management Slide 6 of 18 Process Burst Time (Milliseconds) P110 P21 P32 P41 P55 0 1011 13 14 19 Step2:- Calculate waiting time and average value T W (P1) = 0 T W (P2) = 10 T W (P3) = 11 Tw(P4) = 13 Tw(P5) = 14 T W (average)=( 0+10+11+13+14)/5 = 9.6 Milliseconds Step1:- Draw a Gantt Chart to represent timings for all processes P1 P2P4P3P5 First Come First Serve ( FIFO / FCFS)

7 Operating Systems Process Control Management Slide 7 of 18 Step-3: Calculate turn-around time and average value T T = T w +T B Average turn around time is (10+11+13+14+19)/5 = (67/5) =13.4 Milliseconds T T (P2) = ( 10 + 1) = 11 T T (P3) = ( 11 + 2) = 13 T T (P4) = (13 + 1) = 14 T T (P5) = (14 + 5) = 19 T T (P1) = ( 0 + 10) = 10 First Come First Serve ( FIFO / FCFS) 0 1011 13 14 19 P1 P2P4P3P5 Process Burst Time (Milliseconds) P110 P21 P32 P41 P55

8 Operating Systems Process Control Management Slide 8 of 18 scheduling is done by examining the length of the next CPU burst of a process if the CPU is free, the next process with the smallest CPU burst time is assigned if two processes have the same CPU burst time, FIFO is used to break the tie the difficulty with SJF is to determine the length of the next process the advantage of this algorithm is that it is optimal; providing minimum average waiting time Shortest Job First (SJF)

9 Operating Systems Process Control Management Slide 9 of 18 Process Burst Time (Milliseconds) P110 P21 P32 P41 P55 0 12 19 4 9 P1P2P4P3P5 Shortest Job First (SJF) Step2:- Calculate waiting times and average value T W (P1) = 9 T W (P2) = 0 T W (P3) = 2 Tw(P4) = 1 Tw(P5) = 4 T W (average) = ( 9+0+2+1+4)/5 = 3.2 Milliseconds Step1:- Draw a Gantt Chart to represent timings for all processes

10 Operating Systems Process Control Management Slide 10 of 18 Shortest Job First (SJF) Step-3: Calculate turn-around time and average value T T = T w +T B Average turn around time is (19+1+4+2+9)/5 = (35/5)=7 Milliseconds T T (P2)=( 0 + 1) = 1 T T (P3)=( 2 + 2) = 4 T T (P4)=(1 + 1) = 2 T T (P5)=(4 + 5) = 9 T T (P1)=( 9 + 10)= 19 P1P2P4P3P5 Process Burst Time (Milliseconds) P110 P21 P32 P41 P55 0 12 19 4 9

11 Operating Systems Process Control Management Slide 11 of 18 Priority priority is associated with each process the CPU is allocated to a process with the highest priority equal priority processes are scheduled using FIFO priority can be high or low; however 0 can mean high priority can be preemptive or non-preemptive a problem with priority algorithm is starvation aging is a technique used to gradually increase the priority of a process

12 Operating Systems Process Control Management Slide 12 of 18 0 113 18 19 11 P1 P4P2P3P5 Priority Step2:- Calculate waiting time and average value T W (P1) = 1 T W (P2) = 18 T W (P3) = 11 Tw(P4) = 0 Tw(P5) = 13 T W (average)=(1+18+11+0+13)/5 = 8.6 Milliseconds Step1:- Draw a Gantt Chart to represent timings for all processes Process Burst Time (Milliseconds) Priority P1103 P211 P323 P414 P552

13 Operating Systems Process Control Management Slide 13 of 18 Step-3: Calculate turn-around times and average value T T = T w +T B Average turn around time is (11+19+13+1+18)/5 = (62/5) =12.4 Milliseconds T T (P2)=(18+1)=19 T T (P3)=(11+2)=13 T T (P4)=(0+1) = 1 T T (P5)=(13+5)=18 T T (P1)=(1+ 10)=11 113 18 0 Process Burst Time (Milliseconds) Priority P1103 P211 P323 P414 P552 19 11 Priority P1 P4P2P3P5

14 Operating Systems Process Control Management Slide 14 of 18 Quick Review Questions Name three preemptive CPU scheduling algorithms Which of the three is the easiest to implement?

15 Operating Systems Process Control Management Slide 15 of 18 Follow Up Assignment FIFO on its own is a scheduling algorithm, however FIFO is also used in other algorithms, name the algorithms. Which non-preemptive algorithm is optimal and why?

16 Operating Systems Process Control Management Slide 16 of 18 Summary of Main Teaching Points Non-preemptive CPU scheduling algorithms are FIFO, SJF and priority. SJF algorithms have a shorter average waiting time compared to FIFO and priority. Using priority scheduling may result in some processes experiencing starvation; aging a method to overcome this problem.

17 Operating Systems Process Control Management Slide 17 of 18 Q & A Question and Answer Session


Download ppt "Process Control Management Prepared by: Dhason Operating Systems AICT004-3-2."

Similar presentations


Ads by Google