Scheduling
Scheduling:
Scheduling is a fundamental operating system function. All
computer resources are scheduled before use. Since Microprocessor is one of the
primary computer resources, its scheduling is central operating system design.
Scheduling refers to a set of policies and mechanisms
supported by operating system that controls the order in which the work to be
done is completed. A scheduler is an operating system program that selects the
next job to be admitted for execution. The main objective of scheduling is to
increase CPU utilization and higher throughput is the amount of work
accomplished in a given time interval. CPU scheduling is the basis of operating
system which supports multiprogramming concepts. By having a number of programs
in computer memory at the same time, the CPU may be shared among them. This
mechanism improves the overall efficiency of the computer system by getting
more work done in less time. The advantage of multiprogramming is explained in
the previous unit. There three different types of schedulers, which make concurrent
in operating system.
1.
Long
term scheduling: Some time it is also known as job scheduling. The
long term, or admission, scheduler decides which jobs or processes are to be
admitted to the ready queue, that is when an attempt is made execute a program,
its admission to the set of currently executing processes/ tasks is either
authorized or delayed by the long-term scheduler. Newly submitted jobs are to
be converted into processes and put into the READY QUEUE access to processor.
The primary objective of long-term scheduling is balanced mix of jobs to the short-term
scheduler. Long term scheduler takes a careful selection of process, that is
process should combination of CPU and input/output bound types. If all
processes are input/output bound, the READY queue will always be empty and short-term
scheduler will have nothing to do. If all processes are CPU bound, no process
will be waiting for input/output operations and again a system will be
unbalanced. Therefore, long term scheduler provides good performance by
selecting combination of CPU bound and input/output bound process.
2.
Medium
term scheduler: The mid-term scheduler temporarily
removes processes from main memory and places them on secondary memory (such as
a disk drive) or vice versa. This is commonly referred to as “swapping out” or
“swapping in” (“paging out” or “paging in”). The mid-term scheduler may decide
to swap out a process which has not been active for some time, or a process
which has a low priority, or a process which is page faulting frequently, or a
process which is taking up a large amount of memory in order to free up main
memory for other processes, swapping the process back in later when more memory
is available, or when the process has been unlocked and is no longer waiting
for a resource.
In many systems today (those that
support mapping virtual address space to secondary storage other than the swap
file), the mid-term scheduler may actually perform the role of the long-term
scheduler, by treating pairs as “swapped out processes” upon their execution.
In this way, when a segment of the binary is required, it can be swapped in on demand.
3.
Short
term scheduler: It allocate processes READY queue to
CPU for immediate processing. Its main objective is to maximize CPU requirement
compared to other two scheduler it’s more frequent. It must select a new
process for executes quite often because a CPU executes a process only for few
mill-seconds, before it goes for input and output operation. There are two
types of short-term scheduling policies- 1) Preemptive 2) Non-preemptive
1)
Non-preemptive: Non-preemptive algorithms are designed so that
once a process enters the running state, it is not removed from the processor
until it has completed its service time or explicitly yields the processor.
These are following characteristics of
non-preemptive scheduling:
·
In non-preemptive system,
short jobs are made to wait by longer jobs but the overall treatment of all
processes is fair.
·
In non-preemptive system,
response times are more predictable because incoming high priority jobs cannot
displace waiting jobs.
·
In non-preemptive
scheduling, a scheduler executes jobs in the following two situations.
1.
When a process switches
from running state to the waiting state.
2.
When a process
terminates.
2) Preemptive: The process with the highest priority should always be the one
currently using the processer. If a process is currently using the processor
and a new process with a higher priority enters, the ready list, the process on
the processor should be removed and returned to the ready list until it is once
again the highest priority process in the system.
Comments
Post a Comment
Thank you for message