0% found this document useful (0 votes)
22 views

CPU Scheduling Analysis

Cpu scheduling analysis report

Uploaded by

hellenaachieng88
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

CPU Scheduling Analysis

Cpu scheduling analysis report

Uploaded by

hellenaachieng88
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

CPU Scheduling Analysis

Author(s)Name(s)

Abstract:
The report conducted a simulation to analyze CPU scheduling algorithms, focusing on FCFS, SJF, Priority,
and Round-Robin, along with comparing One Queue vs. Two Queue scheduling structures. Using data from
JobData.xlsx, performance metrics like average waiting time and turnaround time were measured. Results
indicated varying effectiveness among algorithms and highlighted differences in performance between the two
scheduling structures. Conclusions emphasized the necessity of selecting suitable algorithms and structures
based on system requirements, as each had its own strengths and weaknesses. This analysis underscores the
importance of understanding system characteristics and objectives when making scheduling decisions to
optimize performance.
1. Introduction: performance and resource
utilization. It ensures that
1.1 Overview of CPU
Scheduling:
processes are executed in a
timely manner, reduces
CPU scheduling is on top of response times, minimizes
the list (shortlisted) of the waiting times, and optimizes
operation system services it overall system throughput.
provides by distributing the By effectively managing
CPU resource (hardware CPU resources, CPU
resource) to the compulsive scheduling contributes to
(competing) processes. system stability,
responsiveness, and user
The CPU scheduling satisfaction.
processor under the
multiprogramming context
decides to which of multiple Purpose of the Report:
concurrent processes the
processor should be The main motivation of this
dedicated. Such a process report is the re-evaluation of
allows the allocation of a the steps involved,
time slice to each of these occurrence process and
processes. application of CPU
scheduling algorithms and
structures through
simulations. The overall
1.2 Significance in Operating target of my research is that it
Systems: deals with a comparison of
Efficient CPU different widely used
scheduling is crucial for primarily the FCFS(First
maximizing system Come First Served) and SJF
(Shortest Job First), priority 2.1 Shortest Job First (SJF):
and round-robinproceduresin
Key Concept: SJF selects the
the efficiency. In addition,
process with the shortest
the optimization of two
CPU burst time for
separate queuing processes
execution, aiming to
models is also importance.
minimize average waiting
Hence, two models for
time.
queues.
Challenges:
The main challenge
2. Literature Review: with SJF is predicting the
CPU burst time accurately, as
Theoretical Background of
it requires knowledge of
CPU Scheduling Algorithms:
future CPU bursts, which is
2.First-Come, First-Served often unavailable in practice.
(FCFS): This can lead to starvation for
long-running processes.
Key Concept: FCFS is the
simplest CPU scheduling 2.2 Priority Scheduling:
algorithm, where processes
Key Concept:
are executed in the order they
arrive in the ready queue.
It’s made up of First Come,
Challenges: FCFS can lead to First serve policy poses a
poor average waiting times, guarantee that the process has
especially for long-running been waiting for the longest
processes that arrive early, time will be served
known as the "convoy firstly. Priority (High → Low
effect." priority) based rule of CPU
allocation is applied for the
process. To FIFO principle,
which ensures a higher
priority improperly assigned
processes is first.

Challenges:

In this way, low-priority 2.3 Round-Robin


process may often be waiting Scheduling:
for resources that are used by
Key Concept:
high-priority
tasks. Moreover, scheduling Round-Robin
priority in a way that means a scheduling allocates CPU
higher-priority process can be time in fixed time slices
only postponed by lower- called time quanta. Processes
priority processes when they are executed in a circular
frequently pre-empt the queue, and each process is
former can lead to the given a time quantum to
starvation of the latter execute before being pre-
processes. empted.
Challenges:
The choice of time
quantum affects the balance
between throughput and
response time. A very short
time quantum may result in
high context-switching
overhead, while a very long-
time quantum may lead to (RMS) and Earliest Deadline
poor responsiveness. First (EDF).
2.4 Variations and Extensions: 2.7 Fair Share Scheduling:

Multilevel Queue Ensures fairness in


Scheduling: resource allocation among
users or groups of users by
Divides the ready
considering factors such as
queue into multiple priority
CPU usage and job priorities.
levels, each with its own
scheduling algorithm. Conclusion:
Processes are assigned to a
CPU scheduling
specific queue based on their
algorithms play a critical role
characteristics.
in optimizing system
2.5 Multilevel Feedback performance and resource
Queue Scheduling: utilization. Each algorithm
Similar to multilevel has its advantages and
queue scheduling but allows challenges, and the choice of
processes to move between algorithm depends on factors
queues dynamically based on such as system workload,
their behaviour and resource responsiveness requirements,
requirements. and fairness considerations.
Effective CPU scheduling
2.6 Real-Time Scheduling: requires a balance between
Designed to meet minimizing waiting times,
timing constraints and maximizing throughput, and
deadlines for real-time tasks. ensuring fairness and
Includes algorithms like Rate responsiveness.
Monotonic Scheduling 3. Methodology:
3.1 Simulation Setup: Time Quantum for Round-
Robin Scheduling:
1.Selection of Scheduling
Algorithms: For the Round-Robin
scheduling algorithm, a
The simulation includes the
specific time quantum is
implementation and
defined to determine the
evaluation of multiple CPU
duration of each time slice
scheduling algorithms,
allocated to processes.
including:
Example: Time quantum = 4
First-Come, First-Served
milliseconds
(FCFS)
3.3.1Number of Processes:
Shortest Job First (SJF)
The simulation considers a
Priority Scheduling certain number of processes
Round-Robin Scheduling to be scheduled by each
algorithm.
3.2 Data Source:
The number of processes may
The simulation vary based on the workload
utilizes data from an Excel scenario being simulated.
file named JobData.xlsx as
the source of process 3.4 Other Parameters:
information. Additional parameters such
The Excel file contains as system clock speed,
details about each job, context switch overhead, and
including job ID, CPU burst, scheduling overhead may
arrival time, and priority. also be considered in the
simulation setup.
3.3 Simulation Parameters:
These parameters can impact 1.Execute Simulation:
the performance and
The simulation iterates over
efficiency of CPU scheduling
the set of processes and
algorithms and are essential
applies each scheduling
for conducting a
algorithm to schedule the
comprehensive analysis.
processes for execution.
Simulation Execution:
Performance metrics such as
1.Read Process Data: average waiting time,
turnaround time, and other
The simulation reads process
relevant statistics are
information from the
measured for each algorithm.
JobData.xlsx file, extracting
job ID, CPU burst, arrival 2.Analyze Results:
time, and priority for each
After executing the
process.
simulation for each
2.Implement Scheduling scheduling algorithm, the
Algorithms: results are analysed to
evaluate the performance and
Each scheduling algorithm
efficiency of the algorithms.
(FCFS, SJF, Priority, Round-
Robin) is implemented as a Comparative analysis may be
separate function or module conducted to identify the
within the simulation code. strengths and weaknesses of
each algorithm and to make
The algorithms are designed
informed decisions regarding
to schedule processes based
their suitability for different
on their characteristics and
system scenarios.
the defined scheduling
policies.
4. Results and Analysis: Results for Priority
Scheduling
4.1 Simulation Results:

Results Shortest-Job-First
Results for FCFS CPU Scheduling (SJF):
scheduling algorithm.
Two Queue: In a
Two Queue CPU scheduling
structure, processes are
divided into two separate
queues based on some
criteria, such as priority or
process characteristics. The
scheduler maintains two
separate queues, one for high-
priority processes and another
for low-priority processes.
The scheduler then selects
processes for execution from
Shortest-Remaining- the appropriate queue based
Time-First on the scheduling algorithm
Scheduling (SRTF): and the current system state.
4.2 Comparative Analysis:
One Queue: In a One
Queue CPU scheduling Performance Metrics:
structure, all processes are Average Waiting
maintained in a single queue, Time: One Queue may
and the scheduler selects the exhibit higher average
next process for execution waiting times compared to
based on the scheduling Two Queue, especially when
algorithm employed. The there is a mix of high and
scheduler considers all low-priority processes. Two
processes in the queue, Queue structures can
regardless of their priority or prioritize high-priority
other attributes.
processes, reducing their time-sensitive processes over
waiting times. others, leading to potential
delays for important tasks.
Turnaround Time:
Inefficiency: May result in
Turnaround time may
longer waiting times for high-
vary depending on the
priority processes if they are
scheduling algorithm used
queued behind low-priority
and the workload
ones.
characteristics. Two Queue
structures may achieve better Two Queue:
turnaround times by ensuring
Advantages:
timely execution of high-
priority processes. Priority Handling:
Allows for the prioritization
4.2.1Advantages and
of critical processes, ensuring
Disadvantages:
timely execution of high-
One Queue: priority tasks.
Advantages: Resource Allocation:
Provides better resource
Simplicity: Easier to
utilization by focusing on
implement and manage with
executing important tasks
a single queue.
first.
Fairness: Treats all processes
Disadvantages:
equally without bias based on
priority. Complexity: Requires
additional logic for managing
Disadvantages:
multiple queues and handling
Lack of Priority: priority-based scheduling.
Cannot prioritize critical or
Starvation: Low-priority CPU scheduling mechanisms
processes may face starvation for operating systems.
if high-priority processes
continuously occupy the
CPU. 4.3 Graphical
Representation:
Conclusion:
Utilize graphical
In conclusion, the
charts (e.g., bar graphs, line
choice between One Queue
plots) to visually represent
and Two Queue CPU
the simulation results and
scheduling structures depends
comparisons.
on the system's requirements,
workload characteristics, and
the importance of task FCFS
prioritization. One Queue 120
structures offer simplicity and
100
fairness but may lead to
inefficiencies in prioritizing 80
critical tasks. On the other
60
hand, Two Queue structures
provide better priority 40
handling and resource
20
utilization but may introduce
complexity and the risk of 0
starvation for low-priority
1

7
10

13

16

19

processes. Careful Series2


consideration of these factors
is essential when designing
Priority SJF
120 120

100 100

80 Series4 80
Series3
Series2 60
60
Series1
40
40
20
20
0
0

1
3
5
7
9
11
13
15
17
19
1
5
9
13
17
21

Job Id Cpu Burst


Arrival time Priority

120
SRJF
100
80
60
40
20
0
1
4
7
10
13
16
19

Job Id
Cpu burst
Arrival Time
Priority
can be challenging, leading to
potential inaccuracies in
scheduling.
5.3Priority Scheduling:

Priority scheduling
5. Discussion:
allows for the execution of
Effectiveness of Each
critical tasks first, reducing
Scheduling Algorithm:
waiting times for high-
5.1 First-Come, First-Served priority processes.
(FCFS):
However, it can lead to
FCFS tends to result starvation if lower-priority
in longer average waiting processes are consistently
times, especially when long- pre-empted by higher-priority
running processes arrive first ones.
(convoy effect).
5.4 Round-Robin Scheduling:
It may be suitable for
Round-Robin
scenarios where fairness and
scheduling provides fair
simplicity are prioritized over
allocation of CPU time
performance.
among processes, preventing
5.2 Shortest Job First (SJF): any single process from
monopolizing the CPU.
SJF generally
achieves lower average However, the choice of time
waiting times by prioritizing quantum significantly
short-duration processes. impacts responsiveness and
overhead.
However, accurately
predicting CPU burst times
Implications in Real-World by prioritizing shorter tasks
Scenarios: or critical processes.
System Responsiveness: Workload Variability:
In real-world The choice of
scenarios where scheduling algorithm should
responsiveness is critical, consider the variability in
algorithms like Round-Robin workload characteristics. For
may be preferred due to their unpredictable workloads,
balanced allocation of CPU adaptive algorithms like
time and prevention of Multilevel Feedback Queue
process starvation. may be more suitable.
Priority Handling: Scalability and Complexity:
For systems with The scalability and
time-sensitive tasks or critical complexity of scheduling
processes, priority scheduling algorithms and structures
can ensure timely execution should also be considered.
of important jobs, enhancing While simpler algorithms like
system performance and user FCFS are easier to implement
satisfaction. and manage, more complex
Resource Utilization: structures like Multilevel
Queue or Multilevel
Effective CPU Feedback Queue may offer
scheduling plays a crucial better adaptability to diverse
role in optimizing resource workloads.
utilization. Algorithms like
SJF and Priority scheduling In conclusion, the
can improve CPU utilization effectiveness of each
scheduling algorithm and
structure depends on various 6.1Impact of Priority:
factors such as system
Priority scheduling
requirements, workload
can significantly reduce
characteristics, and
waiting times for high-
performance objectives. Real-
priority processes, but it may
world scenarios may require
lead to starvation for lower-
a combination of different
priority processes if not
algorithms and structures to
implemented carefully.
achieve the desired balance
between responsiveness, Fairness and Responsiveness:
resource utilization, and
Round-Robin
fairness. Therefore, careful
scheduling ensures fairness
consideration and
by providing each process
experimentation are essential
with equal CPU time, but the
in selecting the most suitable
choice of time quantum
CPU scheduling mechanisms
affects responsiveness and
for specific operating
overhead.
environments.
Structural Differences:
.
One Queue vs. Two
6. Conclusion:
Queue structures offer
Different CPU distinct advantages and
scheduling algorithms exhibit disadvantages, with Two
varying performance Queue structures providing
characteristics, with SJF and better priority handling but
Priority scheduling often introducing complexity.
achieving lower average Strengths of the Study:
waiting times compared to
FCFS. Comprehensive Analysis:
The study evaluates workload characteristics,
multiple CPU scheduling which may not fully capture
algorithms and structures, the complexity of real-world
providing a holistic view of scenarios.
their performance under
Static Workload:
various scenarios.
The analysis may
Realistic Simulation:
focus on a static workload
The simulation scenario, whereas real-world
utilizes real-world data from systems often face dynamic
JobData.xlsx, enhancing the and unpredictable workloads.
relevance and validity of the
Simulation Constraints:
findings.
The simulation may
Insightful Interpretation:
be limited by factors such as
The analysis provides simulation duration, number
insightful interpretations of of processes, and system
the simulation results, parameters, which may
highlighting the implications impact the generalizability of
of different scheduling the findings.
strategies in real-world
6.3 Recommendations for
contexts.
Further Research or
6.2 Limitations of the Practical Implementation:
Study:
Dynamic Scheduling
Simplified Assumptions: Strategies:
The study may rely on Investigate dynamic
simplified assumptions about scheduling strategies that
system behaviour and adapt to changing workload
conditions and prioritize tasks performance and resource
based on real-time system utilization.
demands.
In conclusion, while
Machine Learning the study provides valuable
Techniques: insights into CPU scheduling
algorithms and structures,
Explore the
there is still ample room for
application of machine
further research and practical
learning techniques for CPU
implementation to address the
scheduling, leveraging
complexities and challenges
historical data and system
of modern operating
metrics to optimize
environments. By exploring
scheduling decisions.
innovative approaches and
Real-Time Scheduling: addressing the limitations of
existing studies, future
Conduct further
research can contribute to the
research on real-time
development of more
scheduling algorithms to
efficient and adaptive CPU
meet stringent timing
scheduling mechanisms
constraints and deadlines for
critical tasks in safety-critical
systems.
Performance Optimization:

Experiment with
hybrid scheduling approaches
that combine the strengths of 7. References:
different algorithms and
structures to achieve better
[1]Suranauwarat, S. (2007, [4] Alworafi, M. A., Dhari,
October). A CPU scheduling A., Al-Hashmi, A. A., &
algorithm simulator. In 2007 Darem, A. B. (2016,
37th annual frontiers in December). An improved SJF
education conference-global scheduling algorithm in cloud
engineering: knowledge computing environment.
without borders, In 2016 International
opportunities without Conference on Electrical,
passports (pp. F2H-19). Electronics, Communication,
IEEE. Computer and Optimization
Techniques
[2] Singh, A., Goyal, P., &
(ICEECCOT) (pp. 208-212).
Batra, S. (2010). An
IEEE.
optimized round robin
scheduling algorithm for
CPU
scheduling. International
Journal on Computer Science
and Engineering, 2(07),
2383-2385.
[3] Rajput, I. S., & Gupta, D.
(2012). A priority based
round robin CPU scheduling
algorithm for real time
systems. International
Journal of Innovations in
Engineering and
Technology, 1(3), 1-11.

You might also like