FINALTERM EXAMINATION
FALL 2006 Marks: 75
CS604 - OPERATING SYSTEMS Time: 120min
StudentID/LoginID: ______________________________
Student Name: ______________________________
Center Name/Code: ______________________________
Exam Date:
Please read the following instructions carefully before attempting any
question:
1. This examination is closed book, closed notes, closed neighbors.
2. Answer all questions.
a. There is no choice.
b. You will have to answer all questions correctly in this examination to
get the maximum possible marks.
3. Do not ask any questions about the contents of this examination from
anyone.
a. If you think that there is something wrong with any of the questions,
attempt it to the best of your understanding.
b. If you believe that some essential piece of information is missing, make
an appropriate assumption and use it to solve the problem.
4. Examination also consists of multiple-choice questions. Choose only one
choice as your answer.
a. If you believe that two (or more) of the choices are the correct ones for
a particular question, choose the best one.
b. On the other hand, if you believe that all of the choices provided for a
particular question are the wrong ones, select the one that appears to
you as being the least wrong.
5. All Programming questions should be answered using C syntax. Errors of
syntax will
not be considered as errors. So try to only answer the question and put
your idea and
concept using C. Don’t use any tool or IDE.
**WARNING: Please note that Virtual University takes serious note of unfair
means. Anyone found involved in cheating will get an `F` grade in this
course.
For Teacher's use only
Question 1 2 3 4 5 6 7 8 9 10 Total
Marks
Question No: 1 ( Marks: 2 ) - Please choose one
Segmented paging incurs less internal fragmentation than pure process-level paging.
► True
► False
► Ambiguous question
Question No: 2 ( Marks: 2 ) - Please choose one
The Multi-Level Feedback Queue (MLFQ) scheduling algorithm is the same as Shortest-
Job-First.
► True
► False
► Ambiguous question
Question No: 3 ( Marks: 2 ) - Please choose one
In paging systems, external fragmentation cannot occur.
► True
► False
► Ambiguous question
Question No: 4 ( Marks: 2 ) - Please choose one
Race condition cannot occur on a uniprocessor.
► True
► False
► Ambiguous question
Question No: 5 ( Marks: 2 ) - Please choose one
A processor in ready state can only change to running or exit state.
► True
► False
► Ambiguous question
Question No: 6 ( Marks: 5 )
The following is a semaphore-based solution for the n-process critical section problem. Is it a
good solution? Explain your answer.
Question No: 7 ( Marks: 20 )
This is a string of memory page references:
1, 2, 3, 4, 3, 2, 1, 5, 3, 2, 5
Draw diagrams showing the frame usage at each memory reference for each of the following
page replacement algorithms. Also give the number of page faults generated by each
algorithm [FIFO – first in first out, LRU – least recently used and LFU – least frequently
used ].
Assume the system uses pure demand paging and starts with no pages in real memory. There
are three frames of real memory.
Note: Frame is the term uses for a page of real memory.
Question No: 8 ( Marks: 10 )
Given the following resource-allocation diagram,
(i) Draw the wait-for graph
(ii) Determine whether or not there is a deadlock.
If yes, justify clearly indicating the reason. If no, explain why there is no deadlock.
Question No: 9 ( Marks: 10 )
Suppose there are 2 copies of resource A, 3 copies of resource B, and 3 copies of resource C.
Suppose further that process 1 holds one unit of resources B and C and is waiting for a unit
of A; that process 2 is holding a unit of A and waiting on a unit of B; and that process 3 is
holding one unit of A, two units of B, and one unit of C. Draw the resource allocation graph.
Is the system in a deadlocked state? Why or why not?
Question No: 10 ( Marks: 20 )
(a) Given the following snapshot of a system, determine whether or not the system is in a safe
state.
SHOW YOUR WORK justifying your answer. (Use Banker’s algorithm)
Process Maximum need Current Available
ID allocation
R1 R2 R3 R1 R2 R3 R1 R2 R3
P1 3 2 3 2 2 2 1 1 2
P2 1 3 2 0 1 2
P3 4 4 4 0 2 2
P4 1 6 1 1 0 1
(b) Given the following resource-allocation state of a system at time T0, determine whether
or not the system is in deadlock at T0. Justify your answer.
Process New Request Current Current
ID allocation Available
R1 R2 R3 R1 R2 R3 R1 R2 R3
A 2 3 1 1 1 1 1 0 2
B 0 2 2 0 2 0
C 3 4 4 4 2 4
D 1 0 1 1 2 1