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

BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, K.K.

BIRLA GOA CAMPUS


First Semester 2017-2018
Course Title : Operating Systems Course No : CS F372
Component : Comprehensive (Regular) Mode : Closed Book
Weightage : 40% Total pages: 4 Total Questions : 07 Max Marks : 120
Date : 12/12/2017 Time: 2:00 p.m. to 5:00 p.m. Duration : 3 hours

NAME: IDNO:
MARKS OBTAINED
RECHECK REQUEST: PART A PART B TOTAL

PART A [60 Marks]


Question #1: Memory Management [15 Marks]
A. The system follows 3 level hierarchical paging. Time taken for accessing TLB is 2nS. Time
taken for accessing MM is 100nS. The page fault service time when the victim page is dirty
(which includes all the time from the page fault till restarting the same instruction) is 400nS. The
page fault service time when the victim page is not dirty (which includes all the time from the
page fault till restarting the same instruction) is 200nS. At any point assume that 30% of the
pages are dirty pages. Find time taken to access data
case a. when TLB miss but page tables and data are available in MM.
case b. when TLB miss, all page tables are available in MM but results in page fault.

2M case a.

3M case b.

B. A 64 bit system with Virtual Memory support has 42 bits address bus width. The system has
2 GB RAM with 16 KB frame size. The system follows hierarchical paging. One entry in inner
most page table is 8 bytes long and the entry size doubles in each level from inner most to outer
most.
a. Divide the logical address so that all page tables fit in frame boundary.
b. How many frames are required in MM, if you what to store the largest possible program and
all its page tables in the MM? (Mention frames required for each component)
c. If the process is of 16 GB size, how many frames are required in MM to hold program and
all its page tables in MM? (Mention frames required for each component)

2M a

4M b

4M c

Page 1
Question #2: Memory Management [15 Marks]
A. Consider the following definition of memory allocation strategies. Best fit: The allocator
places a process in the smallest block of unallocated memory in which it will fit. Good fit:
The allocator maintains the list of holes in increasing order of memory size and places a
process in the smallest block of unallocated memory in which it will fit. Suppose the OS
currently has a list of unallocated blocks (holes) of 6KB, 14KB, 19KB, 11KB, and 13KB
blocks. a. Find the appropriate block of memory for a 12KB process according to Best fit and
Good fit allocation strategies. b. Find the time complexity of both the algorithms if N are the
total number of holes.
Best fit Good fit
4M Block

4M Time complexity

B. Consider a process having eight virtual pages on disk is assigned a fixed allocation of four
page frames in main memory. Apply LRU page replacement policy for the following page
requests and calculate the number of page faults. Assume that the frames are initially empty.
1 0 2 2 1 7 6 7 0 1 2 0 3 0 4 5 1 5 2 4 5.

7M

Question #3: Deadlock [10 Marks]


Consider the following snapshot of the system of five processes P0 to P4 and four resources A, B,
C and D. At time t, the number of instances of resource A, B, C and D available are 1, 0, 2 and 0
respectively.
A. Determine the maximum value of W, X, Y and Z which will leave the system in safe state
B. Find the safe sequence.
Processes Allocated Maximum Claim
A B C D A B C D
P0 W 0 1 0 4 2 1 1
P1 2 1 Y 0 11 2 3 2
P2 1 X 1 0 4 2 1 0
P3 1 1 0 Z 1 1 1 1
P4 2 1 0 0 0 0 1 0

4M A W= X= Y= Z=

6M B Safe sequence =

Page 2
NAME: IDNO:

Question # 4: Scheduling [20 Marks]


A. Find the static priority and base time quantum of the process with nice value 15.
B. Assume a system with 3 processes A, B and C. Processes A and B are under Group 1 and
Process C is under Group 2 with each group having weight of 0.5. The base priorities of
Processes A, B and C are 35, 32 and 37 respectively and the total execution time are 60, 120
and 90 time units respectively. If fair share scheduling decision making is in every 30 time
unit, find Normalized turnaround time of process A and Waiting period of process B.
C. Consider 4 processes A, B, C and D in a Uniprocessor system. xPy represents process P goes
for x units of I/O operation after every y units of execution. Following table shows arrival
time, execution time and xPy for all the processes. Scheduling policy is as follows: Assume
there are 3 queues Q0, Q1 and Q2 with priorities 0, 1 and 2 respectively. Q0 and Q1 follows
Round Robin with time quantum 1 and 2 respectively. Q2 follows FCFS. Process enters in Q0
initially and after completing I/O operation. If a process is preempted by a process in higher
priority queue, preempted process remains in the same queue at same position (i.e at head of
the queue) with remaining time quantum. If time quantum of a process expires, process is
moved to the next lower priority queue. Draw the schedule according to Multilevel
Feedback Scheduling Algorithm.

Process Arrival Time Execution Time xPy


A 0 7 5A3

B 2 9 2B5

C 4 6 CPU bound
D 8 8 1D4

2M A Static priority = Base time quantum =

8M B Normalized turnaround time of process A = Waiting period of process B =

10M

Page 3
PART B [60 Marks]

Q5. A. A barbershop consists of awaiting room with n chairs and a barber room with one barber
chair. If there are no customers to be served, the barber goes to sleep. If a customer enters the
barbershop and all chairs are occupied, then the customer leaves the shop. If the barber is busy
but chairs are available, then the customer sits in one of the free chairs. If the barber is asleep, the
customer wakes up the barber. Consider this as an instance of the Producer-Consumer problem.
Identify the producer(s), the consumer(s) and the contents and maximum size of the bounded
queue. Write the pseudocode to coordinate the barber and the customers.

B. Consider a typical disk that rotates at 15000 rotations per minute (RPM) and has a transfer
rate of 50 × 106 bytes/sec. If the average seek time of the disk is twice the average rotational
delay and the controller’s transfer time is 10 times the disk transfer time, the average time (in
milliseconds) to read or write a 512 byte sector of the disk is _____________. Explain your
answer. [12+8=20]

Q6. A. Given the following queue -- 95, 180, 34, 119, 11, 123, 62, 64 with the Read-write head
initially at the track 50 and the tail track being at 199. Give the time required to service the given
requests using each of the following algorithms.
(a) FCFS scheduling (b) SSTF scheduling (c) SCAN scheduling (d) C-SCAN scheduling,
(f) C-LOOK scheduling,

B. Show how to implement the wait() and signal() semaphore operations in multiprocessor
environments using the TestAndSet() instruction. The solution should exhibit minimal busy
waiting. [10+10=20]

Q7. A. Write a the pseudocode for a monitor that implements an alarm clock that enables a
calling program to delay itself for a specified number of time units (ticks). You may assume the
existence of a real hardware clock that invokes a procedure tick in your monitor at regular
intervals.

B. Servers can be designed to limit the number of open connections. For example, a server may
wish to have only N socket connections at any point in time. As soon as N connections are made,
the server will not accept another incoming connection until an existing connection is released.
Explain how semaphores can be used by a server to limit the number of concurrent connections.

C. Deadlock is defined as two or more processes are waiting indefinitely for an event that can be
caused by only one of the waiting processes. Give example of deadlock for 2 processes sharing
some common semaphore. [10+5+5=20]

Page 4

You might also like