Process scheduling

Post on 15-Jul-2015

242 views 4 download

Tags:

Transcript of Process scheduling

CONTENT…

INTRODUTION

OF

PROCESS

SCHEDULERS

PROCEES

SCHEDULER

A series of action or steps taken in order to

achieve a particular end.

A program that arranges computer’s operation

into an appropriate sequence.

A machine that organizes or maintain schedulers.

A process is a program during execution

PROCESS SCHEDULER

INTRODUCTION:

Multiprogramming is to have some process running at all times, to Maximum CPU

Utilization. To meet these objectives, the Process Scheduler selects available process

for a program execution of the CPU.

For a single-processor system, there will never be more than one running process, if

there are more processes, the rest will have to wait until the CPU is free and can be

Rescheduled.

A process migrates among the various scheduling queues throughout its lifetime. The

operating system must select, for scheduling purpose, processes from these queues in

some fashion. The selection process is carried out by the appropriate Scheduler.

Often, in Batch System, more processes are submitted than can be executed

immediately. These processes are spooled to a mass-storage device(Disk), where

they are kept for later execution.

The Long-term scheduler, or Job scheduler, selects processes from this pool and

loads them into memory for execution.

Whenever the CPU becomes IDLE the operating system must select one of the

processes in the Ready Queue to be executed.

The Short-term scheduler, or CPU scheduler, selects from among the processes that

are ready to execute and allocates the CPU to one of them.

STATE OF PROCESS

Start/New

Ready

Execution/Running

Waiting

Swapped

Terminate

start Terminated

Diagram of process state

Start to Ready= Long Term Scheduler

Ready to Running= Mid Term Scheduler

Running to Waiting or waiting to ready= Short Term Scheduler

Process Control Block(PCB):-

TYPES OF PROCESS SCHEDULERS……

S.NO TYPES

1 Process Scheduler/CPU Scheduler 1.) Preemptive

2.) Non-Preemptive

2 Long- Term Scheduler

3 Medium- Term Scheduler

4 Short-Term Scheduler

5 Dispatcher

Process Scheduler /CPU Scheduler

Process scheduler is a part of the operating system that decides which process

runs at a certain point in time.

When CPU becomes idle the OS must select one of the processes in Ready Queue to be

executed

CPU Scheduler selects a process from the processes in memory that are ready to execute

(from Ready queue),allocates the CPU to one of them

CPU scheduling decisions may take place when a process:

Switches from running to waiting state

Terminates

Switches from running to ready state. (e.g. when time slice of a process expires or an

interrupt occurs)

Switches from waiting to ready state. (e.g. on completion of I/O)

On arrival of a new process

The OS code that implements the CPU scheduling algorithm is known as CPU scheduler

In Pre-emptive scheduling the currently running process may be interrupted and moved to the ready state by OS (forcefully)

In Non-preemptive Scheduling, the running process can only lose the processor voluntarily by terminating or by requesting an I/O. OR, Once CPU given to a process it cannot be preempted until the process completes its CPU burst

Pre-emptive scheduling & Non-preemptive scheduling

Long Term Scheduler

Determines which programs are admitted to the

system for processing

Controls the degree of multiprogramming

More processes, smaller percentage of time each

process is executed

Medium Term Scheduler

Part of the swapping function

Based on the need to manage the degree

of multiprogramming

Short Term Scheduling

Known as the dispatcher

Executes most frequently

Invoked when an event occurs

Clock interrupts

I/O interrupts

Operating system calls

Scheduling Criteria

Maximum Utilization of CPU

Waiting time should be minimum

Turn around time should be minimum

Response time should be minimum

Arrival time should be minimum

Note:- Total time taken by the process is called Turn around time.