Title: SCHEDULING Uni Processor Scheduling
1SCHEDULING / Uni Processor Scheduling
- Objectives Criteria.
- Various types of Scheduling.
- Typical Scheduler Structure
- Mechanisms.
- CPU Scheduling Policies.
2Scheduling Objectives Criteria I(System
Oriented Performance Related)
- Maximize CPU utilization / Minimize CPU Idle
time. - Maximize throughput i.e. the no. of process /
threads completed per unit time. - Optimize service time / process t serv
The amount of time a process needs to be in the
running state before it is completed.
3Scheduling Objectives Criteria II
- Minimize the following (User Oriented
Parameters) - a) Process / Thread turn around time Tturn
The time interval between the point when the
concerned process is brought in the system and
the moment it exits out of the system after
proper completion . - b) Waiting time Twait The time spent by
the process/ thread in the ready state before
being taken up for execution I.e. the time
interval between the concerned processs arrival
in the ready state (from several other states)
and the moment it is allocated the CPU. - c) Response time T response Time interval
between job submission by the user and the very
first time it is taken up for execution. - d) Deadlines T max. When process
completion deadlines are specified (especially
in real time systems) then the scheduling
criteria should aim to maximize the percentage of
deadlines met.
4Scheduling Objectives Criteria - III
- User Oriented Parameter Contd.
- e) Predictability A given job should take
about the same time and use the same set of
resources / (same cost) regardless of the current
system load. Wide variation of turnaround time
and / or response time should be prevented. -
5Scheduling Objectives Criteria IVSystem
oriented criteria
- Fairness All processes should be treated in the
same manner unless specified system / user
directive (normally in the form of priority) .
No one process should dominate any resource
thereby causing any other process to starve for
that resource. - Enforcing priorities When processes are
assigned priority the scheduling policy should
favor the higher priority processes. - Balancing Resources Optimal use of system
resources should be aimed at. Processes that
will under use stressed resources should be
favored.
6Scheduling Objectives Criteria VSystem
oriented criteria (contd.)
- Disciplined use of Resources The scheduling
policy must ensure that modality of sharing non
shareable resources like printers must be proper
without sacrificing on fairness predictability.
This is also dictated by the following. - I/O Scheduling The decision as to which
processs pending I/O request shall be handled by
an available I/O peripheral device. Process
Synchronization Issue.
7Various types of Scheduling
- Long term Scheduling The decision to choose
some jobs from the job pool on Disk to be
converted into processes as well as creating the
set of processes in the virtual space which
involves creation of PCBs, PMTs etc. done with
the help of Virtual Space / File Manager . - Medium term Scheduling The task of add /
removal to / from the number of processes/
working set of the processes lying in the
physical memory to the Disk Swap Space or
Virtual Space and vice versa.. This sometimes
creates a Ready Process ( a candidate for the
Ready Queue). This task is primarily performed by
the Swap Space Manager along with the Memory
Management Unit (MMU). - Short term Scheduling This creates
maintains the Ready Queue as well as dictates
which of the processes in the Ready Queue will
be allocated the processor next.This can be
partitioned into three main sub parts , the
Enqueuer, the process scheduler/ dispatcher
module and the context switcher. Our present
area of interest
8Tasks performed by a Long Term Scheduler
- Determines which job will be admitted to the
system i.e. copied from the job pool on disk into
the main memory ( Job Selection). - It creates a process from the job description in
the virtual space i.e. it creates the Process
Control Block (PCB), the Segment Descriptor
Table, Page Map Table (PMT) index as well as the
Page Map Table(PMT). - Once created the process waits to be brought
in the physical memory by the medium term
scheduler. - The decision about when to create a new process
is generally decided by the standard process
creation methods as illustrated earlier. - Employs file manager.
9Medium term Scheduler Functions
- The swap space Management MMU Function comes
into operation whenever any process or a part of
it need to be swapped out of the physical memory
to make way for other process to be admitted. - Swapping In / Out Decision is based on the
following aspects - The need to manage the degree of
multiprogramming. - The priority of the concerned processes the
pre_emption policy. - The swap space requirement of the swapped out
process. - The MMU structure support available.
- The disk swap space size management strategy.
10Short term Scheduler Functions
- Creates maintains Ready Queue employing
Enqueuer Module. - Makes the time grained decision of which process
/ thread from the ready queue will be executed
next. - Involves in dispatching of selected process from
the Ready State to the Running state using
Dispatcher Context switcher modules. - Executes most frequently.
- Invoked when any one of the following events
occur for the currently running process/thread. - It gets terminated.
- It goes to wait / Blocked state or alternatively
scheduled for I/O operation. - It comes back to ready state due to some
pre-emption policy. - Performs the primary functions of the process
manager.
11Typical Process State Diagram
New
Admit
(Pre_Empt. 1) High Priority Job enters
Admit
Dispatch
No allocated Memory
Activate
Release
Ready Suspend
Ready
Running
Pre_Empt2
Exit
Time Out
Event Occurs
Swap out Disk
Event Wait (I/O wait)
I/O Complete
Wait / Blocked
Activate
Event Occurs
Blocked Suspended
Swap out to Disk
No allocated Memory
12States Transitions vs. Scheduler Role -1
- NEW gtCreate Process Id PCB
- ( done by Long Term Scheduler) .
- NEW ? Ready or ? Ready / Suspend
- gt Process is ready to execute waiting for
CPU allocation OR Process is waiting only for
main memory. - Ready / Suspend ? Ready gt Process is ready
to run waiting to be scheduled/ dispatched . - ( Brought in to / out of Physical Memory by
Medium Term Scheduler. Put in Ready Queue by
Short Term Scheduler)
13States Transitions vs. Scheduler Role - 2
- Blocked ? Blocked/ Suspend gt used to make
available more memory to the Ready processes
and/ or to the Running Process. ( done by Medium
Term Scheduler) . - Blocked/Suspend ? Ready Suspend gt Process
waiting for event completion is over but no main
memory is currently available. ( primarily
invoked by I/O Scheduler, completed by Medium
Term Scheduler) . - Ready ? Ready/ Suspend adopted if that is the
only way to make available more memory to a high
priority / currently running process. (Brought
out of Ready Queue by Short Term Scheduler - Brought out of Physical Memory by Medium Term
Scheduler).
14States Transitions vs. Scheduler Role - 3
- Blocked /Suspend ? Blocked used to bring a high
priority waiting process into memory. ( done by
Medium Term Scheduler) - Running ? Ready /Suspend implies completion of
time quantum but no memory is currently
available since a high priority process has
either moved into the blocked state or has become
unblocked. (Brought out of Running State by Short
Term Scheduler .Brought out of Physical Memory
by Medium Term Scheduler).
15States Transitions vs. Scheduler Role - 4
- Running ? Blocked Queue used for any I/O
requesting process / parent with unfinished child
process ( after Executing Wait) . - ( done by Short Term Scheduler
Peripheral Manager) - Running ? Ready implies pre emption either due
to the completion of time quantum or due to the
prefixed scheduling policy (done using Enqueuer
module of the Short Term Scheduler). - Blocked ? Ready implies completion of the
requisite event for some waiting process /
releasing of a Resource initiated through some
Device interrupt completed due to the Resource
Release (after Executing Signal ) done through
the Enqueuer.