0% found this document useful (0 votes)
76 views4 pages

Process Design in Os

process design in os

Uploaded by

Rajesh Satsangi
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)
76 views4 pages

Process Design in Os

process design in os

Uploaded by

Rajesh Satsangi
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
You are on page 1/ 4

OPERATING SYSTEM - PROCESS SCHEDULING

http://www.tutorialspoint.com/operating_system/os_process_scheduling.htm Copyright © tutorialspoint.com

Definition
The process scheduling is the activity of the process manager that handles the removal of the
running process from the CPU and the selection of another process on the basis of a particular
strategy.

Process scheduling is an essential part of a Multiprogramming operating system. Such operating


systems allow more than one process to be loaded into the executable memory at a time and
loaded process shares the CPU using time multiplexing.

Scheduling Queues
Scheduling queues refers to queues of processes or devices. When the process enters into the
system, then this process is put into a job queue. This queue consists of all processes in the system.
The operating system also maintains other queues such as device queue. Device queue is a queue
for which multiple processes are waiting for a particular I/O device. Each device has its own device
queue.

This figure shows the queuing diagram of process scheduling.

Queue is represented by rectangular box.

The circles represent the resources that serve the queues.

The arrows indicate the process flow in the system.

Queues are of two types

Ready queue

Device queue

A newly arrived process is put in the ready queue. Processes waits in ready queue for allocating
the CPU. Once the CPU is assigned to a process, then that process will execute. While executing the
process, any one of the following events can occur.
The process could issue an I/O request and then it would be placed in an I/O queue.

The process could create new sub process and will wait for its termination.

The process could be removed forcibly from the CPU, as a result of interrupt and put back in
the ready queue.

Two State Process Model


Two state process model refers to running and non-running states which are described below.

S.N. State & Description

1 Running
When new process is created by Operating System that process enters into the system as
in the running state.

2 Not Running
Processes that are not running are kept in queue, waiting for their turn to execute. Each
entry in the queue is a pointer to a particular process. Queue is implemented by using
linked list. Use of dispatcher is as follows. When a process is interrupted, that process is
transferred in the waiting queue. If the process has completed or aborted, the process is
discarded. In either case, the dispatcher then selects a process from the queue to
execute.

Schedulers
Schedulers are special system softwares which handles process scheduling in various ways.Their
main task is to select the jobs to be submitted into the system and to decide which process to run.
Schedulers are of three types

Long Term Scheduler

Short Term Scheduler

Medium Term Scheduler

Long Term Scheduler


It is also called job scheduler. Long term scheduler determines which programs are admitted to
the system for processing. Job scheduler selects processes from the queue and loads them into
memory for execution. Process loads into the memory for CPU scheduling. The primary objective
of the job scheduler is to provide a balanced mix of jobs, such as I/O bound and processor bound. It
also controls 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.

On some systems, the long term scheduler may not be available or minimal. Time-sharing
operating systems have no long term scheduler. When process changes the state from new to
ready, then there is use of long term scheduler.

Short Term Scheduler


It is also called CPU scheduler. Main objective is increasing system performance in accordance
with the chosen set of criteria. It is the change of ready state to running state of the process. CPU
scheduler selects process among the processes that are ready to execute and allocates CPU to
one of them.

Short term scheduler also known as dispatcher, execute most frequently and makes the fine
grained decision of which process to execute next. Short term scheduler is faster than long term
scheduler.

Medium Term Scheduler


Medium term scheduling is part of the 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.

Running process may become suspended if it makes an I/O request. Suspended processes cannot
make any progress towards completion. In this condition, to remove the process from memory and
make space for other process, the suspended process is moved to the secondary storage. This
process is called swapping, and the process is said to be swapped out or rolled out. Swapping may
be necessary to improve the process mix.

Comparison between Scheduler

S.N. Long Term Scheduler Short Term Medium Term Scheduler


Scheduler

1 It is a job scheduler It is a CPU scheduler It is a process swapping


scheduler.

2 Speed is lesser than short Speed is fastest among Speed is in between both short
term scheduler other two and long term scheduler.

3 It controls the degree of It provides lesser It reduces the degree of


multiprogramming control over degree of multiprogramming.
multiprogramming

4 It is almost absent or minimal It is also minimal in It is a part of Time sharing


in time sharing system time sharing system systems.

5 It selects processes from It selects those It can re-introduce the process


pool and loads them into processes which are into memory and execution
memory for execution ready to execute can be continued.

Context Switch
A context switch is the mechanism to store and restore the state or context of a CPU in Process
Control block so that a process execution can be resumed from the same point at a later time.
Using this technique a context switcher enables multiple processes to share a single CPU. Context
switching is an essential part of a multitasking operating system features.

When the scheduler switches the CPU from executing one process to execute another, the context
switcher saves the content of all processor registers for the process being removed from the CPU,
in its process descriptor. The context of a process is represented in the process control block of a
process.

Context switch time is pure overhead. Context switching can significantly affect performance as
modern computers have a lot of general and status registers to be saved. Content switching times
are highly dependent on hardware support. Context switch requires n + m bxK time units to save the
state of the processor with n general registers, assuming b are the store operations are required to
save n and m registers of two process control blocks and each store instruction requires K time
units.

Some hardware systems employ two or more sets of processor registers to reduce the amount of
context switching time. When the process is switched, the following information is stored.

Program Counter

Scheduling Information

Base and limit register value

Currently used register

Changed State

I/O State

Accounting
Loading [MathJax]/jax/output/HTML-CSS/jax.js

Common questions

Powered by AI

Scheduling strategies are essential in efficiently allocating CPU time among processes in a multiprogramming operating system. They determine which processes are given CPU time based on various criteria, such as process priority, CPU burst time, and I/O requirements. Strategies like round-robin, priority scheduling, and shortest job first each optimize different aspects of performance, such as response time, throughput, or turnaround time. Efficient scheduling maximizes CPU utilization, reduces wait times for processes, and balances resource usage, ultimately enhancing the overall performance and user experience of the system by ensuring that different types of processes are handled adequately and fairly .

Schedulers each impact system performance and efficiency differently. The long-term scheduler manages multiprogramming by controlling which processes enter the system, thus influencing CPU and memory workload balancing . The short-term scheduler has the greatest impact on CPU utilization as it frequently selects which processes to execute next, optimizing active process management . The medium-term scheduler enhances process mix and resource allocation by removing processes from memory into secondary storage as needed, balancing active jobs with available memory . Together, these layers of scheduling improve overall system throughput and responsiveness.

Context switching is critical in multitasking operating systems because it enables the sharing of a single CPU among multiple processes by storing and restoring their states in the process control block, allowing processes to resume from where they left off. Performance is significantly affected by context switch time, which is considered pure overhead. This time is influenced by the number of registers that need to be saved and restored, with more registers leading to longer switch times. Hardware support, such as having multiple sets of registers, can reduce context switch time .

The ready queue and device queue serve different purposes in process scheduling. The ready queue contains processes that are loaded in memory and waiting to be allocated CPU time to execute. Processes in this queue are ready to run and only need the CPU to execute their tasks. In contrast, the device queue includes processes that are waiting for I/O operations to complete on specific devices. Each device in the system has its own device queue, which holds processes until they can access necessary I/O resources .

The medium term scheduler improves the process mix by handling process swapping. It periodically moves processes that are not actively requiring CPU time, such as those waiting for I/O operations, to secondary storage. By freeing up main memory, it allows more processes to be brought into memory from the ready state, optimizing resource utilization and ensuring a balanced mix of I/O-bound and CPU-bound processes. This management improves overall system efficiency and responsiveness .

Hardware support can reduce context switching overhead by employing multiple sets of processor registers, which allow the operating system to keep the state of multiple processes readily available. This reduces the need to save and restore the registers for each context switch, significantly decreasing the time required. The effectiveness depends on hardware architecture, as context switch time is highly influenced by the operations needed to save and restore the state of processes .

A context switch in an operating system is the process of storing the state or context of a CPU for a running process so that it can be resumed later and switching the CPU to another process. The information typically stored during a context switch includes the program counter, scheduling information, base and limit register values, currently used register values, changed state, I/O state, and accounting information .

The long-term scheduler, also known as the job scheduler, manages which programs are admitted for processing by selecting processes from a pool and loading them into memory for execution. It plays a key role in balancing I/O-bound and processor-bound jobs and controlling the degree of multiprogramming. By controlling the admission of processes, it ensures that the average rate of process creation equals the average departure rate, maintaining stability. In systems with stable multiprogramming, the degree of multiprogramming is directly influenced by the rate at which the long-term scheduler admits new processes .

The primary role of the dispatcher in an operating system is to manage process transitions between the running and ready states. When a process is interrupted, the dispatcher moves it to a waiting queue if it still needs CPU time, allowing another process to be selected and executed. If the interrupted process has completed or aborted, it is discarded. This function ensures that CPU resources are efficiently allocated among competing processes .

The short-term scheduler, also known as the CPU scheduler, is the fastest of the three types of schedulers and focuses on selecting processes that are ready to execute and allocating CPU time to them. Its main function is to increase system performance by frequently deciding which process to execute next . In contrast, the medium-term scheduler handles process swapping and operates at a speed between the long-term and short-term schedulers. It reduces the degree of multiprogramming by swapping out processes from memory that are not immediately required, freeing resources for other processes .

You might also like