0% found this document useful (0 votes)
17 views

Chapter 6 Processor Scheduling

Operating systems
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Chapter 6 Processor Scheduling

Operating systems
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

PROCESSOR

SCHEDULING
Processor Scheduling
Process scheduling queues help you to maintain a
distinct queue for each and every process states and
their PCBs. All the processes of the same execution state
are placed in the same queue. Therefore, whenever the
state of a process is modified, its PCB needs to be
unlinked from its existing queue and moved to the new
state queue.
Processor Scheduling
The important objectives of Process scheduling are:
1.Maximizes the number of interactive users within
acceptable response times.
2.Achieves a balance between response and utilization.
3.Avoids indefinite postponement and enforce priorities.
4.It also should give priority or preference to the processes
holding the key resources.
Processor Scheduling
• Processor scheduling is the task of selecting a waiting
process from the ready queue and allocating the
processor to it in the running queue.
• We will consider three scheduling levels
i. High-level /long-term/job scheduling
ii. Intermediate-level scheduling
iii. Low-level/short-term scheduling
High-level Scheduling
• Sometimes called job scheduling or long-term scheduling
determines which jobs the system allows to compete actively
for system resources by selecting processes from the process
pool (usually on disk) and loads them into memory.
• This level determines the total number of processes in a
system at a given time i.e. degree of multiprogramming
• Entry of too many processes at a time saturate the system’s
resources, leading to poor performance
High-level Scheduling
• This scheduler regulates the program and selects processes
from the queue and loads them into memory for execution.
• It also regulates the degree of multi-programming.
• The main goal of this type of scheduler is to offer a balanced
mix of jobs, like Processor, I/O jobs., that allows managing
multiprogramming.
Intermediate-level Scheduling
• Medium-term scheduling is an important part of swapping. It enables
you to handle the swapped out-processes.
• In this scheduler, a running process can become suspended if/when it
makes an I/O request. A suspended process cannot make any
progress towards completion. To remove the process from memory
and make space for other processes, the suspended process should
be moved to secondary storage.
Intermediate-level Scheduling
• Determines which processes should be allowed to compete for
processors.
• This policy temporarily suspends and resumes processes to achieve
smooth system operation
• Helps realize system-wide performance goals
Low-level Scheduling
• Also known as CPU scheduler, the main goal of this scheduler is to
boost the system performance according to set criteria.
• This helps you to select from a group of processes that are ready to
execute and allocates CPU to one of them. The dispatcher gives
control of the CPU to the process selected by the short term
scheduler.
Low-level Scheduling
• Determines which active process the system will assign to a processor
when one next become available
• Assigns priority to each process, reflecting its importance i.e. the
more important a process, the more likely the scheduling policy is to
select it to execute next. It selects processes from the ready queue
• Priorities may be statically assigned or be changed dynamically during
the course of execution.
Long-Term Vs. Short Term Vs. Medium-Term
Long-Term Short-Term Medium-Term

Long term is also known as a job Short term is also known as CPU Medium-term is also called swapping
scheduler scheduler scheduler.

It is either absent or minimal in a It is insignificant in the time-sharing This scheduler is an element of


time-sharing system. order. Time-sharing systems.

Speed is the fastest compared to the


Speed is less compared to the short
short-term and medium-term It offers medium speed.
term scheduler.
scheduler.

Allow you to select processes from


It only selects processes that is in a It helps you to send process back to
the loads and pool back into the
ready state of the execution. memory.
memory

Reduce the level of


Offers full control Offers less control
multiprogramming.
Scheduling Decisions
• When a process switches from running to waiting.
• When a process switches from running to ready.
• When a process switches from waiting to ready.
• When a process terminates.
Preemptive versus Non-preemptive
Scheduling
1. Preemptive Scheduling: The system can remove the processor from
the process it is running. To prevent users from monopolizing the
system (either maliciously or accidentally), preemptive schedulers
set an interrupting clock or interval timer that periodically
generates an interrupt.
2. Non-preemptive Scheduling: Once the system has assigned a
processor to a process, the system cannot remove that processor
from that process.
Scheduling objectives
When developing a scheduling discipline, a system designer must
consider a variety of objectives, such as the type of system and the
users' needs.
These objectives may include:
1. Maximize throughput (i.e. a measure of the total amount of work
done in a given time)
2. Minimize the time each process waits before executing
3. Maximize resource utilization
4. Avoid indefinite postponement
5. Ensure predictability
6. Enforce priorities
Scheduling Algorithms
1. First-In-First-Out (FIFO) Scheduling
2. Shortest-Process-First (SPF) Sche duling
3. Priority Scheduling
4. Shortest-Remaining-Time (SRT) Scheduling
5. Round Robin Scheduling
First-In-First-Out (FIFO) Scheduling
1. Jobs are executed on first come, first serve basis.
2. It is a non-preemptive, pre-emptive scheduling algorithm.
3. Easy to understand and implement.
4. Its implementation is based on FIFO queue.
5. Poor in performance as average wait time is high.
Shortest-Process-First (SPF) Sch eduling
1. This is also known as shortest job first (SJF)
2. This is a non-preemptive, pre-emptive scheduling algorithm.
3. Best approach to minimize waiting time.
4. Easy to implement in Batch systems where required CPU time is
known in advance.
5. Impossible to implement in interactive systems where required CPU
time is not known.
6. The processer should know in advance how much time process will
take.
Shortest-Remaining-Time (SRT) Scheduling
1. Shortest remaining time (SRT) is the preemptive version of the SJF
algorithm.
2. The processor is allocated to the job closest to completion but it
can be preempted by a newer ready job with shorter time to
completion.
3. Impossible to implement in interactive systems where required
CPU time is not known.
4. It is often used in batch environments where short jobs need to
give preference.
Priority Scheduling
1. Priority scheduling is a non-preemptive algorithm and one
of the most common scheduling algorithms in batch
systems.
2. Each process is assigned a priority. Process with highest
priority is to be executed first and so on.
3. Processes with same priority are executed on first come
first served basis.
4. Priority can be decided based on memory requirements,
time requirements or any other resource requirement.
Round Robin Scheduling
1. Round Robin is the preemptive process scheduling algorithm.
2. Each process is provided a fixed time to execute, it is called
a quantum.
3. Once a process is executed for a given time period, it is
preempted and other process executes for a given time period.
4. Context switching is used to save states of preempted processes.

You might also like