Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
130 views

CS Operating-System PDF

Uploaded by

Shubham Saurav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views

CS Operating-System PDF

Uploaded by

Shubham Saurav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

No part of this publication may be reproduced or distributed in any form or any means, electronic, mechanical,

photocopying, or otherwise without the prior permission of the author.

GATE SOLVED PAPER


Computer Science Engineering
Operating System

Copyright © By NODIA & COMPANY

Information contained in this book has been obtained by authors, from sources believes to be reliable. However,
neither Nodia nor its authors guarantee the accuracy or completeness of any information herein, and Nodia nor its
authors shall be responsible for any error, omissions, or damages arising out of use of this information. This book
is published with the understanding that Nodia and its authors are supplying information but are not attempting
to render engineering or other professional services.

NODIA AND COMPANY


B-8, Dhanshree Tower Ist, Central Spine, Vidyadhar Nagar, Jaipur 302039
Ph : +91 - 141 - 2101150
www.nodia.co.in
email : enquiry@nodia.co.in
GATE SOLVED PAPER - CS
OPERATING SYSTEM

YEAR 2001

Q. 1 Which of the following statements is false ?


(A) Virtual memory implements the translation of a program’s address space
into physical memory address space.
(B) Virtual memory allows each program to exceed the size of the primary
memory.
(C) Virtual memory increases the degree of multi-programming
(D) Virtual memory reduces the context switching overhead.

. in
Q. 2 Consider a set of n tasks with known runtimes r1, r2, ........rn to be run on a

co
uniprocessor machine. Which of the following processor scheduling algorithms
will result in the maximum throughput ?

.
(A) Round-Robin (B) Shortest-Job-First
(C) Highest-Response-Ratio-Next

i a(D) First-come-First-Served

Q. 3

(A) RAM
o d
Where does the swap space reside ?
(B) Disk
(C) ROM
. n (D) On-chip cache

w
Consider a virtual memory system with FIFO page replacement policy. For an
Q. 4

w
arbitrary page access pattern, increasing the number of page frames in main
memory will.

w
(A) Always decrease the number of page faults

©
(B) Always increase the number of page faults
(C) Sometimes increase the number of page faults
(D) Never affect the number of page faults

Q. 5 Consider a machine with 64 MB physical memory and a 32-bit virtual address


space. If the page size is 4 KB, what is the approximate size of the page table ?
(A) 16 MB (B) 8 MB
(C) 2 MB (D) 24 MB

Q. 6 Consider Peterson’s algorithm for mutual exclusion between two concurrent


processes i and j . The program executed by process is shown below.
repeat
flag[i]=true;
turn=j;
while(p)do no-op;
Enter critical section, perform actions, then
exit critical section
Flag[i]=false;
Perform other non-critical section actions.
GATE SOLVED PAPER - CS OPERATING SYSTEM

Until false;
For the program to guarantee mutual exclusion, the predicate P in the while loop
should be
(A) flag [j]= true and turn =j (B) flag [j]=true and turn =j
(C) flag [i]=true and turn=j (D) flag [i]=true and turn=i

YEAR 2002

Q. 7 Which of the following scheduling algorithms is non-preemptive ?


(A) Round Robin
(B) First-In First-Out
(C) Multilevel Queue Scheduling
(D) Multilevel Queue Scheduling with Feedback

. in
co
Q. 8 The optimal page replacement algorithm will select the page that
(A) Has not been used for the longest time in the past.

.
(B) Will not be used for the longest time in the future.

i a
(C) Has been used least number of times.

d
(D) Has been used most number of times

o
Which combination of the following features will suffice to characterize an OS

.n
Q. 9
as a multi-programmed OS ? More than one program may be loaded into main

w
memory at the same time for execution. (B) If a program waits for certain events
such as I/O, another program is immediately scheduled for execution. (C) If the

w
execution of a program terminates, another program is immediately scheduled for

w
execution.
(A) A (B) A and B

©
(C) A and C (D) A, B and C

Q. 10 In the index allocation scheme of blocks to a file, the maximum possible size of
the file depends on
(A) The size of the blocks, and the size of the address of the blocks
(B) The number of blocks used for the index, and the size of the blocks.
(C) The size of the blocks, the number of blocks used for the index, and the size
of the address of the blocks.
(D) None of the above.

YEAR 2003 ONE MARK

Q. 11 Using a larger block size in a fixed block size file system leads to
(A) better disk throughput but poorer disk space utilization
(B) better disk throughput and better disk space utilization
(C) poorer disk throughput but better disk space utilization
(D) poorer disk throughput and poorer disk space utilization
GATE SOLVED PAPER - CS OPERATING SYSTEM

Q. 12 In a system with 32 bit virtual addresses and 1 KB page size, use of one-level
page tables for virtual to physical address translation is not practical because of
(A) the large amount of internal fragmentation
(B) the large amount of external fragmentation
(C) the large memory overhead in maintaining page tables
(D) the large computation overhead in the translation process

YEAR 2003 TWO MARKS

Q. 13 A uni-processor computer system only has two processes, both of which alternate
10 ms CPU bursts with 90 ms I/O bursts. Both the processes were created at
nearly the same time. The I/O of both processes can proceed in parallel. Which
of the following scheduling strategies will result in the least CPU utilizations
(over a long period of time) for this system ?
(A) First come first served scheduling
(B) Shortest remaining time first scheduling
(C) Static priority scheduling with different priorities for the two processes

. in
(D) Round robin scheduling with a time quantum of 5 ms .

Common Data For Q. 14 & 15


. co
i a
A processor uses 2-level page table fro virtual to physical address translation.

d
Page table for both levels are stored in the main memory. Virtual and physical

o
addresses are both 32 bits wide. The memory is byte addressable. For virtual to
physical address translation, the 10 most significant bits of the virtual address are

. n
used as index into the first level page table while the next 10 bits are used as

w
index into the second level page table. The 12 least significant bits of the virtual
address are used as offset within the page. Assume that the page table entries in

w
both levels of page tables are 4 a bytes wide. Further, the processor has a

w
translation look aside buffer(TLB), with a hit rate of 96%. The TLB caches
recently used virtual page numbers and the corresponding physical page numbers.

©
The processor also has a physically addressed cache with a bit ratio of 90%. Main
memory access time is 10 ns , cache access time is 1 ns , and {LB access time is
also 1ns .

Q. 14 Assuming that no page faults occur, the average time taken to access a virtual
address is approximately (to the nearest 0.5 ns )
(A) 1.5 ns (B) 2 ns
(C) 3 ns (D) 4 ns

Q. 15 Suppose a process has only the following pages in its virtual address space; two
contiguous code pages starting at virtual address 0 # 0000000, two contiguous
data pages starting at virtual address 0 # 00400000,and a stack page starting at
virtual address 0 # FFFFF000. The amount of memory required for storing the
page tables of this process is
(A) 8 KB (B) 12 KB
(C) 16 KB (D) 20 KB
GATE SOLVED PAPER - CS OPERATING SYSTEM

Common Data For Q. 16 & 17


Suppose we want to synchronize two concurrent processes P and Q using binary
semaphores S and T. The code for the processes P and Q is shown below.
Process P Process Q:
while(1) { while(1) {
W: Y:
print ‘0’; print ‘1’
print ‘0’; print ‘1’
X: Z:
} }
Synchronization statements can be inserted only at points W,X,Y and Z.
Q. 16 Which of the following will always lead to an output staring with ‘001100110011’ ?
(A) P(S) at W, V(S) at X, P(T) at Y, V(T) at Z, S and T inutuakkt 1

in
(B) P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S initially 1, and T initially 0

.
(C) P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S and T initially 1

co
(D) P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S initially 1, and T initially 0

Q. 17

a .
Which of the following will ensure that the output string never contains a substring

i
of the form 0.1” or 10”1 where n is odd?

d
(A) P(S) at W, V(S) at X, P(T) at Y, V(T) at Z, S and T initially 1

o
(B) P(S) at W, V(T) at X, P(T) at Y, V(S) at Z, S and T initially 1

.n
(C) P(S) at W, V(S) at X, P(T) at Y, V(S) at Z, S initially 1
(D) (S) at W, V(T) at X, P(T) at Y, P(S) at Z, S and T initially 1

w
YEAR 2004
w ONE MARK

Q. 18
w
Consider the following statements with respect to user-level threads and kernel-

©
supported threads
(i) Context which is faster with kernel-supported threads
(ii) For user-level threads. a system call can block the entire process
(iii) Kernel-supported threads can be scheduled independently
(iv) User-level threads are transparent to the kernel
Which of the above statements are true?
(A) (ii),(iii) and (iv) only (B) (ii) and (iii) only
(C) (i) and (iii) only (D) (i) and (ii) only

Q. 19 Consider an operating system capable of loading and executing a single sequential


user process at a time. The disk head scheduling algorithm used is First Come
First Served (FCFS). If FCFS is replaced by shortest seek Time Fist (SSTF),
claimed by the vendor to given 50% better beachmark results, what is the expected
improvement in the I/O performance of user programs?
(A) 50% (B) 40%
(C) 25% (D) 0%

Q. 20 The minimum number of page frames that must be allocated to a running process
in a virtual memory environment is determined by
(A) the instruction set architecture (B) page size
(C) physical memory size (D) number of processes in memory
GATE SOLVED PAPER - CS OPERATING SYSTEM

YEAR 2004 TWO MARKS

Q. 21 Consider the following set of processes, with the arrival times and the CPU-burst
times given in milliseconds
Process Arrival time Burst time
P1 0 5
P2 1 3
P3 2 3
P4 4 1
What is the average turnaround time for these processes with the preemptive
shortest remaining processing time first (SRPT) algorithm?
(A) 5.50 (B) 5.75
(C) 6.00 (D) 6.25

Q. 22 Consider a system with a two-level paging scheme in which a regular memory


access takes 150 nanoseconds, and servicing a page fault takes 8 milliseconds.
An average instruction takes 100 nanoseconds of CPU time, and two memory

in
accesses. The TLB hit ratio is 99%, and the page fault rate is one in every 10,000

.
instructions. What is the effective average instruction execution time?

co
(A) 645 nanoseconds (B) 1050 nanoseconds

.
(C) 1215 nanoseconds (D) 1230 nanoseconds

i a
d
Consider two processes P1 and P2 accessing the shared variables X and Y protected
Q. 23

o
by two binary semaphores Sx and Sy respectively, both initialized to 1. P and V

. n
denote the usual semaphore operators, where P decrements the semaphore value,
and V increments the semaphore value. The pseudo-code of P1 and P2 is as
follows:
w
w
P1: P2 :
while true while true

w do{ do{

©
L1:...... L3:......
L2:..... L4:.......
X=X+1; Y=Y+1;
Y+Y-1; X=Y-1;
V(SX); V(SY);
V(SY); } V(SX); }

In order to avoid deadlock, the correct operators at L1, L2, L3 and L4 are respectively
(A) P (SY ), P (SX ); P (SX ), P (SY ) (B) P (SX ), P (SY ); P (SY ), P (SX )
(C) P (SX ), P (SX ); P (SY ), P (SY ) (D) P (SX ), P (SY ); P (SX ), P (SY )

Q. 24 A Unix-style I-node has 10 direct pointers and one single, one double and one
triple indirect pointers. Disk block size is 1 Kbyte, disk block address is 32 bits,
and 48-bit integers are used. What is the maximum possible file size?
(A) 224 bytes (B) 232 bytes
34
(C) 2 bytes (D) 2 48 bytes
GATE SOLVED PAPER - CS OPERATING SYSTEM

YEAR 2005 TWO MARKS

Q. 25 Suppose n processes, P1,..... Pn share m identical resource units, which can be


reserved and released one at a time. The maximum resource requirement of
process Pi is sp where si < 0. Which one of the following is a sufficient condition
for ensuring that deadlock does not occur?
(A) 6i, s < m (B) 6i, s, < n
n n
(C) / si < (m + n) (D) / si < (m * n)
i=1 i=1

Q. 26 Consider the following code fragment:


if (fork()==0
{a = a + 5; print f ("%d,%/ n"a, and a);}; else {a - 5; print f ("%d,% d/n", a,& a);}
let u , vbe the values printed by the parent process, and x, y be the values printed
by the child process. Which one of the following is TRUE?
(A) u = x + 10 and v = y (B) u = x + 10 and v ! y

. in
(C) u + 10= x and v = y (D) u + 10 = x and v ! y

. co
YEAR 2006 ONE MARKS

i a
Q. 27 Consider three CPU-intensive processes, which require 10,20 and 30 time units
and arrive at times 0,2, and 6, respectively. How many context switches are needed

o d
if the operating system implements a shortes remaining time first scheduling
algorithm? Do not count the context switches at time zero and at the end

.n
(A) 1 (B) 2

w
(C) 3 (D) 4

YEAR 2006
w TWO MARKS

Q. 28
w
The atomic feth-and-set x, y instruction unconditionally sets the memory location

©
x to 1 and fetches the old value of x in y without allowing any intervening access
to the memory location x . Consider the following implementation of P and V
functions on a binary semaphore S.
void p (binary_semaphore*S){
unsigned y;
unsigned*x =& (S->value);}
do {
fetch-and-set x,y;
} while(y);
}
void V (binary_semphore*S){
{S_>value = 0;
}
Which one of the following is true?
(A) The implementation may not work if context switching is disabled in P
(B) Instead of using fetch-and-set, a pair of normal load/store can be used
(C) The implementation of V is wrong
(D) The code does not implement a binary semaphore
GATE SOLVED PAPER - CS OPERATING SYSTEM

Q. 29 A CPU generates 32-bit virtual addresses. The page size is 4 KB. The processor
has a translation look-aside buffer (TLB) which can hold a total of 128 page table
entries and is 4-way set associative.
The minimum size of the TLB tag is
(A) 11 bits (B) 13 bits
(C) 15 bits (D) 20 bits

Q. 30 A computer system supports 32-bit virtual addresses as well as 32-bit physical


addresses, Since the virtual address space is of the same size as the physical
address space, the operating system designers decide to get rid of the virtual
entirely. Which one of the following is true?
(A) Efficient implementation of multi-user support is no longer possible
(B) The processor cache organization can be made more efficient now
(C) Hardware support for memory management is no longer needed
(D) CPU scheduling can be made more efficient now

Q. 31 Consider three processes (process id 0,1,2, respectively) with compute time bursts

in
2,4, and 8 time units. All processes arrive at time zero. Consider the longest
remaining time first (LRTF) scheduling algorithm. In LRTF ties are broken by

.
giving priority to the process with the lowest process id . The average turn around

co
time is

.
(A) 13 units (B) 14 units

i a
(C) 15 units (D) 16 units

d
Q. 32 Consider three processes, all arriving at time zero, with total execution time of

o
10, 20 and 30 units, respectively. Each process spends the first 20% of execution

. n
time doing I/O, the next 70% of time doing computation, and the last 10% of
time doing I/O again. The operating system uses a shortest remaining compute

w
time first scheduling algorithm and schedules a new process either when the

w
running process get blocked on I/O or when the running process finishes its
compute burst. Assume that all I/O operations can be overlapped as much as

w
possible. For what percentage of time does the CPU remain idle?
(A) 0% (B) 10.6%

Q. 33
©
(C) 30.0% (D) 89.4%

Consider the following snapshot of a system running n processes. Process i is


holding xi instances of a resource R, for 1 # i # n . Currently, all instances of R
are occupied. Further, for all i , process i has placed a request for an additional y
, instances while holding the xi instances it already has, There are exactly two
processes p and q such that yp = yq = 0 : Which one of the following can serve as
a necessary condition to guarantee that the system is not approaching a deadlock?
(A) min(xp, xq) < maxk ! p, q yk (B) xp + xq # maxk ! p'q yk
(C) min(xp, xq) < 1 (D) min (xp, xq) > 1

Common Data For Q. 34 & 35


Barrier is a synchronization construct where a set of processes synchronizes
globally i.e. each process in the set arrives at the barrier and waits for all others
to arrive and then all processes leave the barrier. Let the number of processes in
the set be three and S be a binary semaphore with the usual P and V functions.
GATE SOLVED PAPER - CS OPERATING SYSTEM

Consider the following C implementation of a barrier with line numbers shown


on the left.
Void barrier(void) {
1 : P(S)
2 : Process_arrived++;
3 : V (S) :
4 : while (process_arrived’=3);
5 : P(S);
6 : Precess_left++;
7 : if(process_left==3)
8 : process_arrived=0;
9 : process_left+0;
10 : }

in
11 : V(S);

.
}
The variable process_arrived and process_left are shared among all processes

co
and are initialized to zero. In a concurrent program all the three processes call

.
the barrier function when they need to synchronize globally.
Q. 34

i a
The above implementation of barrier is incorrect. Which one of the following is

d
true?

o
(A) The barrier implementation is wrong due to the use of binary semaphore S

.n
(B) The barrier implementation may lead to a deadlock if two barrier
invocations are used in immediate succession

w
(C) Lines 6 to 10 need not be inside a critical section

w
(D) The barrier implementation is correct if there are only two processes
instead of three

Q. 35
w
Which one of the following rectifies the problem in the implementation?

©
(A) lines 6 to 10 are simply replaced by process_arrived
(B) At the beginning of the barrier the first process to enter the barrier waits
until process_arrived becomes zero before proceeding to execute P(S)
(C) Context switch is disabled at the beginning of the barrier and re-enabled at
the end.
(D) The variable process_left is made private instead of shared

YEAR 2007 ONE MARK

Q. 36 Group-1 contains some CPU scheduling algorithms and group-2 contains some
applications. Match entries in Group-1 entries in Group-2
Group-1 Group-2
P. Gang Scheduling 1. Guaranteed Scheduling
Q. Rate Monotonic Scheduling 2. Real-time Scheduling
R. Fair Share scheduling 3. Thread Scheduling

(A) P-3;Q-2;R-1 (B) P-1;Q-2;R-3


(C) P-2;Q-3;R-1 (D) P-1;Q-3;R-2
GATE SOLVED PAPER - CS OPERATING SYSTEM

Q. 37 Consider the following statements about user level threads and kernel level
threads. Which one of the following statements is FALSE?
(A) Context switch time is longer for kernel level threads than for user level
threads
(B) User level threads do not need any hardware support
(C) Related kernal level thread can be scheduled on different processors in a
multiprocessor system
(D) Blocking one kernel level thread blocks all related threads

YEAR 2007 TWO MARKS

Q. 38 An operating system uses Shortest Remaining Time first (SRT) process scheduling
algorithm. Consider the arrival times and execution times for the following
processes
Process Execution time Arrival time
P1 20 0
P2 25 15

in
P3 10 30

.
P4 15 45

co
What is the total waiting time for process P2?
(A) 5 (B) 15
(C) 40

a .(D) 55

Q. 39

d i
A virtual memory system uses first In First Out (FIFO) page replacement policy

o
and allocates a fixed number of frames to a process. Consider the following

n
statements:

.
P: Increasing the number of page frames allocated to a process sometimes increases

w
the page fault rate.
Q: Some program do not exhibit locality of reference.

w
Which one of the following is TRUE?

w
(A) Both P and Q are ture, and Q is the reason for P
(B) Both P and Q are true, but Q is not the reason for P

Q. 40
©
(C) P is false, but Q is true (D) Both P and Q are false

A single processor system has three resource types X, Y, and Z, which are shared
by three processes. There are 5 units of each resource type. Consider the following
scenario, where the column alloc denotes the number of units of each resource
type allocated to each process, and the column request denotes the number of
units of each resource type requested by a process in order to complete execution.
Which of these processes will finish LAST?
alloc request
XYZ XYZ
P0 121 103
P1 201 012
P2 221 120
(A) P0 (B) P1
(C) P2
(D) None of the above, since the system is in a deadlock
GATE SOLVED PAPER - CS OPERATING SYSTEM

Q. 41 Two processes, P1 and P2, need to access a critical section of code. Consider the
following synchronization construct used by the processes:
/* P1 */ /*P2*/
while (true) { while (true) {
wants1=true; wants2 = true;
while (wants1 ==
while(wants2==true); true);
/* Critical /* Critical
Section*/ Section*/
wants 1 = false; wants 2 = false;
} }
/* Remainder section*/ /*Remainder section*/

Here, wants 1 and wants 2 are shared variables, Which are initialized to false.

in
Which one of the following statements is TRUE about the above construct?
(A) It does not ensure mutual exclusion.
.
co
(B) It does not ensure bounded waiting.

.
(C) It requires that processes enter the critical section in strict alternation.

i a
(D) It does not prevent deadlocks, but ensures mutual exclusion

o d
.n
Common Data For Q. 42 & 43

w
A process has been allocated 3 page frames. Assume that none of the pages of

w
the process are available in the memory initially. The process makes the following
sequence of page references (reference string): 1,2,1,3,7,4,5,6,3,1.
Q. 42
w
If optimal page replacement policy is used, how many page faults occur for the

©
above reference string?
(A) 7 (B) 8
(C) 9 (D) 10

Q. 43 Least Recently Used (LRU) page replacement policy is a practical approximation


to optimal page replacement. For the above reference string, how many more page
faults occur with LRU than with the optimal page replacement policy?
(A) 0 (B) 1
(C) 2 (D) 3

YEAR 2008 ONE MARK

Q. 44 Which of the following system calls results in the sending of SYN packets?
(A) socket (B) bind
(C) listen (D) connect

Q. 45 The data block of a very large file in the Unix file system are allocated using
(A) Contiguous allocation (B) Linked allocation
(C) indexed allocation (D) an extension of indexed allocation
GATE SOLVED PAPER - CS OPERATING SYSTEM

YEAR 2008 TWO MARKS

Q. 46 The P and V operations on counting semaphores, where s is a counting ewmaphore,


are defined as follows:
P (s); s = s - 1;
ifs < 0 then wait;
V (s): s = s + 1;
ifs <= 0 then wakeup a process waiting on s ;
Assume that Pb and Vb the wait and signal operations on binary semaphores are
provided. Two binary semaphores Xb and Yb are used to implement the semaphore
operations P (s) and V (s) as follows:
P (s): Pb (X b);
s=s-1;
if (s<0){
Vb(Xb);
Pb(Yb);
}
else Vb(Xb);

in
P(s):Pb(Xb);

.
s=s+1;

co
if (s<=0){
Vb(Yb);

.
Vb(Xb);

a
The initial values of xb and yb are respectively
(A) 0 and 0
(C) 1 and 0
d i (B) 0 and 1
(D) 1 and 1

n o
.
Q. 47 Which of the following statements about synchronous and asynchronous I/O is
NOT true?

w
(A) An ISR is invoked on completion of I/O in synchronous I/O but not in

w
asynchronous I/O
(B) In both synchronous and asynchronous I/O an ISR (Interrupt Serive

w
Routine) is invoked after completion of the I/O

©
(C) A process making a synchronous I/O cal waits until I/O is complete, but a
process making an asynchronous I/O call does not wait for completion of
the I/O
(D) In the case of synchronous I/O, the process waiting for the completion of
I/O is woken up by the ISR that is invoked afterr the completion of I/O

Q. 48 Which of the following is NOT true of deadlock prevention and deadlock avoidance
schemes?
(A) In deadlock prevention, the request for resources is always granted if the
resulting state is safe
(B) In deadlock avoidance, the request for resources is always granted if the
resulting state is safe
(C) Deadlock avoidance is less restrictive than deadlock prevention
(D) Deadlock avoidance requires knowledge of resource requirements a priori
GATE SOLVED PAPER - CS OPERATING SYSTEM

Q. 49 A process executes the following code for(i = 0' i < n; i ++)fork();


The total number of child processes created is
(A) n (B) 2n - 1
(C) 2n (D) 2n + 1 - 1

Q. 50 A processor uses 36 bit physical addresses and 32 bit virtual addresses, with a
page frame size of 4 Kbytes. Each page table entry is of size 4 bytes. A three level
page table is used for virtual-to-physical address translation, where the virtual
address is used as follows
: bits 30-31 are used to index into the first level page table,
: bits 21-29 are used to index into second level page table
: bits 12-20 are used to index into third level page table
: bits 0-11 are used as offset within the page
The number of bits required for addressing the next level page table (or page

in
frame) in the page table entry of the first, second and third level page table are
respectively.
.
co
(A) 20,20 and 20 (B) 24,24 and 24

.
(C) 24,24 and 20 (D) 25,25 and 24

i a
d
YEAR 2009 ONE MARK

o
Consider a system with 4 type of resources R1 (3 units), R2 (2 units), R3 (3 units),
Q. 51

.n
R4 (4units). A non-preemptive resource allocation policy is used. At any give
instance, a request is not entertained if it cannot be completely satisfied. Three

w
processes P1, P2, P3 request the resources as follows if executed independently.

w
Process P1: Process Process P3

w
t=0; requests 2 P2: t=0 ; request
units of R2 t=0 : 1 units of R4

©
request t=2 ; request
t=0; request 1
2 units 2 units of R1
units of R3
of R3 t=5 ; release 2
t=0; request 2 t=2 ; units of R1
units of R1 request t=8 ; request
t=5; release 1 1 units 1 units of R3
unit of R2 of R4 t=9 ; Finishes
and 1 units t=4 ;
of R1 request
t=7; release 1 1 units
units of R3 of R1
t=6 ;
t=8; request 2
release 1
units of R4
units of
t=10; Finishes R3
t=8 ;
Finishes

Which one of the following statements is TRUE if all three processes run
concurrently starting at time t = 0 ?
(A) All processes will finish without any deadlock
(B) Only P1 and P2 will be in deadlock
(C) Only P1 and P3 will be in deadlock
(D) All three processes will be in deadlock
GATE SOLVED PAPER - CS OPERATING SYSTEM

Q. 52 In which of the following page replacement policies, Belady’s anomaly may occur
(A) FIFO (B) Optimal
(C) LRU (D) MRU

Q. 53 The essential content(S) in each entry of a page table is/are


(A) virtual page number
(B) page frame number
(C) Both virtual page number and page frame number
(D) access right information

YEAR 2009 TWO MARKS

Q. 54 Consider a disk system with 100 cylinders. The requests to access the cylinders
occur in following sequence :
4, 34, 10, 7, 19, 73, 2, 15, 6, 20
Assuming that the head is currently at cylinder 50, what is the time taken to
satisfy all requests if it takes 1 ms to move from one cylinder to adjacent one and

in
shortest seek time first policy is used ?

.
(A) 95 ms (B) 119 ms

co
(C) 233 ms (D) 276 ms

.
Q. 55 In the following process state transition diagram for a uniprocessor system,

i a
assume that there are always some processes in the steady state :

o d
. n
w
w
w
Now consider the following statements :

©
I. If a process makes a transition D, it would result in another process making
transition A immediately
II A process P2 in blocked state can make transition E while another process
P1 is in running state
III The OS uses non-premptive scheduling
IV The OS uses non-premptive scheduling
Which of the above statement are TRUE ?
(A) I and II (B) I and III
(C) II and III (D) II and IV

Q. 56 The enter_CS ( ) and leave_CS ( ) functions to implement critical section of a


process are realized using test and set instruction as follows :
Void enter_cs (X)
{
while (test-and-set)(X)) :
}
Void leave_CS(X)
GATE SOLVED PAPER - CS OPERATING SYSTEM

{
X=0;
}
In the above solution, X is a memory location associated with the CS and is
initialized to 0. Now consider the following statements
I The above solution to CS problem is deadlock-free
II The solution is starvation free
III The processes enter CS in FIFO order
IV More than one process can enter CS at the same time
Which of the above statements are TRUE
(A) I only (B) I and II
(C) II and III (D) IV only

A multilevel page table is preferred in comparison to a single level page table for

in
Q. 57

translating virtual address to physical address because

.
(A) It reduces the memory access time to read or write and memory location

co
(B) It helps to reduce the size of page table needed to implement the virtual

.
address space of a process

i a
(C) If is required by the translation lookaside buffer

d
(D) If helps to reduce the number of page faults in page replacement algorithms.

o
.n
YEAR 2010 ONE MARK

w
Q. 58 Consider the methods used by processes P1 and P2 for accessing their critical
sections whenever needed, as given below. The initial values of shared boolean

w
variables S1 and S2 are randomly assigned.

w
Method used by P1 Method used by P2

©
While (S1==S2); While (S1!=S2);
Critical Section Critical Section
S1=S2; S2=not (S1)
While one of the following statements describes properties achieved ?
(A) Mutual exclusion nut nor progress (B) Progress but not mutual exclusion
(C) Neither mutual exclusion nor progress (D) Both mutual exclusion and progress

Q. 59 A system uses FIFO policy for page replacement. It has 4 page frames with no
pages loaded to begin with . The system first accesses 100 distinct pages in some
order and then accesses the same 100 pages but now in the reverse order .How
many page faults will occur ?
(A) 196 (B) 192
(C) 197 (D) 195

Q. 60 Which of the following statements are true ?


I Shortest remaining time first scheduling may cause starvation
II Preemptive scheduling may cause starvation
II Round robin in better than FCFS in terms of response time
(A) I only (B) I and III only
(C) II and III only (D) I, II and III
GATE SOLVED PAPER - CS OPERATING SYSTEM

YEAR 2010 TWO MARKS

Q. 61 The following program consists of 3 concurrent precesses and 3 binary semaphores.


The semaphores are initialized as S 0 = 1, S1 = 0, S2 = 0
Process P0 Process P1 Process P2
While (true){ wait (S1 ); wait (S2 )
wait (S 0 ); release (S 0 ); release (S 0 );
print ‘0’
release (S1 );
release (S2 );
}
How many times will precess P0 print ‘0’ ?
(A) At least twice (B) Exactly twice
(C) Exactly thrice (D) Exactly once

Q. 62 A system has n resources R 0 ..R n - 1, and k processes P0 ..Pk - 1.The implementation


of the resource request logic of each process Pi , is as follows:
if (i%2==0){

. in
co
if(i<n)request Ri;
if(i+2<n)request Ti+2;

.
}

i a
else {

d
if (i<n)request Rn-1;

o
if (i+2<n)request Rn-i-2;

n
}

.
In which one of the following situations is a deadlock possible ?
(A) n = 40, k = 26 (B) n = 21, k = 12
(C) n = 20, k = 10
w (D) n = 41, k = 19

w
YEAR 2011
w ONE MARK

©
Q. 63 Let the time taken to switch between user the kernel modes of execution be
t1 while the time taken to switch between two processes be t2 . Which of the
following is TRUE?
(A) t1 > t2 (B) t1 = t2
(C) t1 < t2
(D) nothing can be said about the relation between t1 and t2

Q. 64 A computer handles several interrupt sources of which the following are relevant
for this question.
* Interrupt from CPU temperature sensor (raises interrupt if CPU
temperature is too high)
* Interrupt from Mouse (raises interrupt if the mouse is moved or a button is
pressed)
* Interrupt from Keyboard (raises interrupt when a key is pressed or
released)
* Interrupt from Hard Disk (raises interrupt when a disk read is completed)
GATE SOLVED PAPER - CS OPERATING SYSTEM

Which one of these will be handled at the HIGHEST priority?


(A) Interrupt from Hard Disk
(B) Interrupt from Mouse
(C) Interrupt from Keyboard
(D) Interrupt from CPU temperature sensor

Q. 65 A thread is usually defined as a “light weight process” because an Operating


System (OS) maintains smaller data structures for a thread than for a process. In
relation to this, which of the following is TRUE?
(A) On per-thread basis, the OS maintains only CPU register state
(B) The OS does not maintain a separate stack for each thread
(C) On per-thread basis, the OS does not maintain virtual memory state

in
(D) On per-thread basis the OS maintains only scheduling and accounting

.
information

Q. 66

. co
Let the page fault service time be 10 ms in a computer with average6 memory

a
access time being 20 ns. If one page fault is generated for every 10 memory

i
d
accesses, what is the effective access time for the memory?

o
(A) 21 ns (B) 30 ns

.n
(C) 23 ns (D) 35 ns

YEAR 2011
w TWO MARKS

Q. 67
w
Consider the following table of arrival time and burst time for three processes P0,

w
P1 and P2.

©
Process Arrival Time Burst time
P0 0 ms 9 ms
P1 1 ms 4 ms
P2 2 ms 9 ms
The pre-emptive shortest job first scheduling algorithm is used. Scheduling is
carried out only at arrival or completion of processes. What is the average waiting
time for the three processes?
(A) 5.0 ms (B) 4.33 ms
(C) 6.33 ms (D) 7.33 ms

Q. 68 An application loads 100 libraries at startup. Loading each library requires exactly
one disk access. The seek time of the disk to a random location is given as 10 ms.
Rotational speed of disk is 6000 rpm. If all 100 libraries are loaded from random
locations on the disk, how long does it take to load all libraries? (The time to
transfer data from the disk block once the head has been positioned at the start
of the block may be neglected.)
(A) 0.50 s (B) 1.50 s
(C) 1.25 s (D) 1.00 s
GATE SOLVED PAPER - CS OPERATING SYSTEM

YEAR 2012 ONE MARK

Q. 69 A process executes the code


fork();
fork();
fork();
The total number of child processes created is
(A) 3 (B) 4
(C) 7 (D) 8

YEAR 2012 TWO MARKS

Q. 70 Consider the 3 processes, P1, P2 and P3 shown in the table.


Process Arrival Time Time Units Required
P1 0 5
P2 1 7
P3 3 4

in
The completion order of the 3 processes under the policies FCFS and RR2 (round

.
robin scheduling with CPU quantum of 2 time units) are

co
(A) FCFS: P1, P2, P3 RR2: P1, P2, P3

.
(B) FCFS: P1, P3, P2 RR2: P1, P3, P2

a
(C) FCFS: P1, P2, P3 RR2: P1, P3, P2
(D) FCFS: P1, P3, P2 RR2: P1, P2, P3

d i
o
Q. 71 Fetch_And_Add(X, i) is an atomic Read-Modify-Write instruction that reads

n
the value of memory location X, increments it by the value i, and returns the

.
old value of X, it is used in the pseudocode shown below to implement a busy-

w
wait lock. L is unsigned integer shared variable initialized to 0. The value of 0

w
corresponds to lock being available, while any non-zero value corresponds to the
lock being not available.

w
AcquireLock (L) {
while (Fetch_And_Add([, 1))

} ©
L = i

ReleaseLock (L {
L = 0;
}
This implementation
(A) fails as L can overflow
(B) fails as L can take on a non-zero value when the lock is actually available
(C) works correctly but may starve some processes
(D) works correctly without starvation

Q. 72 A file system with 300 GByte disk uses a file descriptor with 8 direct bloc
addresses, I indirect block address and 1 doubly indirect block address. The size
of each disk block is 128 Bytes and the size of each disk block address is 8 Bytes.
The maximum possible file size in this file system is
(A) 3 KBytes (B) 35 KBytes
(C) 280 KBytes (D) dependent on the size of the disk
GATE SOLVED PAPER - CS OPERATING SYSTEM

Q. 73 Consider the virtual page reference string


1, 2, 3, 2, 4, 1, 3, 2, 4, 1
on a demand paged virtual memory system running on computer system that has
main memory size of 3 page frames which are initially empty. Let LRU, FIFO
and OPTIMAL denote the number of page faults under the corresponding page
replacement policy. Then
(A) OPTIMAL < LRU < FIFO (B) OPTIMAL < FIFO < LRU
(C) OPTIMAL = LRU (D) OPTIMAL = FIFO

**********

. in
. co
i a
o d
.n
w
w
w
©
GATE SOLVED PAPER - CS OPERATING SYSTEM

ANSWER KEY
Operating System
1 2 3 4 5 6 7 8 9 10
(A) (B) (B) (C) (B) (B) (B) (B) (B) (B)
11 12 13 14 15 16 17 18 19 20
(A) (C) (A) (D) (C) (B) (C) (B) (D) (A)
21 22 23 24 25 26 27 28 29 30
(A) (D) (D) (C) (C) (D) (B) (A) (A) (C)
31 32 33 34 35 36 37 38 39 40
(A) (B) (B) (B) (B) (A) (D) (B) (B) (C)
41 42 43 44 45 46 47 48 49 50
(D) (A) (C) (D) (D) (C) (B) (C) (B) (B)
51 52 53 54 55 56 57 58 59 60
(A) (B) (A) (B) (C) (A) (B) (A) (A) (D)

in
61 62 63 64 65 66 67 68 69 70

.
(A) (B) (?) (D) (C) (B) (A) (D) (C) (C)

co
71 72 73

.
(B) (B) (B)

i a
o d
. n
w
w
w
©

You might also like