Professional Documents
Culture Documents
~ DEPARTMENT OF MATHEMATICS
END SPRING SEMESTER EXAMINATION 2013
TIME: 3 HOURS DATE: FULL MARKS: 50
Subject: Theory of Operating Systems (MA41001)
No.of Students : 35 of M.Sc. IV th Year
Instructions:
(1) Answer any five questions.
(2) Question No. 5 is Compulsory.
(3) All parts of a question are to be answered at one
place.
Q1. (a) Give Peterson's algorithm to implement mutual exclusion among n concurrent
processes. How can you implement mutual exclusion using Disable Interrupt
(DI) and Enable Interrupt (EI)? Give reasons why this implementation is not
used.
(3+1+1 =5)
(c) Draw a Gnatt chart for the RR scheduling algorithm for time quantum= 2 and
time quantum = 1 for the following snapshot.
Process Arrival time CPU time
A 0.000 3
B 1.00 I 6
c 4.001 4
D 6001 2
Also measure average waiting time and average turnaround time for both cases.
(2+2=4)
Q2. (a)Define a deadlock. Give five examples of deadlocks. List the necessary conditions
which are responsible for a deadlock to occur. Prove that a deadlock can not occur
in a system with hierarchical process communication.
(1+1+1+2= 5)
(b) Define wait(v) and signal(v) operations on Semaphore v. State the synchronizing
rules and establish the communication invariant for Semaphores.
(1+1+1=3)
(c ) Can a thread ever be preempted by a clock interrupt? If so under what
circumstances? If not, why not?
(2)
I
I ~
Q3. (a) Consider the following sequence of memory references from a 460 words
Program
10. I L 104. 170,73,309, 185,245,246,434,458,364
List the page trace for this sequence assuming a page size of 118 words.
Using this page trace, obtain the failure frequency of LRU page remO\ a!
algorithm when 4 memory blocks are available. )
(4)
(b) Give language constructs for a Critical Region (CR) and a Conditional Critical
Region (CCR). Implement Critical regions among n concurrent processes by
using Semaphores. Justify your implementation by giving proper reasoning.
(1 +I+ 2+ I =c5)
(c) For the decimal virtual address 8300, compute the virtual page number and offset
for a 4 KB page.
(I)
Q4. (a) State the Dinning Philosopher Problem. How deadlock and starvation problems
are connected to it? Give a solution to it by using conditional critical regions so
that it is free from deadlock and starvation problem.
(I+ 1+I +3 = 6)
(b) Consider a queuing system with a single processor, poisson input and
exponential service time which can hold a maximum of n jobs (including the one
in service). The system can be in (n+l) states with 0,1,2, ... ,or njobs waiting or
in service. Let Po, P 1... Pn denotes the steady state probabilities of these states.
Show that
Pn = pn (1- pn) / (1- pn+l)
where p = A.I!J. is the utilization factor.
(4)
Q5. (a) Name two devices used in a computer which are neither block oriented nor
character oriented.
(c) Indicate which of the following transitions between process states are not
possible.
(i) Run --7 Ready (ii) Run --7 Blocked (iii) Run --7 Zoombie
(iv) Run --7 Swapped-blocked
/
I
(d) A file whose file descriptor is fd contains the following sequ~nce of bytes:
3, 1,4, 1,5,92,6.5.3.5. The following system calls are made
lseek(fd,J,SEEK SET);
read (fd, &buffer. 4);
where the lseek call makes a seek to byte 3 of the file. What does the buffer
contains after the read has completed?
(e) Classify the following applications into batch processing and interactive
processmg
(i) Word processing
(ii) Generating monthly bank statements
(iii) Computing n to a million decimal places
(iv) A flight simulator
(g) Can the operating system and boot program which copies the operating
system into memory be located on the same disk? Justify your argument.
(h) What is the essential difference between a block special file and a character
special file?
(i) A computer
f
has a pipeline with four stages. Each stage takes the same time to do
its work, namely 1 nsec. How many instructions per second does this machine
execute?
Q6. (a) State the Sleeping Barber Problem. Solve it by using Semaphore for finite
capacity waiting room.
(1+3 =4)
(b) Write a multithreaded program to count the number of lines in four files
represented by Proc 1, Proc2, Proc3 and Proc4
(3)
(c) Explain the Dynamic Address Translation (DAT) mechanism of paged memory
management scheme. What do you mean by virtual memory? Draw a flow chart
to show how H/W and S/W interact in demand paged memory management
scheme.
(1+1+1=3)
********END************