0% found this document useful (0 votes)
13 views11 pages

Process Scheduling in Operating Systems

Uploaded by

farwakhalid146
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views11 pages

Process Scheduling in Operating Systems

Uploaded by

farwakhalid146
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

OPERATING SYSTEM

CS(407)

LECTURE 5
PROCESS SCHEDULING

INSTRUCTOR
SIBGHA ZIA
DEPARTMENT OF COMPUTER SCIENCE
UAF SUB CAMPUS BUREWALA
PROCESS SCHEDULING
Process scheduling is a technique used

 When there are limited recourses and many processes are competing for them.

 Process scheduling is an essential part of a Multiprogramming operating


systems. Multiprogramming ensures that there is some process running at all the time.
This is done to utilize the CPU as much as possible.

 In time sharing system , the CPU switches so frequently between jobs that the user
does not feel that the machine is being shared by many processes or even many users.
 If the system has more than one processor, then it is possible to execute more than
one process at the same time.

 In single processor system, only one process can be executed at any given time.

 If there are more processes than processors, then the operating system must
schedule processes . It means that some process will be executed and other will
have to wait.

 There are many strategies for deciding which process should be assigned the CPU.
SCHEDULING QUEUES

 The Operating System maintains the following important process scheduling


queues

 Job queue − This queue keeps all the processes in the system.

 Ready queue − This queue keeps a set of all processes residing in main
memory, ready and waiting to execute. A new process is always put in this
queue.

 Waiting queues − The processes which are blocked due to unavailability of an


I/O device constitute this queue.
PROCESS MIGRATION BETWEEN VARIOUS QUEUES
 During its life time, a process begin in the job queue. It moves between the ready,
waiting and possibly job queues and eventually finishes the task. The process of
moving between various queues is known as process migration
SCHEDULER
 A process is placed in different scheduling queues throughout its life time.
 The operating system must select the processes from these queues in some way
for scheduling purpose. The part of operating system related to this decision is
called the scheduler. The algorithm used by scheduler is called the scheduling
algorithm.

 Schedulers are of three types −


 Long-Term Scheduler
 Short-Term Scheduler
 Medium-Term Scheduler
LONG-TERM SCHEDULER

 Long term scheduler is also known as a job scheduler.


 This scheduler regulates the program and select process from the job queue to
the ready queue in main memory.
 The long term scheduler controls the number of processes in memory also known
as the degree of multiprogramming.
 If the degree of multiprogramming is stable, then the average rate of process
creation must be equal to the average departure rate of processes leaving the
system.
 The system slows down if too many processes are loaded into the memory.
 The long term scheduler invoked only when a process leaves the system. it then
decides the next process to be executed.
 However, 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.
SHORT-TERM SCHEDULER

 Short term scheduling is also known as CPU scheduler.

 It selects a process from ready queue and allocates CPU to that process for
execution.

 The short term scheduler is invoked very frequently and must be very fast. A process
is typically allocated the CPU for a very short period of time.

 Short-term schedulers, also known as dispatchers, make the decision of which


process to execute next.

 Short-term schedulers makes decisions much more frequently than long term and
mid term schedulers.
Long term and short term scheduling
MEDIUM TERM SCHEDULER
 Medium-term scheduling is a part of swapping.

 It removes the processes from the memory. It reduces the degree of


multiprogramming.

 The medium-term scheduler is in-charge of handling the swapped out-processes.

 A running process can become suspended if it makes an I/O request. A suspended


processes can’t make any progress towards completion. In order to remove the
process from memory and make space for other processes, the suspended process
should be moved to secondary storage
ADDITION OF MEDIUM TERM SCHEDULING

Common questions

Powered by AI

The long-term scheduler focuses on controlling the degree of multiprogramming by selecting which processes from the job queue enter the ready queue in main memory, thereby affecting the overall system load and process mix. It decides on new process admission based on system capacity and workload. In contrast, the short-term scheduler individually selects processes from the ready queue to execute on the CPU, making decisions much more frequently to ensure optimal CPU usage without delay .

A poorly implemented scheduling strategy can lead to several adverse effects in a multiprogramming operating system. If the strategy fails to efficiently manage the ready and waiting queues, it can cause CPU underutilization, increasing idle time and reducing throughput. An ineffective mix of CPU-bound and I/O-bound jobs may result in severe bottlenecks, causing some processes to starve or leading to a delay in system response times. Consequently, system performance would degrade, affecting user experience and productivity. Additionally, improper handling of process migration and swapping could exacerbate latency issues and increase the system's overall load, destabilizing the operational balance .

Increasing the degree of multiprogramming can lead to several challenges, such as overloading the memory, causing frequent context switching, and increasing the risk of thrashing, where excessive paging affects performance. These issues result from attempting to run too many processes simultaneously beyond system capacity. The long-term scheduler mitigates these issues by regulating the admission rate of processes from the job queue into the ready queue. It ensures the mix of processes entering the system matches the system's capability, balancing CPU-bound and I/O-bound processes to stabilize system load and optimize performance .

Schedulers collaborate to manage system resources effectively by specializing in different phases of process handling: the long-term scheduler determines which processes enter the system to maintain an optimal degree of multiprogramming, while the short-term scheduler ensures efficient CPU allocation by frequently selecting from the ready queue. The medium-term scheduler enhances memory management by swapping processes in and out as needed. This dynamic interaction enables the operating system to maintain a balance between response time, throughput, and overall performance, adapting to workload changes and maximizing resource utilization .

Process scheduling is essential in multiprogramming operating systems to ensure CPU utilization is maximized. Multiprogramming enables a constant execution of processes by ensuring the CPU is always occupied. In cases where there are more processes than processors, the operating system must determine which processes should be executed and which should wait. Strategies for process scheduling involve different kinds of scheduling queues: job queue, ready queue, and waiting queues. A variety of scheduling algorithms, managed by different types of schedulers (long-term, short-term, medium-term), are implemented to make decisions on process execution and manage load effectively .

The short-term scheduler, or CPU scheduler, significantly enhances CPU efficiency by selecting processes from the ready queue and allocating CPU time for their execution. It is invoked very frequently, requiring it to operate swiftly. The scheduler, often referred to as a dispatcher, decides which process should execute next and allocates the CPU to it for a brief duration. This frequent scheduling ensures that the CPU remains busy, thereby increasing system throughput and efficiency by minimizing idle time .

The long-term scheduler, also known as the job scheduler, regulates and selects processes from the job queue to move them to the ready queue in main memory. It controls the degree of multiprogramming by ensuring the process creation rate matches the departure rate. The scheduler is invoked when a process leaves the system to select the next process for execution. The goal is to maintain a balanced mix of CPU-bound and I/O-bound jobs to manage multiprogramming efficiently, preventing the system from slowing down due to memory congestion .

The medium-term scheduler plays a critical role in optimizing system performance by managing memory usage through process swapping. It temporarily removes processes from memory to reduce the degree of multiprogramming. This action frees up memory resources, allowing other processes to execute. When a running process becomes suspended due to an I/O request, the medium-term scheduler can swap it out to secondary storage, thus optimizing memory usage and maintaining system efficiency. By effectively handling swapped-out processes, the medium-term scheduler helps to balance the load on system resources .

There are three primary queues in process scheduling: the job queue, which contains all system processes; the ready queue, which includes processes in main memory waiting to execute; and waiting queues, which hold processes blocked awaiting I/O device availability. During its lifecycle, a process migrates between these queues: starting in the job queue, moving to the ready queue when prepared to execute, and potentially transitioning to waiting queues if blocked. Eventually, the process returns to the ready queue or completes and exits the system. This movement between queues is managed by the operating system schedulers .

Process migration refers to the movement of a process between various scheduling queues (job queue, ready queue, waiting queues) throughout its lifecycle. It is significant because it facilitates efficient resource management and process execution. By migrating processes, the system can dynamically allocate CPU and memory resources, responding to I/O requests and maintaining a balance of active processes. This migration ensures that processes progress efficiently towards completion, optimizing CPU and memory utilization, which is crucial for maintaining system performance .

You might also like