Download
operating system n.
Skip this Video
Loading SlideShow in 5 Seconds..
Operating System PowerPoint Presentation
Download Presentation
Operating System

Operating System

124 Views Download Presentation
Download Presentation

Operating System

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Operating System U2M3 Lecture 4 Process Management – Scheduling Algorithms

  2. Objectives • Explain the purpose of scheduling • List scheduling Criteria • Discuss types of scheduling algorithms

  3. Scheduling Algorithm • The scheduling algorithm is a part of the operating system that • decides which processes should be running on the CPU (in what order) and for how long. • Maximizes CPU utilization – keep the CPU as busy as possible

  4. Context Switching • A context switch (a process switch / a task switch) is the switching of the CPU from one process to another

  5. Scheduling Concerns / Criteria • Throughput – Number of processes that complete their execution per time unit • Turnaround time – amount of time to execute a particular process • Waiting time – amount of time a process has been waiting in the ready queue • Response time – amount of time it takes from when a request was submitted until the first response is produced.

  6. Non-pre-emptive and pre-emptive Scheduling algorithms A non-pre-emptive (Atomic) algorithm runs a process to completion once it has the CPU. A pre-emptive algorithm gives each process a time slice (Quantum) and then switching the CPU's attention among the processes. (process switching /context switching) Each process is allowed to execute for no longer than one time slice so a job may be require many time slices.

  7. Scheduling Algorithms • First come first served (FCFS) • Shortest job first; • Round Robin ;

  8. First Come First Served(FCFS) non-pre-emptive • Processes are dispatched according to their arrival time on the ready queue. Being a non-pre-emptive discipline, once a process has a CPU, it runs to completion. • The FCFS scheduling not optimal • long jobs make short jobs wait and • unimportant jobs make important jobs wait.

  9. Shortest Job First (SJF) non-pre-emptive • Shortest-Job-First (SJF) is an algorithm in which waiting job (or process) with the smallest estimated run-time-to-completion is run next. • The SJF scheduling is especially appropriate for batch jobs for which the run times are known in advance. • SJF gives the minimum average time for a given set of processes, it is more optimal than FCFS. • The problem with SJF scheme is that it requires precise knowledge of how long a job or process will run, • not usually available. • rely on user

  10. Shortest Remaining Time First (SRTF) pre-emptive • Shortest-Remaining Time First (SRTF) algorithm is a pre-emptive version of SJF. • In which if a new process arrives with CPU burst length less than the remaining time of current executing process, the current process is pre-empted. The CPU switches to execute the new process.

  11. Round Robin pre-emptive • This scheduling policy gives each process a slice of time (i.e., one quantum) before being pre-empted. • As each process becomes ready, it joins the ready queue. • A clock interrupt is generated at periodic intervals.

  12. Round Robin pre-emptive • When the interrupt occurs, the currently running process is pre-empted, and • the oldest process in the ready queue is selected to run next. • The time interval between each interrupt may vary. • Click to see animation

  13. Overview