OS Assignment

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

1.

Consider the following snapshot of the system


Process Allocation Max Available
A B C D A B C D A B C D
P0 2 0 0 1 4 2 1 2 3 3 2 1
P1 3 1 2 1 5 2 5 2
P2 2 1 0 3 2 3 1 6
P3 1 3 1 2 1 4 2 4
P4 1 4 3 2 3 6 6 5
Answer the following questions using Bankers Algorithm
(i) Illustrate that the systems is in safe state by demonstrating an order in which the process may complete
(ii) If a request from the process P1 arrives for(1,1,0,0),can the request be granted immediately?
If the request from P4 arrives for(0,0,2,0)can the request be granted immediately?

2. State the need for page replacement. State and explain procedure for FIFO with example.What is Beladys
anomaly?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 page replacement algorithms,assuming one,two,three,four,five,six or seven frames?Remember all
frames are initially empty,so your first unique pages will all cost one fault each.
• LRU replacement
• FIFO replacement
Optimal replacement
3. Consider the following set of processes with the length of CPU-burst time given in milliseconds
Process Burst time Priority Arrival Time
P1 10 3 0
P2 1 1 1
P3 2 3 2
P4 1 4 1
P5 5 2 2
Draw the Gantt Chart for the execution of these processes using FCFS,SJF.SRTS,Pre-emptive and Non Pre-emptive priority,
round robin with time slice of 2 ms.Find the average waiting time using each of the methods

4. 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 was at cylinder 125.The queue of pending requests,in FIFO order is
86,1470,913,1774,948,1509,1022,1750,130.Startinf from the current head position,what is then total distance(in
cylinders)that the disk arm moves to satisfy all the pending requests for SCAN.
5. Suppose that the disk rotates at 7200 rpm
(i) What is the average latency of the disk drive?
(ii) Identify seek distance can be covered in the time?
6. Consider a memory system with a cache access time 10ns and a memory access time of 110 ns,
assume the memory access time includes the time to check the cache. If the effective access time is
10% greater than the cache access time, what is the hit ratio H?

7.
Explain the FCFS, preemptive and non-preemptive versions of Shortest-Job First andRound Robin
(time slice = 2) scheduling algorithms with Gantt charts for the fourProcesses given. Compare their
average turnaround and waiting time. (NOV/DEC2018)
Process ArrivalTime WaitingTime
P1 0 8
P2 1 4
P3 2 9
P4 3 5
8

Consider the following set of processes, with the length of the CPU
– burst time givenin Milliseconds:
Process BurstTime Priority
P1 10 3
P2 1 1
P3 2 3
P4 1 4
P5 5 2
The processes are arrived in the order P1,P2,P3,P4,P5,all time0.

9. Explain the FCFS, preemptive and non-preemptive versions of Shortest-


Job First and Round Robin (time slice = 2) scheduling algorithms with Gantt
charts for the four Processes given.Comparetheiraverageturnaround and
waiting time.

Process ArrivalTime WaitingTime


P1 0 10
P2 1 6
P3 2 12
P4 3 15
10. Consider the following set of processes, with the length of the CPU-
burst time ingiven ms:
Process BurstTime ArrivalTime
P1 8 0.00
P2 4 1.001
P3 9 2.001
P4 5 3.001
P5 3 4.001
Draw four Gantt charts illustrating the execution of these processes using
FCFC,SJF,PriorityandRR(Quantum=2)scheduling.Alsocalculatewaitingtimeandturnaroundtimeforeac
hscheduling algorithms
11. What is the average turnaround time for the following processes using
a) FCFS (3)
b) SJFnon-preemptive.(3)
c) PreemptiveSJF.(3)

ii)With example elucidate livelock.


12. What do you mean by term synchronization? 'What is Semaphore? Explain
how semaphore can used as synchronization tool. Consider a coke machine that
has 10 slots. The producer is the delivery person and the consumer is the student
using the machine- It uses the following three semaphores
12. Suppose that the disk rotates at 7200 rpm
(i)What is the average rotational latency of the disk drive ?
(ii)Identify seek distance can be covered in the time ?
13. On a disk with 1000 cylinders, numbers 0 to 999, Compute the number of tracks the disk arm
must move to satisfy the entire request in the disk queue. Assume the last received was at track 345
and the head is moving towards track 0.The queue in FIFO order contains requests for the following
tracks. 123,874,692,475,105 and 376.Find the seek length for the following scheduling algorithm. (1)
SSTF (2) LOOK (3) CSCAN

You might also like