Vous êtes sur la page 1sur 14

Process Scheduling

Abhishek Nagar

Process Scheduling

-Abhishek Nagar

Agenda
Introduction The Basics (Keywords) Scheduling Policies Scheduling Algorithms
First Come First Served Shortest Job First Round Robin Priority

Process Scheduling

-Abhishek Nagar

Introduction
In multiprogramming systems, when there is more than one ready process, the operating system must decide which one to activate. The decision is made by the part of the operating system called the scheduler, using a scheduling algorithm.

The scheduler is concerned with deciding policy, not providing a mechanism

Process Scheduling

-Abhishek Nagar

The Basics (Keywords)

Process CPU Burst (Usage Time) Turnaround Time Waiting Time Time Quantum (time slice)

Process Scheduling

-Abhishek Nagar

Scheduling Policies

Preemptive Non Preemptive

Process Scheduling

-Abhishek Nagar

First Come First Served

FCFS, also known as First-In-First-Out (FIFO), is the simplest scheduling policy. Arriving jobs are inserted into the tail (rear) of the ready queue and the process to be executed next is removed from the head (front) of the queue.

Process Scheduling

-Abhishek Nagar

FCFS - Example
Process
Process CPU Turnaround Waiting Burst Time Time A 10 10 0 B 1 11 10 C 3 14 11 D 4 18 14 13.25 8.75 AVERAGE

D C B A
5
Process Scheduling

10

15

20

25

Time
-Abhishek Nagar

Shortest Job First

SJF policy selects the job with the shortest (expected) processing time first. Shorter jobs are always executed before long jobs. long running jobs may starve, because the CPU has a steady supply of short jobs.

Process Scheduling

-Abhishek Nagar

Shortest Job First - Example


Process
Process CPU Turnaround Waiting Burst Time Time A 10 18 8 B 1 1 0 C 3 4 1 D 4 8 4 7.75 3.25 AVERAGE

D C B A
5
Process Scheduling

10

15

20

25

Time
-Abhishek Nagar

Round Robin

RR reduces the penalty that short jobs suffer with FCFS by preempting running jobs periodically. The CPU suspends the current job when the reserved quantum (time-slice) is exhausted. The job is then put at the end of the ready queue if not yet completed.

Process Scheduling

-Abhishek Nagar

Round Robin - example


Process
Time Slice = 1 Process CPU Turnaround Waiting Burst Time Time A 10 18 8 B 1 2 1 C 3 9 6 D 4 12 6 10.25 5.75 AVERAGE

D C B A

5 10 15 20 25 Time Ready Queue Status : A B C D A C D A C D A D A


Process Scheduling -Abhishek Nagar

Priority

Each process is assigned a priority. The ready list contains an entry for each process ordered by its priority. The process at the beginning of the list (highest priority) is picked first. A variation of this scheme allows preemption of the current process when a higher priority process arrives.

Process Scheduling

-Abhishek Nagar

Priority - Example
Process Priority

Process

A B C D

CPU Turnaround Waiting Burst Time Time 4 10 18 8 3 1 8 7 2 3 7 4 1 4 4 0 9.25 4.75 AVERAGE

D C B A
5
Process Scheduling

10

15

20

25

Time
-Abhishek Nagar

Thank You !

Questions and Comments Welcome! Abhishek Nagar abhishek@nagarji.net


Process Scheduling Simulation from gaia.ecs.csus.edu
Process Scheduling -Abhishek Nagar

Vous aimerez peut-être aussi