0% found this document useful (0 votes)
6 views3 pages

Overview of Process Scheduling Algorithms

The document outlines the process scheduling algorithm, defining key concepts such as process, scheduler, CPU burst, waiting time, and turnaround time. It describes various scheduling algorithms, including First Come First Serve (FCFS), Shortest Job First (SJF), Round Robin (RR), Priority Scheduling, and Multilevel Queue. Additionally, it provides a sample FCFS algorithm implementation in a shell script format, along with references for further reading.

Uploaded by

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

Overview of Process Scheduling Algorithms

The document outlines the process scheduling algorithm, defining key concepts such as process, scheduler, CPU burst, waiting time, and turnaround time. It describes various scheduling algorithms, including First Come First Serve (FCFS), Shortest Job First (SJF), Round Robin (RR), Priority Scheduling, and Multilevel Queue. Additionally, it provides a sample FCFS algorithm implementation in a shell script format, along with references for further reading.

Uploaded by

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

Process Scheduling Algorithm

1)Objective :
 Process : A program that’s currently being executed.
 Scheduler : A part of the OS responsible for picking which process should
run next.
 CPU Burst: The amount of time a process needs the CPU to perform its
task.
 Waiting Time : How long a process stays in the queue before it actually gets
to use the CPU.
 Turnaround Time : The total time it takes for a process to complete after it
has been submitted.

2)Definition :
A scheduling algorithm is like a set of rules that help the operating system pick the
next process to run. The main aim is to improve efficiency, reduce delay, and
ensure fairness between processes. A good scheduling strategy helps the system
perform better by minimizing idle time and getting more work done in less time.

Core Concepts :
 Process : Program that is running and managed by the operating system.
 CPU Scheduling : The mechanism of picking a process from the ready
queue and assigning CPU time to it.
 Scheduling Techniques : These are systematic rules or policies that
determine which process should be scheduled next.

Types of Scheduling Algorithms :


 First Come First Serve (FCFS): Executes processes in the order they
arrive.
 Shortest Job First (SJF): Runs the process with the smallest CPU burst
first.
 Round Robin (RR): Each process gets an equal, fixed time slot in rotation.
 Priority Scheduling: Processes with higher priority run before lower ones.
 Multilevel Queue: Groups processes into different queues, each with its
own scheduling rules.

3) Algorithm (For FCFS) :


1) Create File: nano [Link]
2) Code :

echo -n “Enter number of processes:”


read n

for ((i=0; i<n; i++))


do
echo -n “Enter Burst Time for Process[$i]: “
read bt[$i]
done

wt[0]=0

for ((i=1; i<n; i++))


do
wt[$i]=$((wt[$i-1] + bt[$i-1]))
done

for ((i=0; i<n; i++))


do
tat[$i]=$((wt[$i] + bt[$i]))
done
echo -e “\nProcess\tBurst Time\tWaiting Time\tTurnaround Time” for
((i=0; i<n; i++))
do
echo -e “P$i\t${bt[$i]}\t\t${wt[$i]}\t\t${tat[$i]}”
done

3) Executable: chmod +x [Link]


4) Run: /[Link]
8) References:
 Ubuntu Terminal Guide – [Link]
 GeeksforGeeks on Scheduling – [Link]
 Operating System Concepts by Silberschatz & Galvin
 Linux Documentation Project – [Link]
 Ubuntu CLI Docs – [Link]

Common questions

Powered by AI

Round Robin scheduling assigns each process an equal, fixed time slot in rotation, ensuring that all processes get a chance to run, thus promoting fairness. This time-sharing model prevents any process from monopolizing the CPU. However, if the time slice is too short, the system may spend more time context-switching between processes than doing useful work, reducing overall efficiency. Conversely, if the time slice is too long, the benefits of time-sharing are reduced .

Waiting time and turnaround time are key performance metrics for scheduling algorithms. Waiting time measures how long a process spends in the queue before execution, while turnaround time is the total time taken from submission to completion. Lower waiting and turnaround times indicate more efficient scheduling, leading to better system responsiveness and higher throughput. Comparing these metrics across different algorithms helps in assessing their efficiency and suitability for various workloads .

Starvation in Priority Scheduling can be mitigated through techniques such as aging, where the priority of processes increases the longer they wait. This ensures that over time, lower-priority processes gain the necessary attention to execute, preventing indefinite postponement .

FCFS can be inefficient in multiprogramming because it processes tasks in the order of arrival, which can lead to the convoy effect. This scenario occurs when shorter, numerous jobs are delayed by a single long job, resulting in increased waiting time and idle CPU cycles. Additionally, it doesn't necessarily optimize for throughput or system responsiveness .

CPU burst time is critical in scheduling algorithms like SJF and its variants, which aim to minimize waiting time by dispatching processes with shorter bursts first. Correct estimation of CPU bursts helps in achieving optimal processing order and reducing idle CPU time. However, misestimation can lead to suboptimal performance and increased process delay .

Priority Scheduling runs processes based on priority levels, which can efficiently utilize CPU resources by prioritizing high-importance tasks. However, this approach may compromise fairness as it can lead to starvation of lower-priority processes, especially if high-priority tasks are abundant. Aging can be implemented to overcome starvation by gradually increasing the priority of waiting processes over time .

FCFS scheduling executes processes in the order they arrive, which can result in longer average waiting times, especially if a longer process arrives before shorter ones. This may lead to inefficient CPU utilization due to the convoy effect. SJF scheduling, on the other hand, runs the process with the smallest CPU burst first, minimizing the average waiting time and improving system efficiency. However, it requires prior knowledge of the CPU burst time and can lead to starvation of longer processes if they continually get bypassed by shorter ones .

Multilevel Queue scheduling is beneficial when distinct groups of processes with different requirements need separate handling, such as interactive versus background processes. Each queue can have its own scheduling algorithm, which allows tailored management and prioritization. Challenges include complexities in queue management and potential latency in handling processes queued in lower-priority queues, which can impact system responsiveness .

The time quantum in Round Robin scheduling directly affects both system efficiency and responsiveness. A smaller time quantum enhances responsiveness by allowing rapid process switching, benefiting real-time applications. However, too small a quantum increases context-switch overhead, reducing efficiency. Conversely, a larger time quantum lowers context-switching overhead but may delay responsiveness, akin to FCFS, thus requiring careful selection to achieve an optimal balance .

A good scheduling strategy enhances operating system performance by minimizing idle time and ensuring effective CPU utilization. It reduces waiting and turnaround times, thus increasing system throughput and efficiency. It balances load during high demand, mitigates bottlenecks, improves response times for interactive users, prevents starvation through adaptive techniques, and scales efficiently with varying workloads .

You might also like