0% found this document useful (0 votes)
16 views3 pages

Operating System

The document outlines various CPU scheduling algorithms and resource management techniques, including preemptive and non-preemptive priority scheduling, FCFS, SJF, and Round Robin. It also covers resource allocation and deadlock avoidance using the Banker's algorithm, as well as page replacement strategies for memory management. Additionally, it discusses disk scheduling algorithms such as SSTF, SCAN, and FCFS for optimizing disk head movements.

Uploaded by

kartik101203
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)
16 views3 pages

Operating System

The document outlines various CPU scheduling algorithms and resource management techniques, including preemptive and non-preemptive priority scheduling, FCFS, SJF, and Round Robin. It also covers resource allocation and deadlock avoidance using the Banker's algorithm, as well as page replacement strategies for memory management. Additionally, it discusses disk scheduling algorithms such as SSTF, SCAN, and FCFS for optimizing disk head movements.

Uploaded by

kartik101203
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/ 3

Operating System

1. For the following processes, draw Gantt chart to illustrate the execution using,
a) Preemptive priority scheduling
b) Non-Preemptive priority scheduling.
Also Calculate average waiting time and average turnaround time. (Assumption: A larger priority number has
higher priority.)

Process Arrival Time Burst Time Priority


A 0 5 4
B 2 4 2
C 2 2 6
D 4 4 3

2. Consider the set of 5 processes whose arrival time and burst time are given below. If the CPU scheduling policy is
FCSF, SJF pre-emptive, SJF non -pre-emptive calculate the average waiting time and average turnaround time.

Process Id Arrival time Burst time


P1 3 1
P2 1 4
P3 4 2
P4 0 6
P5 2 3

3. Consider the set of 6 processes whose arrival time and burst time are given. If the CPU scheduling policy is
shortest remaining time first, calculate the average waiting time and average turnaround time.

Process Id Arrival time Burst time


P1 0 7
P2 1 5
P3 2 3
P4 3 1
P5 4 2
P6 5 1

4. Consider the set of 5 processes whose arrival time and burst time are given below. If the CPU scheduling policy is
Round Robin with time quantum = 2 unit, calculate the average waiting time and average turnaround time.

Process Id Arrival time Burst time


P1 0 5
P2 1 3
P3 2 1
P4 3 2
P5 4 3

5. Consider the set of 5 processes whose arrival time and burst time are given below. If the CPU scheduling policy is
priority non-preemptive, calculate the average waiting time and average turnaround time. (Higher number
represents higher priority).
Process Id Arrival time Burst time Priority
P1 0 4 2
P2 1 3 3
P3 2 1 4
P4 3 5 5
P5 4 2 5
6. Five batch jobs A to E arrive at same time. They have estimated running times 10, 2, 6, 8, 4 minutes. Their
priorities are 3, 2, 5, 4, 1 respectively with 5 being highest priority. For each of the following algorithm determine
mean process turnaround time. Ignore process swapping overhead. Round Robin (q=3), Priority Scheduling, FCFS,
SJF.

7. Five batch jobs A to E arrive at same time. They have estimated running times 10,6,2,4 and 8 minutes. Their
priorities are 3,5,2,1 and 4 respectively with 5 being highest priority. For each of the following algorithm
determine mean process turnaround time. Ignore process swapping overhead. Round Robin (q=2), Priority
Scheduling, FCFS, SJF.

8. Consider the given snapshot of a system with five processes (P0, P1, P2, P3, P4) and three Resources (A, B, C).

Allocation MAX Available


Process/Resource
A B C A B C A B C
P0 1 1 2 4 3 3 2 1 0
P1 2 1 2 3 2 2
P2 4 0 1 9 0 2
P3 0 2 0 7 5 3
P4 1 1 2 11 2 3
a) Calculate the content of Need Matrix.
b) Apply safety algorithm and check the current system is in safe state or not.
c) If the request from process P1 arrives for (1, 1, 0), can the request be granted immediately?

9. Consider the following snapshot of a system:

Allocation MAX Available


Process/Resource
A B C A B C A B C
P0 0 0 1 0 0 1 1 5 2
P1 1 0 0 1 7 5
P2 1 3 5 2 3 5
P3 0 6 3 0 6 5

a) How many resources are there of type (A, B, C)?


b) What are the contents of the Need matrix?
c) Is the system in a safe state? Why?
d) If a request from process P1 arrives for additional resources of (0, 5, 2), can the Banker's algorithm grant the
request immediately?
e) What would be the new system state after the allocation?

10.Consider the given references to the following pages by a program:


0, 9, 0, 1,8, 1, 8, 7, 8, 7, 1, 2, 8, 2, 7, 8, 2, 3, 8, 3
How many pages faults will occur if the program has three-page frames available to it and uses:
a) FIFO replacement
b) LRU replacement
c) Optimal replacement

11.Illustrate the following page-replacement algorithms.


a) FIFO
b) Optimal Page Replacement
Use the reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 for a memory with three frames.
12.Consider the following page reference string:
1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2,3, 6. How many page faults would occur for the following replacement
algorithms, assuming four frames? Remember all frames are initially empty, so your first unique pages will all cost
one fault each.LRU replacement, FIFO replacement.

13.Suppose the following disk request sequence (track numbers) for a disk with 100 tracks is given:
45, 20, 90, 10, 50, 60, 80, 25, 70. Assume that the initial position of the R/W head is on track 49. Calculate the net
head movement using:
a) SSTF
b) SCAN
c) CSCAN
d) LOOK

14.A hard disk having 2000 cylinders, numbered from 0 to 1999. The drive is currently serving the request at cylinder
143, and the previous request was at cylinder 125. The status of the queue is as follows 86, 1470, 913, 1774, 948,
1509, 1022, 1750, 130 What is the total distance (in cylinders) that the disk arm moves to satisfy the entire
pending request for each of the following disk scheduling algorithms?
a) SSTF
b) FCFS

15.Suppose that a disk drive has 5000 cylinders, numbered 0 to 4999. The drive is currently serving a request at
cylinder 143, and the previous request was at cylinder 125. The queue of pending requests, in FIFO order, is - 86,
1470, 913, 1774, 948, 1509, 1022, 1750, 130. Starting from the current head position, what is the total distance
(in cylinders) that the disk arm moves to satisfy all the pending requests, for each of the following disk scheduling
– FCFS , SCAN ( elevator).

16.Disk requests come in to the disk for cylinders 10, 22, 20, 2, 40, 6 and 38. A seek takes 6 msec per cylinder move.
How much seek time is for Closest cylinder next algorithm? Initially arm is at cylinder 20. Starting track at 100.The
queue of pending request is, 55,58,39,18,90,160,150,38,184 – FCFS, SCAN ( elevator), SSTF,C SCAN

17.Suppose that a disk drive has 1000 cylinders, numbered 0 to 999. Assume last request received was at track 345
and the head is moving towards track 0. The queue of pending requests, in FIFO order, is
123,874,692,475,105,367. Perform following scheduling algorithm. FIFO, SSTF, SCAN, LOOK, C-SCAN, C-LOOK

18.Disk request come in to the driver for cylinder 10, 22, 20, 2, 40, 6 and 38. A seek takes 6 msec per cylinder moved.
How much seek time needed for FCFS, Closet cylinder next diagram. Initially arm is at cylinder 20.Starting track at
100. The queue of pending request is, 27,129,110,186,147,41,10,63,120 – SSTF, C-SCAN, C-LOOK.

19.Disk head is start at 53. The queue of pending request is, 98,183, 37,122,14,124,65,67. - FCFS, SSTF, SCAN, C-
SCAN, LOOK

20.Suppose that a disk drive has 5000 cylinders, numbered 0 through 4999.The drive is serving a request at cylinder
143. FIFO order is, 86, 1470, 913, 1774,948,1509,1022,1750,130 starting from head position. What is total
distance? FCFS, SSTF, SCAN, LOOK, C-SCAN, C-LOOK.

You might also like