Gate Questions Operating Systems (1)
Gate Questions Operating Systems (1)
4 The highest-response ratio next scheduling policy favours .............. jobs, but it also
limits the waiting time of .......... jobs.
5 Let m[0] ..m[4] be mutexes (binary semaphores) and P[0] ...P[4] be processes.
Suppose each process P[i] executes the following:
wait (m[i]); wait (m(m[(i+1) mod 4]))0;
.......
release (m[i]); release (m[(i+1) mod 4]);
This could Cause----------
a) Thrashing
b) Deadlock
c) Starvation, but not deadlock
d) None of the above
10 A system has 6 identical resources and N processes competing for them. Each
process can request atmost 2 resources. What value of N could lead to a deadlock?
11 Consider a system with 3 processes that share 4 instances of the same resource type.
Each process can request a maximum of K instances. Resource instances can be
requested and released only one at a time. The largest value of K that will always
avoid deadlock is ____.
a) Security is dynamic
b) The path for searching dynamic libraries is not known till runtime
c) Linking is insecure
d) Cryptographic procedures are not available for dynamic linking
16 A system shares 9 tape drives. The current allocation and maximum requirment of
tape drives for three processes are shown below:
P1 3 7
P2 1 6
P3 3 5
describe current state of the system indicating whether it is deadlocked or safe?
17 Consider a paging hardware with a TLB. Assume that the entire page table and all
the pages are in the physical memory. It takes 10 milliseconds to search the TLB and
80 milliseconds to access the physical memory. If the TLB hit ratio is 0.6, the
effective memory access time (in milliseconds) is _________.
20 In the following process state transition diagram for a uniprocessor system, assume
that there are always some processes in the ready state: Now consider the following
statements:
a) The producer will be able to add an item to the buffer, but the consumer can never
consume it.
b). The consumer will remove no more than one item from the buffer.
c). Deadlock occurs if the consumer succeeds in acquiring semaphore s when the
buffer is empty.
d). The starting value for the semaphore n must be 1 and not 0 for deadlock-free
operation.
26 Assume that for a certain processor, a read request takes 50 nanoseconds on a cache
miss and 5 nanoseconds on a cache hit. Suppose while running a program, it was
observed that 80% of the processor’s read requests result in a cache hit. The average
read access time in nanoseconds is ______.
27 The following are some events that occur after a device controller issues an interrupt
while process L is under execution.
(P) The processor pushes the process status of L onto the control stack.
(Q) The processor finishes the execution of the current instruction.
(R) The processor executes the interrupt service routine.
(S) The processor pops the process status of L from the control stack.
(T) The processor loads the new PC value based on the interrupt.
Which one of the following is the correct order in which the events above occur ?
A) QPTRS
B) PTRSQ
C) TRPQS
D) QTPRS
28 The following C program is executed on a Unix/Linux system:
#include <unistd.h>
int main ()
{
int i ;
for (i=0; i<10; i++)
if (i%2 == 0) fork ( ) ;
return 0 ;
}
The total number of child processes created is _____.
a. 26
b. 31
c. 33
d. 28
30 Consider three concurrent processes P1, P2 and P3 as shown below, which access a
shared variable D that has been initialized to 100.
a) 10
b) 40
c) 60
d) 80
31 Consider the following four processes with arrival times (in milliseconds) and their
length of CPU bursts (in milliseconds) as shown below:
These processes are run on a single processor using preemptive Shortest Remaining
Time First scheduling algorithm. If the average waiting time of the processes is 1
millisecond, then the value of Z is _____.
a) 2
b) 7
c) 1
d) 4
32 Consider allocation of memory to a new process. Assume that none of the existing
holes in the memory will exactly fit the process’s memory
requirement. Hence, a new hole of smaller size will be created if allocation is made
in any of the existing holes. Which one of the following statements is TRUE?
a) The hole created by worst fit is always larger than the hole created by first fit.
b) The hole created by best fit is never larger than the hole created by first fit
c) The hole created by first fit is always larger than the hole created by next fit
d) The hole created by next fit is never larger than the hole created by best fit
35 When the result of a computation depends on the speed of the processes involved
there is said to be
a) Cycle stealing
b) Race Condition
c) A time clock
d) A deadlock
36 System calls are usually invoked by using
a) a software interrupt.
b) polling.
c) an indirect jump.
d) a privileged instruction.
38 Consider the following statements with respect to user-level threads and kernel
supported threads.
(i) context switch 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.
43 Consider the following table of arrival time and burst time for three processes P0, P1
and P2.
Process Arrival time Burst Time
P0 0 ms 9 ms
P1 1 ms 4ms
P2 2 ms 9ms
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
44 Consider the 3 process, P1, P2 and P3 shown in the table The completion order of
the 3 processes under the policies FCFS and RR2 (round robin scheduling with CPU
quantum of 2 time units) are
a) FCFS: P1, P2, P3 RR2: P1, P2, P3
b) FCFS: P1, P3, P2 RR2: P1, P3, P2
c) FCFS: P1, P2, P3 RR2: P1, P3, P2
d) FCFS: P1, P3, P2 RR2: P1, P2, P
45 An operating system uses the Banker’s algorithm for deadlock avoidance when
managing the allocation of three resource types X, Y, and Z to three processes P0,
P1, and P2. The table given below presents the current system state. Here, the
Allocation matrix shows the current number of resources of each type allocated to
each process and the Max matrix shows the maximum number of resources of each
type required by each process during its execution.
There are 3 units of type X, 2 units of type Y and 2 units of type Z still
available. The system is currently in a safe state. Consider the following
independent requests for additional resources in the current state:
REQ1: P0 requests 0 units of X,
0 units of Y and 2 units of Z
REQ2: P1 requests 2 units of X,
0 units of Y and 0 units of Z
Which one of the following is TRUE?
a) Only REQ1 can be permitted
b) Only REQ2 can be permitted
c) Both REQ1 and REQ2 can be permitted
d) Neither REQ1 nor REQ2 can be permitted
I. Program counter
II. Stack
III. Address space
IV. Registers
a) I and II only
b) III only
c) IV only
d) III and IV only
49 Let the time taken to switch between user and 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
51 Consider the following statements about process state transitions for a system using
preemptive scheduling.
I. A running process can move to a ready state.
II. A ready process can move to a ready state.
III. A blocked process can move to a running state.
IV. A blocked process can move to ready state.
Which of the above statements are TRUE?
a. Bounded Waiting
b. Progress
c. Mutual Exclusion
d. All of these.
54 Consider the following set of processes, assumed to have arrived at time 0. Consider
the CPU scheduling algorithms Shortest Job First (SJF) and Round Robin (RR). For
RR, assume that the processes are scheduled in the order P 1, P2, P3, P4. If the time
quantum for RR is 4 ms, then the absolute value of the difference between the
average turnaround times (in ms) of SJF and RR (round off to 2 decimal places) is
_____.
(A) 5.0
(B) 5.25
(C) 5.50
(D) 5.75
55 Consider the following processes, with the arrival time and the length of the CPU
burst given in milliseconds. The scheduling algorithm used is preemptive shortest
remaining time first. The average turn around time of these processes is
milliseconds.
(A) 8.25
(B) 10.25
(C) 6.35
(D) 4.25
56 For the processes listed in the following table, which of the following scheduling
schemes will give the lowest average turnaround time?
(A) 7
(B) 8
(C) 9
(D) 10
59 Each of a set of n processes executes the following code using two semaphores a
and b initialized to 1 and 0, respectively. Assume that count is a shared variable
60 Which page replacement policy sometimes leads to more page faults when size of
memory is increased?
A.Optimal
B.LRU
C.FIFO
D.NONE OF THESE
61 In a paged segmented scheme of memory management, the segment table itself must
have a page table because:
A.The segment table is often too large to fit in one page.
B. Each segment is spread over a number of pages.
C. Segment tables point to the page table and not to the physical locations of the
segment.
D. The processor's description base register points to a page table.
62 A ROM is used to store the table for multiplication of two 8-bit unsigned integers.
The size of ROM required is
A. 256×16
B. 64K× 8
C. 4K×16
D. 64K×16
63 In a resident –OS computer, which of the following systems must reside in the main
memory under all situations?
A .Assembler
B.linker
C.loader
D.compiler
A.42
B.2
C.7
D.12
65 A counting semaphore was initialized to 10. Then 6 P (wait) operations and 4 V
(signal) operations were completed on this semaphore. The resulting value of the
semaphore
A.0
B.8
C.10
D.12
c. Preemptive scheduling
d. Non-preemptive scheduling
67 The following program consists of 3 concurrent processes and 3 binary semaphores.
The semaphores are initialized as S0=1, S1=0, S2=0.
A Atleast twice
B.Exactly twice
C.Exactly thrice
D.Exactly once
A.Windows
B.MAC
C.Ms-Dos
D.None of these
69 Who provides the interface to access the services of the operating system?
A.API
B.System call
C.Library
D.Assembly instruction
A.Round Robin
C.Highest-Response-Ratio-Next
D.First -Come-First-Serve
71 Which of the following system calls results in the sending of SYN packets?
A. Socket
B. Bind
C. Listen
D. Connect
72 An operating system uses Shortest Remaining Time first (SRT) process scheduling
algorithm. Consider the arrival times and execution times for the following
processes:
A.5
B.15
C.40
D. 55
73 Which of the following devices should get higher priority in assigning interrupts?
A Hard disk
B.printer
C keyboard
D.Floppy disk
74 Listed below are some operating system abstractions (in the left column) and the
hardware components. Which matching pairs are correct?
75
Which of the following options is correct about the windows operating
system?
77
Which of the following is an example of spooled device?
a. FCFS Scheduling
b. SJF Scheduling
c. Network Scheduling
d. SRTF Scheduling
79
Which of the following operating systems runs on the server?
a. Batch OS
b. Distributed OS
c. Real-time OS
d. Network OS
80
A processor needs software interrupt to
b) Implement co-routines
81
Consider a set of n tasks with known runtimes r1,r2,.....rn to be run on a uniprocessor
machine. Which of the following processor scheduling algorithms will result in the
maximum throughput?
a) Round-Robin
c) Highest-Response-Ratio-Next
d) First-Come-First-Served
82
The maximum number of processes that can be in Ready state for a computer system
with n CPUs is :
a) n2
b) n
c) 2n
d) Independent of n
83
Consider an arbitrary set of CPU-bound processes with unequal CPU burst lengths
submitted at the same time to a computer system. Which one of the following
process scheduling algorithms would minimize the average waiting time in the ready
queue?
(B) Round-robin with time quantum less than the shortest CPU burst
(D) Highest priority first with priority proportional to CPU burst length
84
Who is responsible for keeping the process from the program?
a. Operating system
b. CPU
c. Monitor
85
What is said to happen when the result of computation depends on the speed of the
processes involved?
a.A deadlock
c.Cycle stealing
d.Race condition
86 Suppose a processor does not have any stack pointer register. Which of the following
statements is true?
(A) It cannot have subroutine call instruction
(B) It can have subroutine call instruction, but no nested subroutine calls
(C) Nested subroutine calls are possible, but interrupts are not
(D) All sequences of subroutine calls and also interrupts are possible
87
Which of the following mechanisms is a locking mechanism?
a. Semaphore
b. PCB
c. Mutex
d. Binary Semaphore
88
Which of the following method is used to prevent threads or processes
from accessing a single resource?
a. PCB
b. Semaphore
c. Job Scheduler
90
A file is organized so that the ordering of data records is the same as or close to the
ordering of data entries in some index. Then that index is called
(A) Dense
(B) Sparse
(C) Clustered
(D) Unclustered
91
The following two functions P1 and P2 that share a variable B with an initial value
of 2 execute concurrently.
P1()
C = B – 1;
B = 2*C;
P2()
D = 2 * B;
B = D - 1;
The number of distinct values that B can possibly take after the execution is
(A) 3
(B) 2
(C) 5
(D) 4
92
What type of memory stores data in a swap file on a hard drive?
a. Secondary memory
b. Virtual memory
c. Low memory
d. RAM
93
The PCB is identified by ___________.
a. Real-Number
b. Binary Number
c. Store block
d. Integer Process ID
94
Which of the following statement is correct about fragmentation?
a. Batch OS
b. Distributed OS
c. Real-time OS
d. Network OS
96
Which of the following method is used to improve the main memory
utilization?
a. Swapping
b. Operating system
c. Memory stack
d. None of these.
97
Disk Operating System (DOS) is an example of ___.
a) PC OS
b) Multi-processor OS
c) Distributed OS
d) Real-Time OS
98 Three processes arrive at time zero with CPU bursts of 16,20 and 10 10 milliseconds.
If the scheduler has prior knowledge about the length of the CPU bursts, the
minimum achievable average waiting time for these three processes in a non-
preemptive scheduler (rounded to nearest integer) is _____________ milliseconds.
99
Which of the following component does not belong to PCB (Process
Control Block)?
a. CPU registers
d. Accounting information
100
Operating System is a _________ that provides an environment to help the user to
execute the programs.
101
A form of processing known as spooling is an acronym for ___.
102
A typical operating system that supports a multiprogramming environment will be
less than _________.
103
___ suggested the layered approach to lessen the design and implementation
complexities of an operating system.
104
Increasing the RAM of a computer typically improves performance because
105
By using ___ techniques, an operating system can create the illusion that a process
has its own processor with its own memory.
a) CPU Scheduling
b) Virtual Memory
c) Both A and B
b. Primality algorithms
c. Banker's algorithm
d. Deadlock algorithm
107
Which of the following scheduling reduces process flow time?
a. FCFS
b. LIFO
c. SJF
108
___ is a part of UNIX OS.
a) Kernel
b) Module
c) Core
d) Software
109
In real systems CPU utilization ranges from ___ for a lightly loaded system to ___
for heavily loaded systems.
a) 40%, 90%
b) 50%, 50%
c) 90%, 40%
d) 25%, 75%
110
When a process is waiting for the CPU, we can say it is in ___ state.
a) Ready
b) New
c) Running
d) Waiting
111
If process Pi is executing in its critical section, then no other processes can be
executing in their critical-sections. This is called a ___.
a) Bounded Waiting
b) Mutual Exclusion
c) Progress
a) Semaphores
b) Processes
c) Monitor
113
A condition where at least one of the resources is non-shareable in a system is called
___.
a) Mutual Exclusion
c) Circular Wait
114
___ algorithm is used where resources have multiple instances.
b) Banker’s
c) Resource Request
a) Program Switch
b) Context Switch
c) Process Switch
d) OS Switch
115
MAR stands for ___.
116
PTBR stands for ___.
a) FCFC Scheduler
b) FIFO Scheduler
c) Bob Scheduler
d) LIFO Scheduler
118
When a process is to be executed then only that page of the process, which needs to
be currently executed, is swapped into memory. This method is called a ___.
a) Demand Paging
b) Request Paging
c) Swap Paging
d) Change Paging
119
Which of the following programs is loaded first when starting a
computer?
a. Window desktop
c. Operating system
d. CMD
120
The operating system work between
121
Which of the following "semaphore" can take the non-negative integer
values?
a. Binary Semaphore
b. Counting Semaphore
c. Real Semaphore
122
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:
1. 11
2. 13
3. 15
4. 20
123
Thrashing occurs when
124
Given that a computer system has only 3 process.1st process is single threaded, 2nd
process is two threaded and 3rd process is 4 threaded. So total how many number of
page tables will be managed by the operating system?
125
Identify Correct Statements :
A. Forked Process shares the address space and other resources with the parent.
P1 0 11 2
P2 5 28 0
4
P3 12 2 3
P4 2 10 1
P5 9 16 4
Consider six memory partitions of sizes 200 KB, 400 KB, 600
KB, 500 KB, 300 KB and 250 KB, where KB refers to kilobyte.
These partitions need to be allotted to four processes of sizes 357
5 KB, 210 KB, 468 KB and 491 KB in that order. If the best fit
algorithm is used, which partitions are NOT allotted to any
process?
A computer installation has 1000K of main memory. The jobs
arrive and finish in the following sequence.
Job 1 requiring 200k arrives
Job 2 requiring 350k arrives
Job 3 requiring 300k arrives
Job 1 finishes
6
Job 4 requiring 120k arrives
Job 5 requiring 150k arrives
Job 6 requiring 80k arrives
(a) Draw the memory allocation table using Best Fit and First
fit algorithm.
(b) Which algorithm performs better for this sequence?
Consider the below set of processes that arrive at time zero. The
length of the CPU burst time given in millisecond. Calculate the
average waiting time, average turnaround time using FCFS and
SJF algorithms
Processes Burst Time
12 P1 5
P2 24
P3 16
P4 10
P5 3
14
Calculate the Need Matrix and give the safe sequence of the
processes.
P2 6
P3 8
P1 2 2
P2 1 1
P3 8 4
P4 4 2
P5 5 3
18
The processes are assumed to have arrived in the order P1, P2,
P3, P4, P5, all at time 0.
a. Draw four Gantt charts that illustrate the execution of these
processes using the following scheduling algorithms: FCFS, SJF,
non preemptive priority (a larger priority number implies a
higher priority), and RR (quantum = 2).
b. What is the turnaround time of each process for each of the
scheduling algorithms in part a?
c. What is the waiting time of each process for each of these
scheduling algorithms?
d. Which of the algorithms results in the minimum average
waiting time (over all processes)?
20
Suppose that we have free segments with sizes: 6, 17, 25, 14,
24 and 19. Place a program with size 13kB in the free segment
using first-fit, best-fit and worst fit?