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

Assignment1_OS

The document presents an assignment on operating systems, detailing a scenario with five processes and their burst times, priorities, and turnaround times for various scheduling algorithms including FCFS, SJF, priority scheduling, and RR. It explains the concept of starvation in scheduling, providing examples and solutions such as aging, and identifies round robin and first come first serve as methods that do not suffer from starvation. The assignment includes Gantt charts for each scheduling method and a table summarizing the turnaround times for each process.

Uploaded by

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

Assignment1_OS

The document presents an assignment on operating systems, detailing a scenario with five processes and their burst times, priorities, and turnaround times for various scheduling algorithms including FCFS, SJF, priority scheduling, and RR. It explains the concept of starvation in scheduling, providing examples and solutions such as aging, and identifies round robin and first come first serve as methods that do not suffer from starvation. The assignment includes Gantt charts for each scheduling method and a table summarizing the turnaround times for each process.

Uploaded by

pandey1812
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Assignment-1

Sumbitted To:
Gaurav Kumar Pandey
(Faculty, CSE)

Submitted by:
Rishabh Anand MCA/10007/19

Subject: CA457 OPERATING SYSTEM


1. Consider the following scenario, there are five processes with burst time
Process Burst Time (ms) Priority
P1 1 1
P2 1 1
P3 2 4
P4 1 5
P5 5 2
The processes are assumed to have arrived in order P1, P2, P3, P4, P5 all at
time 0. find the turnaround time of each process for each of the following
scheduling algorithms FCFS, SJF, a non-pre-emptive priority (a smaller priority
implies a higher priority) and RR (quantum=1) scheduling. also, draw the Gantt
chart. (5)

Ans:

The processes are assumed to have arrived in the order P1, P2,P3,P4,P5 all at
time 0.

GANTT CHART
First Come, First serve:
____________________________________
| P1| P2| P3 |P4 | P5| FCFS
|____|___|______|___|_______|
0 1 2 4 5 10

Shortest Job first, Priority Scheduling:


_______________________________________
|P1| P2| P4 | P3 | P5 | SJF
|__|___|______|________|_______|
0 1 2 3 5 10

There is a tie between the priorities of P1 and P2. If P1 is scheduled


first:
_________________________________________
|P1| P2 | P5 | P3 | P4| Priority12
|__|____|_________|______|___|
0 1 2 7 9 10

or if for the tie between P1 and P2 priorities, P2 is scheduled first:

___________________________________________
|P2| P1 | P5 | P3 | P4| Priority21
|__|____|__________|_______|___|
0 1 2 7 9 10
Round Robin:
Quantum, given =1
_________________________________
|P1| P2| P3| P4| P5| P3| P5|RR
|__|___|___|___|___|___|___|
0 1 2 3 4 5 6 10

Turn around time for each process for every scheduling algorithm is:
Turn Around time= Finish Time-Arrival Time

FCFS SJF Priority1 Priority2 RR


P1 1 1 1 2 1
P2 2 2 2 1 2
P3 4 5 9 9 6
P4 5 3 10 10 4
P5 10 10 7 7 10

2. What is starvation? Which scheduling does not suffer from starvation explain
with an example.

Ans:

A starvation is a resource management problem condition which can occur when


multiple processes or threads compete for access to a shared resource. One process may
monopolies the resource while others are denied access.

If the scheduling algorithm is priority scheduling where the processes are


serviced in the order of their priorities, then the lower priority processes will experience
starvation due to the presence of higher priority processes.

It will occur:
a. If Priority scheduling is done, where all the processes are given higher priority
every time, but there is one process which is given low priority and it stays in
waiting period and is never executed.
The solution to the starvation problem is to assign a counter to each such low priority
task so that if these are delayed execution by cpu scheduler, they increment their
counter value and after a particular counter value these task gain more priority than any
other process and hence execution becomes inevitable, this technique is called Aging.

Example of starvation:
Consider a busy round-about in a big city where traffic from one side is always more
than other three sides. The traffic inspector opened the busy side and decided to wait
until the vehicles stop coming from that side before he opens the other side. This is the
condition of starvation as the vehicles will not stop coming from the busiest side and
meanwhile, all the other sides will be waiting for the signal to open.

Which scheduling method does not suffer?


The Round robin method or first come first serve basis are the scheduling methods
which does not suffer from starvation.
How?
In round robin scheduling, starvation problem is solved as here time quantum is already
decided. After time quantum execution, processor is assigned to other processes.

First come first serve scheduling methods may also suffer starvation if processes having
long execution time arrives first and the rest of the coming processes have to wait until
first process terminates or leave CPU due to some interrupt.

You might also like