Page 12 - Campus Chronicles Technical Magazine 2021
P. 12
calculated as:
Turn Around Time = Completion Time – Arrival Time.
Waiting Time: This is the difference in time between
turnaround time and burst time. This can be calculated Round
CPU Scheduling as: Robin SJF
Waiting Time = Turn Around Time – Burst Time
Algorithms Throughput: It is the number of processes that are
completing their execution per unit time.
Scheduling
First Come First Serve (FCFS) Scheduling Algorithm: FCFS Priority
By Ms. Rayudu Aishwarya, First Come First Serve is the easiest and simplest CPU Algorithms
scheduling algorithm to implement. In this type of
B. Tech (CSE) - 19UP1A05E2 scheduling algorithm, the CPU is first allocated to the
process which requests the CPU first. That means the
process with minimal arrival time will be executed first
A CPU scheduling algorithm is used to determine which by the CPU. It is a non-preemptive scheduling Multi Level
process will use CPU for execution and which algorithm as the priority of processes does not matter, SRT Queue
processes to hold or remove from execution. The main and they are executed in the manner they arrive in front
goal or objective of CPU scheduling algorithms is to of the CPU. This scheduling algorithm is implemented
make sure that the CPU is never in an idle state,
with a FIFO (First In First Out) queue. As the process is
meaning that the OS has at least one of the processes ready to be executed, its Process Control Block (PCB) is
ready for execution among the available processes in linked with the tail of this FIFO queue. Now when the burst time, then First Come First Serve (FCFS) allocated a small amount of time called time slice or
the ready queue. CPU becomes free, it is assigned to the process at the scheduling is used to break the tie. The preemptive time quantum. The ready queue of the processes is
beginning of the queue. mode of SJF scheduling is known as the Shortest implemented using the circular queue technique in
There are two types of scheduling algorithms: Remaining Time First scheduling algorithm. which the CPU is allocated to each process for the
1) Preemptive, 2) Non-Preemptive. Advantages: given time quantum and then added back to the ready
• Involves no complex logic and just picks processes Advantages: queue to wait for its next turn. If the process completes
Preemptive Scheduling Algorithms: In these from the ready queue one by one. • Results in increased Throughput by executing its execution within the given quantum of time, then it
algorithms, processes are assigned with a priority. • Easy to implement and understand. shorter jobs first, which mostly have a shorter will be preempted, and other processes will execute
Whenever a high-priority process comes in, the lower- • Every process will eventually get a chance to run so turnaround time. for the given period of time. But if the process is not
priority process which has occupied the CPU is no starvation occurs. • Gives the minimum average waiting time for a completely executed within the given time quantum,
preempted. That is, it releases the CPU, and the high- Disadvantages: given set of processes. then it will again be added to the ready queue and will
priority process takes the CPU for its execution. • Best approach to minimize waiting time for other wait for its turn to complete its execution.The round-
• Waiting time for processes with less execution time processes awaiting execution. robin scheduling is the oldest and simplest scheduling
is often very long.
Non-Preemptive Scheduling Algorithms: In these • It favors CPU-bound processes then I/O processes. • Useful for batch-type processing where CPU time algorithm that derives its name from the round-robin
algorithms, we cannot preempt the process. That is, • Leads to convoy effect. is known in advance and waiting for jobs to principle. In this principle, each person will take an
once a process is running in CPU, it will release it either • Causes lower device and CPU utilization. complete is not critical. equal share of something in turn.This algorithm is
by context switching or terminating. Often, these are • Poor performance as the average wait time is high. Disadvantages: mostly used for multitasking in time-sharing systems
the types of algorithms that can be used because of the • May lead to starvation as if shorter processes keep and operating systems having multiple clients so that
limitation of the hardware. Shortest Job First (SJF) Scheduling Algorithm: on coming, then longer processes will never get a they can make efficient use of resources.
Shortest Job First is a non-preemptive scheduling chance to run.
There are some important terminologies to know algorithm in which the process with the shortest burst • Time taken by a process must be known to the CPU Advantages:
for understanding the scheduling algorithms: or completion time is executed first by the CPU. That beforehand, which is not always possible. • All processes are given the same priority; hence all
Arrival Time: This is the time at which a process arrives means the lesser the execution time, the sooner the processes get an equal share of the CPU.
in the ready queue. process will get the CPU. In this scheduling algorithm, RoundRobin Scheduling Algorithm: • Since it is cyclic in nature, no process is left behind,
and starvation doesn't exist.
Completion Time: This is the time at which a process the arrival time of the processes must be the same, and The Round Robin algorithm is related to the First Come Disadvantages:
First Serve (FCFS) technique but implemented using a
completes its execution. the processor must be aware of the burst time of all the preemptive policy. In this scheduling algorithm, • The performance of Throughput depends on the
Burst Time: This is the time required by a process for processes in advance. If two processes have the same processes are executed cyclically, and each process is length of the time quantum. Setting it too short
CPU execution. increases the overhead and lowers the CPU
Turn-Around Time: This is the difference in time Campus Campus efficiency, but if we set it too long, it gives a poor
between completion time and arrival time. This can be CHRONICLES 12 13 CHRONICLES response to short processes and tends to exhibit
Technical Magazine Technical Magazine