1 / 17

Process Control Management

Operating Systems AICT004-3-2. Process Control Management. Prepared by: Dhason. Topic & Structure of the lesson. Non-preemptive algorithms Calculations using non-preemptive scheduling algorithms. Learning Outcomes. At the end of this lecture YOU should be able to:

anthonymann
Download Presentation

Process Control Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Topic & Structure of the lesson • Non-preemptive algorithms • Calculations using non-preemptive scheduling algorithms

  3. 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. 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. 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. First Come First Serve ( FIFO / FCFS) Step1:- Draw a Gantt Chart to represent timings for all processes P2 P3 P4 P5 P1 19 14 0 13 10 11 Step2:- Calculate waiting time and average value TW(P1) = 0 TW(P2) = 10 TW(P3) = 11 Tw(P4) = 13 Tw(P5) = 14 TW(average)=( 0+10+11+13+14)/5 = 9.6 Milliseconds

  7. First Come First Serve ( FIFO / FCFS) Step-3: Calculate turn-around time and average value P2 P3 P4 P5 P1 19 14 0 13 10 11 TT = Tw+TB TT(P1) =( 0 + 10) = 10 TT(P2) =( 10 + 1) = 11 TT(P3) =( 11 + 2) = 13 TT(P4) =(13 + 1) = 14 TT(P5) =(14 + 5) = 19 Average turn around time is (10+11+13+14+19)/5 = (67/5) =13.4 Milliseconds

  8. Shortest Job First (SJF) • 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

  9. Shortest Job First (SJF) Step1:- Draw a Gantt Chart to represent timings for all processes P2 P4 P3 P5 P1 Step2:- Calculate waiting times and average value TW(P1) = 9 TW(P2) = 0 TW(P3) = 2 Tw(P4) = 1 Tw(P5) = 4 TW(average) = ( 9+0+2+1+4)/5 = 3.2 Milliseconds 0 1 2 9 19 4

  10. Shortest Job First (SJF) Step-3: Calculate turn-around time and average value TT = Tw+TB P2 P4 P3 P5 P1 0 1 2 9 19 4 TT(P1)=( 9 + 10)= 19 TT(P2)=( 0 + 1) = 1 TT(P3)=( 2 + 2) = 4 TT(P4)=(1 + 1) = 2 TT(P5)=(4 + 5) = 9 Average turn around time is (19+1+4+2+9)/5 = (35/5)=7 Milliseconds

  11. 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. Priority Step1:- Draw a Gantt Chart to represent timings for all processes P4 P1 P3 P5 P2 1 13 0 11 18 19 Step2:- Calculate waiting time and average value TW(P1) = 1 TW(P2) = 18 TW(P3) = 11 Tw(P4) = 0 Tw(P5) = 13 TW(average)=(1+18+11+0+13)/5 = 8.6 Milliseconds

  13. Priority Step-3: Calculate turn-around times and average value P4 P1 P3 P5 P2 1 13 0 11 18 19 TT = Tw+TB TT(P1)=(1+ 10)=11 TT(P2)=(18+1)=19 TT(P3)=(11+2)=13 TT(P4)=(0+1) =1 TT(P5)=(13+5)=18 Average turn around time is (11+19+13+1+18)/5 = (62/5) =12.4 Milliseconds

  14. Quick Review Questions • Name three preemptive CPU scheduling algorithms • Which of the three is the easiest to implement?

  15. 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. 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. Question and Answer Session Q & A

More Related