Process scheduling

9
Process Scheduling Baljit Singh Saini

Transcript of Process scheduling

Page 1: Process scheduling

Baljit Singh Saini

Process Scheduling

Page 2: Process scheduling

Baljit Singh Saini

When CPU becomes idle which scheduler is invoked?

Short Term schedulerWhat it does?Selects one process from ready queue for

execution

Page 3: Process scheduling

Baljit Singh Saini

CPU-scheduling decision circumstances1. Process switches from running state to waiting state.2. Process switches from running state to ready state.3. Process switches from waiting state to ready state.4. Process terminates.

1 and 4 are Non-Preemptive.2 and 3 are Preemptive.Non-Preemptive scheduling – once the CPU has been allocated to a process, the process keeps the CPU until it releases the CPU either by terminating or by switching to the waiting state.

Page 4: Process scheduling

Baljit Singh Saini

DispatcherGives control of the CPU to the process.It involves

Context switchingSwitching to user modeJumping to the proper location in the user

program to restart that process.

Dispatch Latency : time taken to stop one process and start another process.

Page 5: Process scheduling

Baljit Singh Saini

Scheduling CriteriaCPU utilization – high (40-90%)Throughput – number of process completed per unit timeTurnaround time – interval from time of submission to the

time of completion.Waiting time – time spent in the waiting in the ready

queue.Response time – time from the submission until the first

response is produced.

Maximize – CPU utilization and throughputMinimize – turnaround, waiting and response time

Page 6: Process scheduling

Baljit Singh Saini

Predicting Burst Time in SJFSJF is used for Long Term SchedulerCan not be used with STS because it is difficult to know

the length of next CPU burstPredict:

= length of the nth CPU burst = predicted value of next CPU burst0 <= <=1 contains most recent information contains the past history

𝜏 𝑛+1=𝛼𝑡𝑛+(1−𝛼)𝜏𝑛

Page 7: Process scheduling

Baljit Singh Saini

If =0, then recent history has no effectIf =1, then only the most recent CPU burst

mattersGenerally =1/2 is defined as constant or an overall system

average.

𝜏 𝑛+1=𝛼𝑡𝑛+(1−𝛼)𝜏𝑛

Page 8: Process scheduling

Baljit Singh Saini

IssuesFCFS – convoy effectPriority – Starvation

Solution - AgingRR – Time Quantum

Page 9: Process scheduling

Baljit Singh Saini

ReferencesSilberschatz, Abraham, et al. Operating

system concepts. Edition-8. Reading: Addison-Wesley.

Note : For more details on all the concepts mentioned here refer to the above listed book.