You are on page 1of 13

PROCESS SCHEDULING

LECTURE 8

Process Scheduling - Lecture 8 1


The Life-Cycle of a Process (Process State Transitions)

The Life-Cycle of a Process (Process State Transitions)

      
Process Scheduling - Lecture 8 2
Process Scheduling

• Policies and Mechanisms of selecting a runnable process to become


the current process.
• Important to maintain system balance.

Process Scheduling - Lecture 8 3


Process Scheduling cont

Process Scheduling - Lecture 8 4


Process Scheduling cont
• Schedulers are processes.
• Need CPU to run.
• Scheduler tends to have highest priority in system, so that when
current process is interrupted, scheduler becomes best process to
run.

Process Scheduling - Lecture 8 5


Scheduling Objectives

• Be Fair
• Maximize throughput
• Maximize number of users receiving acceptable response times.
• Be predictable
• Balance resource use
• Avoid indefinite postponement
• Enforce Priorities
• Give preference to processes holding key resources
• Give better service to processes that have desirable behaviour patterns
• Degrade gracefully under heavy loads
Process Scheduling - Lecture 8 6
Scheduling and Performance Criteria

• CPU Utilisation - is the process CPU-bound or I/O-bound?


• Throughput - How many processes are executed in a unit of time?
• Turnaround time - how long does it take for a program to exit the system
from when it is submitted?
• Waiting Time - how much time does the process spend waiting for the
CPU in total?
• Response Time - How long does it take for the system to respond to an
interactive request?
• The above should be prioritised, and a scheduling algorithm which
satisfies the criteria should be used.
Process Scheduling - Lecture 8 7
Scheduling
CPU SCHEDULING Concepts
Multiprogramming A number of programs can be in
memory at the same time. Allows
overlap of CPU and I/O.
Jobs (batch) are programs that run
without user interaction.
User (time shared) are programs that
may have user interaction.
Process is the common name for both.
CPU - I/O burst cycle Characterizes process execution,
which alternates, between CPU
and I/O activity. CPU times are
generally much shorter than I/O
times.
Preemptive Scheduling An interrupt causes currently
running process to give up the CPU
and be replaced by another
Process Scheduling - Lecture 8 8
process.
The Scheduler
CPU SCHEDULING
 Selects from among the processes in memory that are ready to execute, and allocates
the CPU to one of them
 CPU scheduling decisions may take place when a process:
1. Switches from running to waiting state
2. Switches from running to ready state
3. Switches from waiting to ready
4. Terminates
 Scheduling under 1 and 4 is nonpreemptive
 All other scheduling is preemptive

Process Scheduling - Lecture 8 9


The Dispatcher
CPU SCHEDULING
 Dispatcher module gives control of the CPU to the process selected by the short-
term scheduler; this involves:
 switching context
 switching to user mode
 jumping to the proper location in the user program to restart that program

 Dispatch latency – time it takes for the dispatcher to stop one process and start
another running

Process Scheduling - Lecture 8 10


Criteria For
CPU SCHEDULING Performance
Evaluation

UTILIZATION The fraction of time a device is in use. ( ratio of in-use time / total
observation time )

THROUGHPUT The number of job completions in a period of time. (jobs / second )

SERVICE TIME The time required by a device to handle a request. (seconds)

QUEUEING TIME Time on a queue waiting for service from the device. (seconds)

RESIDENCE TIME The time spent by a request at a device.


RESIDENCE TIME = SERVICE TIME + QUEUEING TIME.

RESPONSE TIME Time used by a system to respond to a User Job. ( seconds )

THINK TIME The time spent by the user of an interactive system to figure out the
next request. (seconds)

The goal is to optimize both the average and the amount of variation.
Process Scheduling - Lecture 8 11
Process Scheduling Queues
• Job Queue - set of all processes in the system
• Ready Queue - set of all processes residing in main memory, ready and
waiting to execute.
• Device Queues - set of processes waiting for an I/O device.
• Process migration between the various queues.
• Queue Structures - typically linked list, circular list etc.

Process Scheduling - Lecture 8 12


Summary

• Seen typical behaviour patterns displayed by processes during


execution
• Organisation of different level schedulers to maintain system balance
and optimise resource utilisation
• What objectives a scheduler should achieve
• Questions to be answered to choose appropriate scheduling
algorithm

Process Scheduling - Lecture 8 13

You might also like