Vous êtes sur la page 1sur 6

Submitted To: Submitted By:

Ms. Chavi Nitin Dhingra


39
B.Tech CSE-C1701
Q1.For the processes liked in table, draw a chart illustrating their execution using Priority
Scheduling. A larger priority number has higher priority.

a) Preemptive.

b) Non preemptive

Process Arrival Time Burst Priority


A 0.000 4 3
B 1.0001 3 4
C 2.0001 3 6
D 3.0001 5 5

Sol 1:

Pre-emptive:

Non-preemptive:

0.000 4.0001 7.0001


12.0001 15.0001
Q2.For a processes listed in Table, draw a chart illustrating their execution using:
a) First-Come-First-Served

b) Shortest Job First

c) Round Robin (Quantum=2)

d) Round Robin (Quantum=1)

Process Arrival Time Processing Time

A 0.000 3

B 1.001 6

C 4.001 4

D 6.001 2

Solution 2:

First Come First Served:

0.000 3.000 9.000

Shortest Job First

0.000 3.000 4.000 8.000 10.000


Round Robin (Quantum=2)

0.0 2.000 4.000 6.000 8.000 9.000 11.000


13.000 15.000

Round Robin (Quantum=1)

0.000 1.000 2.000 3.000 4.000 5.000 6.000

8.000 9.000 10.000 11.000 12.000 13.000

Q4.

a) Round robin can be termed as preemptive FCFS? Justify your answer with an example.

Sol 4(a)

Round robin can be termed as preemptive FCFS. In this the preemption takes place after fixed
time duration. It is FCFS because it executes processes in the order as they arrive in the queue
and it is preemptive because after a specific time period (quantum), it shifts the control to other
process for the same specific time period however this time period can be reduced if the
processing time of any process is less than the specific time period for that process only.
For example:

Process Arrival Time Processing Time (in ms)

A 0.000 3

B 1.001 6

C 4.001 4

D 6.001 2

Round Robin (Quantum=1)

0.000 1.000 2.000 3.000 4.000 5.000 6.000

8.000 9.000 10.000 11.000 12.000 13.000

In this example we see that the quantum is 1 and therefore we give every process a time
of 1millisecond to execute. The process A arrives at 0 millisecond it will be executed for
1 millisecond then B will come and executed for 1 millisecond, now as the process C will
come at 4 millisecond therefore it will again give 1 millisecond to first A then to B which
shows the FCFS feature and as it is shifting control after 1 millisecond to another process
this shows the preemption feature. After that C comes C executes for 1 millisecond, then
as arrival time of D is 6 therefore acc to FCFS it will execute process A. Now at 6 it will
execute D for 1 millisecond. then as A is fully executed it will give control to B (acc to
FCFS) then after 1 millisecond it will give control to C then to D then again to B as B is
not executed fully, then to C then B, C, B till complete execution of all processes.

(b). In what kind of an environment can round robin be implemented over FCFS?

Sol 4(b)

We will prefer to use round robin over FCFS where there are a number of processes in the queue
and some processes are of very long length and some are of very short length. Because in case of
FCFS if there comes a long length process before a short length process then the short process
will have to wait for a long time until large process fully executes which results in high average
waiting time of processes and if we will use round robin then the average waiting time of the
processes will be less than that of average waiting time of FCFS. Therefore we will prefer to use
round robin when there are short processes along with long processes in the queue.

Q5. How Deadlock prevention is different from deadlock avoidance?

Sol

In Deadlock prevention the four conditions of the deadlock that are mutual exclusive, hold and
wait, no preemption or circular wait become false. And in deadlock avoidance we use different
algorithm like Banker’s algorithm to avoid deadlock. In this the resources are allocated to
different processes acc to some specific rules which results in avoidance of deadlock.

Vous aimerez peut-être aussi