Operating Systems Project Based Lab
Operating Systems Project Based Lab
S.no
Sec
Roll no.
ID No.
V.PRUDHVI KRISHNA
2D
68
12003472
K.SRINIDHI
2D
25
12003163
KVS.UDAY BHASKAR
2D
64
12003458
B.ARUN KUMAR
2D
36
12003288
SUBMITTED BY:BATCH-6
ABSTRACT
The project entitled Implementation of CPU Scheduling Algorithms is basically a program
which simulates the following scheduling algorithms:
INTRODUCTION
CPU SCHEDULING:
It is the task of selecting a waiting process from the ready queue and allocating the CPU to it.
It is a fundamental problem in operating systems in terms of minimizing the wait for the user
when he or she simply wants to execute a particular set of tasks. In order to make the
computer more productive in multiprogramming, the operating system needs to switch the
CPU among processes.
SCHEDULING ALGORITHMS:
Scheduling algorithms are the techniques used for distributing resources among parties which
simultaneously and asynchronously request them. Scheduling disciplines are used in routers
(to handle packet traffic) as well as in operating systems (to share CPU time among both
threads and processes), disk drives (I/O scheduling), printers (print spooler), most embedded
systems, etc.
The main purposes of scheduling algorithms are to minimize resource starvation and to
ensure fairness amongst the parties utilizing the resources. Scheduling deals with the problem
of deciding which of the outstanding requests is to be allocated resources. There are many
different scheduling algorithms.
FIRST-COME FIRST-SERVED
SHORTEST-JOB-FIRST
ROUND-ROBIN
PRIORITY SCHEDULING
FIRST-COME- FIRST-SERVED
With this scheme, whichever process requests CPU time first is allocated the CPU first. This
is easily implemented with a FIFO queue for managing the tasks; as they come in, they're put
on the end of the queue. As the CPU finishes each task, it pops it off the start of the queue
and heads on to the next one.
DRAWBACK- The average waiting time for this technique, though, is often quite long.
ADVANTAGE - Simple to implement.
Fig. 1- The working of SJF technique (a) Running four processes in original order
(b) Running same processes in SJF order.
Take a look at the example of Fig. 1. In the original order, A runs first and hogs the system for
shorter processes. If run in SJF order, the shorter jobs run first and A gets its turn last.
DRAWBACK-Main disadvantages of SJF are that these algorithms need advanced
knowledge of estimation and preemption. These aspects make it hard to implement these
algorithms.
ADVANTAGE- The SJF algorithms do not have a bias in favour of longer processes as it
happens in FCFS algorithms. It also provides the maximum throughput in most of the cases.
ROUND-ROBIN
Round-Robin is one of the most important and significant algorithms. Almost all of the
modern algorithm techniques work on same grounds as that of Round-Robin. It uses the
concept of cyclic execution and allocates all processes a similar time of execution known as
Quantum or Time-slice. It basically creates a queue of processes with all waiting
processes, picks the first job, gives it the time-slice to execute and when its time is over, RR
picks it and puts it at the tail of queue and the process begins once again with the next job in
queue.
PRIORITY SCHEDULING
The Priority-based scheduling (PBS) involves the concepts of both preemption and RoundRobin algorithm. It runs the highest-priority processes first, using round-robin technique
among processes of equal priority. If a new job arrives, scheduler inserts it in the run queue
behind all processes of greater or equal priority.
DRAWBACK- The biggest disadvantage of the priority-based scheduling is the concept of
priority itself! If we add a lot of processes to a queue with varying priorities assigned to them,
chances are that the processes with the least priority will never run if more processes keep on
coming.
ADVANTAGE- The main advantage of Priority-based scheduling is that it uses round-robin
technique to make sure that a single job does not hog the resources of the processor.
With the basic scheduling techniques discussed, we present an overview and comparison of
different scheduling algorithms in the table that follows
Comparison Table:
Algorithm
CPU Overhead
Throughput
FCFS/FIFO
SJF
Round-Robin
Priority-based
Low
Medium
High
Medium
Low
High
Medium
Low
Turnaround
Time
High
Medium
Medium
High
Response Time
Low
Medium
High
High