26
GUIDED BY: MR. VENKATESWARAN.R ( ASST. PROFESSOR M.TECH) CREATED BY: VINOTH.J SARAVANA KUMAR.R KARTHICK SEKAR.S ASIR ALLOSANAI GANA SEKAR MUTHURAMALINGAM.E MUNEESWARAN.M INFANT JESUS COLLEGE OF ENGINEERING CPU SCHEDULING

Cpu scheduling

Embed Size (px)

Citation preview

Page 1: Cpu scheduling

G U I D E D B Y:M R . V E N KAT E S WA R A N. R ( A S S T . P R O F E S S O R M . T E C H )

C R E AT E D B Y:V I N O T H . JS A R AVA N A KU M A R . RKA R T H I C K S E KA R . SA S I R A L L O S A N A I G A N A S E KA RM U T H U R A M A L I N G A M . EM U N E E S WA R A N. M

I N FA N T J E S U S C O L L E G E O F E N G I N E E R I N G

CPU SCHEDULING

Page 2: Cpu scheduling

OVERVIEW

Basic ConceptsScheduling Criteria Scheduling AlgorithmsMultiple-Processor SchedulingOperating Systems Examples

Page 3: Cpu scheduling

OVERVIEW

In computer science, scheduling is the method by which threads, processes or data flows are given access to system resources (e.g. processor time, communications bandwidth). This is usually done to load balance a system effectively or achieve a target quality of service.

Page 4: Cpu scheduling

OVERVIEW

Throughput: No of processes that complete the execution

per unit timeResponse time: Amount of time it takes

from when a request was submitted until the first response is produced

Waiting time:Amount of time a process has been waiting in the ready queue Response time = waiting time + execution time

Page 5: Cpu scheduling

Types of scheduling methods

Preemptive scheduling:A higher priority process can preempt a currently running low priority process to avoid priority inversion

Nonpreemptive scheduling:A higher priority process waits a currently running process to finish regardless of the priority e.g., FCFS

Page 6: Cpu scheduling

Types of scheduling methods

Long and medium term schedulingLong term scheduling: which determines which

programs are admitted to the system for execution and when, and which ones should be exited.

Medium term scheduling: which determines when processes are to be suspended and resumed;

Short term scheduling (or dispatching): which determines which of the ready processes can have CPU resources, and for how long.

Page 7: Cpu scheduling

Single Processor Scheduling Algorithms

First Come, First Served (FCFS) Shortest Job First (SJF) Priority Round Robin (RR)

Page 8: Cpu scheduling

First Come, First Served (FCFS)

First Come, First Served (FCFS), is the simplest scheduling algorithm, FIFO simply queues processes in the order that they arrive in the ready queue.

Throughput can be low, since long processes can hold the CPU

It is based on QueuingNo prioritization occurs, thus this system has

trouble meeting process deadlines.

Page 9: Cpu scheduling

Example

Page 10: Cpu scheduling

MERITS AND DEMERITS

MERITS:Easy to understand and easy to program

It is fairDEMERITS:Does not perform well in real systemsIgnores the service time request and all other

criteria

Page 11: Cpu scheduling

Shortest-Job-First (SJR) Scheduling

1.  non preemptive – once CPU given to the process it cannot be preempted until completes its CPU burst.

2. preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is know as the Shortest-Remaining-Time-First (SRTF).

SJF is optimal – gives minimum average waiting time for a given set of processes.

Page 12: Cpu scheduling

Example

Page 13: Cpu scheduling

MERITS AND DEMERITS

MERITS:SJF is optimal – gives minimum average

waiting time for a given set of processes DEMERITS:Need to have a good heuristic to guess the

next CPUexecution timeShort duration processes will starve longer

ones

Page 14: Cpu scheduling

Priority Scheduling

The SJF algorithm is a special case of the general priority scheduling algorithm

 A priority number (integer) is associated with each process

 The CPU is allocated to the process with the highest priority (smallest integer = highest priority)

 

Page 15: Cpu scheduling

Example

Page 16: Cpu scheduling

MERITS AND DEMERITS

MERITS:SimplicityReasonable support for priority.

Suitable for applications with varying time and resource requirements.

DEMERITS:Indefinite blocking or starvation.

A priority scheduling can leave some low priority waiting processes indefinitely for CPU.

Page 17: Cpu scheduling

Round Robin (RR)

Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds. After this time  has elapsed, the process is preempted and added to the end of the ready queue.

Performance        1. q large _ FIFO        2. q small _ q must be large with respect

to context switch, otherwise overhead is too high.

 

Page 18: Cpu scheduling

Example

Page 19: Cpu scheduling

MERITS AND DEMERITS

MERITS:Fair allocation of CPU across jobsLow average waiting time when job lengths varyDEMERITS:It is suitable for task with varied burst time. But for

task with same time makes trouble.

Page 20: Cpu scheduling

Multilevel Queue Scheduling

Page 21: Cpu scheduling

Multilevel Feedback Queue

A process can move between the various queues;

Multilevel-feedback-queue scheduler defined by the following parameters:

   1. number of queues   2. scheduling g algorithms for each queue

Page 23: Cpu scheduling

Multiprocessor Scheduling

'' On a multiprocessor, scheduling is two dimensional. The scheduler has to decide which process to run and which CPU to run it on. This extra dimension greatly complicates scheduling on multiprocessors.

Page 24: Cpu scheduling

OPERATING SYSTEM EXAMPLES

WindowsVery early MS-DOS and Microsoft Windows

systems were non-multitasking, and as such did not feature a scheduler. Windows 3.1x used a non-preemptive scheduler, meaning that it did not interrupt programs.

Page 25: Cpu scheduling

OPERATING SYSTEM EXAMPLES

Mac OSMac OS 9 uses cooperative scheduling for

threads, where one process controls multiple cooperative threads, and also provides preemptive scheduling for MP tasks.

Page 26: Cpu scheduling

 CONCLUSION

The above mentioned are the various CPU scheduling used in the present day. These algorithms are inherited based on the recuirement of the processor.