CPU Scheduling Algorithms (Project Report)
CPU Scheduling Algorithms (Project Report)
Prepared By:
• Anwar saeed
• Sadeem Nasser
• Hind Ahmad
• Hidaya saud
• Danah Meshal
0
Project Report: CPU Scheduling Algorithms
Introduction:
CPU scheduling is a crucial aspect of operating systems, responsible for managing the execution
of processes in a system. In this project, we implemented and analyzed four different scheduling
algorithms: First-Come, First-Serve (FCFS), Shortest Job First non-preemptive (SJFnp),
Shortest Job First preemptive (SJFp), and Round-Robin (RR) with different quantum values.
The goal was to evaluate the performance of these algorithms based on average waiting time,
average turnaround time, and fairness.
We have learned that there are several different scheduling Algorithms that can be used, each
with its own advantages and disadvantages. Some of the most common scheduling Algorithms
include First-Come, First-Served (FCFS), Shortest Job First (SJF), Priority Scheduling, and
Round Robin (RR).
FCFS is a simple scheduling Algorithm that executes processes in the order in which they arrive.
While it is easy to implement, it can lead to long waiting times for processes with longer burst
times, which can negatively impact the overall performance of the system.
SJF is a scheduling Algorithm that executes the process with the shortest burst time first. This
can lead to better performance than FCFS, as it minimizes the waiting time for processes with
1
shorter burst times. However, it requires knowledge of the burst time of each process in advance,
which may not always be available.
Priority scheduling is a scheduling Algorithm that assigns a priority level to each process and
executes the highest priority process first. This can be useful for systems that need to prioritize
certain types of processes, such as real-time processes or system-critical processes. However, it
can lead to lower-priority processes being starved of resources if the higher-priority processes
monopolize the CPU.
Round Robin is a scheduling Algorithm that executes processes in a time-sliced manner, with
each process executing for a fixed time quantum before being preempted and replaced with the
next process in the queue. This Algorithm can provide good responsiveness to interactive
processes and prevent starvation, but it can also lead to high overhead due to frequent context
switching.
Overall, I've learned that choosing the appropriate scheduling Algorithm depends on the specific
requirements of the system and the types of processes that need to be executed. It's important to
consider factors such as responsiveness, fairness, and resource utilization when selecting a
scheduling Algorithm.
2
Experimental Seteps:
To gain insights into the behavior of different scheduling Algorithms, we conducted seven
experiments using the following configurations:
5. First-Come, First-Serve.
- In this configuration, the quantum value is zero, which means each process runs until
completion before the next process starts.
- The average waiting time is high since processes are not preempted, and longer processes
can monopolize the CPU.
- Fairness might be compromised, as shorter processes have to wait for longer processes to
complete.
3
2. Round-Robin with Quantum equal to 10:
- With a small quantum value, each process gets a small time slice before being preempted.
- The average waiting time may decrease compared to RR with a zero-quantum due to
preemptive scheduling.
- A larger quantum value allows processes to run for a longer duration before being
preempted.
- This configuration reduces the frequency of context switches, improving overall system
efficiency.
- The average waiting time may decrease further compared to the previous configurations.
4
4. Round-Robin with Quantum equal to 10,000:
- With an extremely large quantum, the RR scheduler behaves similar to FCFS, as processes
are rarely preempted.
- The average waiting time will be high, and fairness might be compromised.
5
5. First-Come, First-Serve (FCFS):
- FCFS follows a simple Algorithm of executing processes in the order they arrive.
- It suffers from the "convoy effect" where longer processes at the front of the queue can
delay shorter processes behind them, resulting in higher waiting times.
- FCFS is non-preemptive and may not provide the best overall system throughput.
- SJFnp selects the process with the smallest burst time first.
- This Algorithm minimizes the average waiting time by prioritizing shorter processes.
- However, it can lead to starvation for longer processes if they continuously arrive after
shorter processes.
6
7. Shortest Job First Preemptive (SJFp):
- it is similar to SJFnp but allows preemption if a new process with a shorter burst time
arrives.
- This Algorithm improves fairness and reduces the average waiting time compared to
SJFnp.
7
Comparison of Average Waiting Time:
- After conducting the experiments, we can compare the average waiting time for all the
algorithms.
- It is expected that SJFp will have the lowest average waiting time, followed by SJFnp and RR
with a small quantum.
- FCFS and RR with larger quantum values are likely to have higher average waiting times.
Conclusion: