1 / 13

Operating System

Operating System. U2M3 Lecture 4 Process Management – Scheduling Algorithms. Objectives. Explain the purpose of scheduling List scheduling Criteria Discuss types of scheduling algorithms. Scheduling Algorithm. The scheduling algorithm is a part of the operating system that

lucky
Download Presentation

Operating System

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 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

More Related