[go: up one dir, main page]

0% found this document useful (0 votes)
31 views26 pages

Operating Systems09

The document contains a series of practice questions related to operating systems, covering topics such as scheduling algorithms, process control blocks, memory management, and semaphore operations. Each question presents multiple-choice answers, testing the reader's understanding of key concepts in operating systems. The questions range from basic definitions to more complex scenarios involving process scheduling and memory allocation.

Uploaded by

Aakus REvol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views26 pages

Operating Systems09

The document contains a series of practice questions related to operating systems, covering topics such as scheduling algorithms, process control blocks, memory management, and semaphore operations. Each question presents multiple-choice answers, testing the reader's understanding of key concepts in operating systems. The questions range from basic definitions to more complex scenarios involving process scheduling and memory allocation.

Uploaded by

Aakus REvol
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

8 Operating System

Practice Questions
Q.1 A circular queue is the most appropriate (B) S2 and S3
data structure for (C) S1 and S3
(A) FCFS scheduling (D) S1, S2 and S3
(B) Round Robin scheduling Q.5 Which of the following will not be
(C) SJF scheduling included in the Process Control Block of
(D) None of these. a Process ?
Q.2 Which of the following is not possible? (A) Process State
(A) Run՜Ready (B) Program Counter
(B) Blocked՜Run (C) Priority
(C) New՜Ready (D) None of these
(D) Run՜Terminated Q.6 Which one of the following is NOT
Q.3 Which of the following does not shared by the threads of the same
interrupt a running process? process?
(A) A device (A) Stack
(B) Address Space
(B) Timer
(C) File Descriptor Table
(C) Scheduler process
(D) Message Queue
(D) Power failure
Q.7 How many process will be created when
Q.4 Consider the given statements
we run this program
S1 : If a user-level thread is blocked for
main( )
I/O operation, then other thread of same
process can be scheduled by operating {
system. printf(“Hello”)
S2 : Multiprogramming is used to fork ( );
improve CPU utilization. fork ( );
S3 : Multitasking is implemented to fork ( );
improve CPU responsiveness. }
Which of the given is/are true? (A) 2 (B) 8
(A) S1 and S2 (C) 4 (D) 7

Operating System 1
Q.8 On receiving an interrupt from an I/O Process Arrival Time Burst time
device, the CPU Id (msec) (msec)
(A) Halts for a predetermined time P1 0 4
(B) Hands over control of address bus P2 3 2
and data bus to the interrupting P3 5 1
device P4 1 3
(C) Branches of the interrupt service P5 7 5
routine immediately The absolute difference in average TAT
(D) Branches off the interrupt service of FCFS and SJF is _______ msec (upto
routine after completion of the 2 decimal places).
current instruction. Q.12 In a lottery scheduler with 40 tickets,
Q.9 Concurrent processes are distributed among 4 processes as 10%,
5%, 60%, and 25% tickets respectively.
(A) Do not overlap in time
Executing each ticket code it needs 1
(B) Overlap in time
msec. Processes P0 , P1 , P2 , P3 having
(C) Are executed by a processor at the
Input output operation of 5 msec, 8
same time
msec, 3 msec and 2 msec respectively.
(D) None of the above After executing code, the operating
Q.10 Consider the following set of process system uses a shortest remaining
with their arrival time and burst times compute time first scheduling algorithm
[MSQ] and schedules a new process either when
the running process gets blocked on
Process (msec) (msec)
Input output or when running process
Arrival time Burst time
finishes its compute burst. Assume that
P1 0 7 all Input output operations can be
P2 2 4 overlapped as much as possible for what
P3 3 5 percentage of time does the CPU
remains idle?
P4 1 2
[All process arrives at 0 msec, context
The average turnaround time and switch time 1 msec]
average waiting time are, if you are (upto two decimal places]
using shortest remaining time first Q.13 Consider 800 Kbytes memory is
(SRTF). managed using variable partitions, there
(A) Average TAT = 8.5 msec is no compaction used. If current two
(B) Average WT = 4 msec process of size 210 Kbytes and 140
Kbytes are allocated into memory. The
(C) Average TAT = 8.25 msec
smallest size of allocation request in
(D) Average WT = 4.25 msec Kbytes that can be denied is equal to
Q.11 Consider the following set of processes in (A) 450 (B) 151
process information table. (C) 400 (D) 451

2 Operating System
Q.14 Consider a system with specifications : Arrival time Burst time
Virtual address space 4 GB P1 1 4
Physical address space 4 GB P2 2 8
Page size 1 kB 3 5
P3
The TLB (Translation Look aside
P4 4 6
Buffer) used in the system which has
128 entries. The number of virtual If found robin scheduling (with time
addresses translated by the TLB is slice = 2 units) is used to schedule above
______. processes, then the number of context
Q.15 Consider three CPU-intensive switches (don’t consider start and end
processes, which require 10, 20 and 30 context switches) is_____
time units and arrive at times 0, 2 and 6 Q.19 Consider a system with five processes
respectively. How many context and a single resource of multiple
switches are needed if the operating instances.
system implements a shortest remaining Allocation Maximum needed
time first scheduling algorithm? P1 2 4
(Do not count the context switches at 2 3
P2
time zero and at the end)
(A) 1 (B) 2 P3 4 10
(C) 3 (D) 4 P4 3 8
Q.16 Let S be the binary semaphore variable P5 1 6
S=1 initially. Assume that no blocked
Then minimum number of resources
processes exit in the system. If the
need to be available, for the system to be
following operations performed how
in safe state is ____________.
many blocked processes are present in
Q.20 Consider a counting semaphore value as
the system at the end?
25, if 33 down operations are performed
5 P, 7 V, 10 P, 12 V, 18 P, 24 V
followed by 50 up operations, then
(A) 0 (B) 13
resultant value of semaphore is
(C) 14 (D) 11 _________.
Q.17 Consider the page references 1, 3, 5, 6, Q.21 What could be a possible output of
3, 1, 3, 5 following program:
Assume that main memory can main ( )
accommodate 3 pages and the main {
memory already has the page 1 and 3 fork ( );
with page. 1 having been brought earlier printf (“X”);
than page 3. If LRU algorithm is used, fork ( );
then number of page faults that occur printf(“Y”);
would be ________. fork( );
Q.18 Consider the following process table: printf(“Z”);

Operating System 3
} S2: Round robin scheduling behaves
(A) XYYZZZ identically to FIFO if all the job lengths
(B) XXYYYZZZZZ are longer than the length of the time
(C) XXYYYYZZZZ slice.
(D) XXYYYYZZZZZZZZ Which of the above arguments is
Q.22 Consider the following program correct?
segment, we want to synchronize (A) Only S1
process P and Q using semaphore X = 1, (B) Only S2
Y=0 (C) Both (A) and (B)
void Process P1 void process P2 (D) None of these
{ { Q.25 Consider a paged virtual memory
while (1) while (1) system with 32-bit virtual addresses and
{ { 1 KB page
P(X); P(X); size. Each page table entry requires 32
bits. It is desired to limit the page table
printf (“1”) printf(“0”)
size to one page. Assume multi-level
P(Y); V(X)
paging is used to implement the above
} V(Y)
requirement then how many level are
} }
required?
}
(A) 5 (B) 2
(While P and V are the usual semaphore
(C) 4 (D) 3
operation) what will be the output of the
Q.26 Consider the following set of processes
following program segment?
with their Arrival Times and Burst
(A) It will print 010101
Times
(B) It will print 001001
Process Arrival Burst
(C) It will print 101010
Time Time
(D) None of the above
P1 0 10
Q.23 Which of the following system call is
generally paired with fork ( ) in the P2 1 7
implementation of UNIX shell
[MSQ] P3 2 6
(A) exec() (B) pipe( ) P4 3 5
(C) ioctl() (D) wait()
Q.24 Consider the following two arguments: The average Turnaround time and
S1: FIFO scheduling results in the average waiting times are, if we are
shortest possible average response time using the Highest Response Ratio Next
if the jobs happen to arrive in the ready Scheduling algorithm is used. (Assume
queue with the shortest completion there is no pre-emption)
times first (or as a special case, if all jobs (A) 11.18 (B) 18.11
have the same completion time). (C) 10.17 (D) 17.10

4 Operating System
Q.27 Consider an operating system that uses Q.30 Virtual memory is
48-bit virtual addresses and 16KB (A) Part of Main memory only used for
pages. The system uses a hierarchical swapping
page table design to store all the page (B) A technique to allow a program, of
table entries of a process, and each page size more than the size of main
table entry is 4 bytes in size. What is the memory, to run
total number of pages that are required
(C) Part of secondary storage used in
to store the page table entries of a
program execution
process, across all levels of the
(D) None of these
hierarchical page table?
Q.31 The number of page frames that must be
(A) 222  1 (B) 210  1
allocated to a running process in a
(C) 222  210  1 (D) 222
virtual memory environment is
Q.28
determined by
P1: repeat P2: repeat
(A) The instruction set architecture
Obtain an empty Obtain a full
buffer buffer empty it (B) Page size
Fill it Return an empty (C) Number of processes in memory
Return a full buffer buffer forever (D) Physical memory size
forever Q.32 A particular parallel program
style = “font-weight : 400;”> increasing computation requires 100 sec when
the number of buffers is likely to do executed on a single processor. If 40 %
which of the following? of this computation is inherently
I. Increase the rate at which requests sequential (i.e. will not benefit from
are satisfied (throughput) additional processors), then
II. Decrease the likelihood of deadlock theoretically best possible elapsed times
III. Increase the ease of achieving a of this program running with 2 and 4
correct implementation processors, respectively, are
(A) III only (A) 20 sec and 10 sec
(B) II only (B) 30 sec and 15 sec
(C) I only (C) 50 sec and 25 sec
(D) II and III only (D) 70 sec and 55 sec
Q.29 Consider a job scheduling problem with Q.33 The Operating System of a computer
4 jobs J1 , J 2 , J 3 , J 4 and with may periodically collect all the free
corresponding deadlines: memory space to form contiguous block
(d1' d2' d3' d4 ) (4, 2, 4, 2) . Which of the of free space. This is called:
following is not a feasible schedule (A) Concatenation
without violating any job schedule? (B) Garbage collection
(A) J 2' J 4' J1' J 3 (B) J 4' J1' J 2' J 3 (C) Collision
(C) J 4' J 2' J1' J 3 (D) J 4' J 2' J 3' J1 (D) Dynamic Memory Allocation

Operating System 5
Q.34 Disk requests come to a disk driver for Which of the following option is
cylinders in the order 10, 22, 20, 2, 40, 6 correct?
and 38 at a time when the disk drive is (A) Only (b) (B) Only (d)
reading from cylinder 20. The seek time (C) Both (b) and (d) (D) None of these
is 6 ms/cylinder. The total seek time if Q.38 Consider a set of 5 processes whose
the disk arm scheduling algorithms is arrival time, CPU time needed and the
first-come-first-served is 360 ms priority are given below:
(A) 360 ms Process Arrival CPU Priority
(B) 850 ms Time Time
(C) 900 ms (in ms) Needed
(D) None of the above P1 0 10 5
Q.35 Four jobs to be executed on a single P2 0 5 2
processor system arrive at time 0 in the P3 2 3 1
order A, B, C, D. Their burst CPU time P4 5 20 4
requirements are 4,1,8,1 time units P5 10 2 3
respectively. The completion time of A
(smaller the number, higher the priority)
under round robin scheduling with time
If the CPU scheduling policy is priority
slice of one time unit is
scheduling without preemption, the
(A) 10 (B) 4
average waiting time will be
(C) 8 (D) 9
(A) 12.8 ms (B) 11.8 ms
Q.36 What is the output of the following (C) 10.8 ms (D) 9.8 ms
program?
Q.39 At a particular time of computation the
main ( ) value of a counting semaphore is 7. Then
{ 20 P operations and xV operations were
int a = 10: completed on this semaphore. If the new
if ((fork ( ) = = 0)) value of semaphore is 5, x will be
a++; (A) 18 (B) 22
printf(“%d\n”,a); (C) 15 (D) 13
} Q.40 Consider three CPU-intensive
(A) 10 and 11 (B) 10 processes, which require 10, 20 and 30
time units and arrive at times 0, 2 and 6,
(C) 11 (D) 11 and 11
respectively. How many context
Q.37 At a particular time, the value of a
switches are needed if the operating
counting semaphore is 10, it will
system implements a shortest remaining
become 7 after:
time first scheduling algorithm? Do not
(A) 3 V operations count the context switches at time zero
(B) 3 P operations and at the end.
(C) 5 V operations and 2 P operations (A) 1 (B) 2
(D) 2 V operations and 5 P operations (C) 3 (D) 4

6 Operating System
Q.41 Below is the precedence graph for a set which data structure is best suited ready
of tasks to be executed on a parallel queue of the processes.
processing system S. (A) Stack
T3 T6 (B) Queue
Start T4 T7
(C) Circular queue
T1 T2 End
(D) Tree
T5 T8 Q.44 Semaphores are used to solve the
What is the efficiency of this precedence problem of
graph on S if each of the tasks T1, T2, 1. Race condition
T3… T8 takes the same time and the 2. Process synchronization
system S has five processors? 3. Mutual exclusion
(A) 25 % (B) 40 % (A) 1 and 2
(C) 50 % (D) 90 % (B) 2 and 3
Q.42 Consider a set of 5 processes whose (C) All of the above
arrival time, CPU time needed and the (D) None of the above
priority are given below: Q.45 An operating system implements a
Process Arrival CPU Priority policy that requires a process to release
Priority Time Time all resources before making a request for
(in ms) Needed another resource.
(in ms) (A) Both starvation and deadlock can
P1 0 10 5 occur
(B) Starvation can occur but deadlock
P2 0 5 2
cannot occur
P3 2 3 1 (C) Starvation cannot occur but
P4 5 20 4 deadlock can occur
(D) Neither starvation nor deadlock can
P5 10 2 3 occur
Note: Smaller the number higher the Q.46 Suppose that a certain computer will
priority paged virtual memory has 4 KB pages, a
If the CPU scheduling Policy is SJF, the 32 bit byte addressable virtual address
average waiting time (without pre- space and, 30 bit byte-addressable
emption) will be physical address space. The system
(A) 12.8 ms manages an inverted page table. Where
(B) 6.8 ms each entry includes the page number
(C) 17 ms plus 12 overhead bits. How big is the
basic inverted page table including page
(D) None of the above
number and overhead bits?
Q.43 Suppose a system contains n processes
(A) 210 B (B) 220 B
and system uses the round robin
algorithm for CPU scheduling then (C) 230 B (D) 232 B

Operating System 7
The sequence of requests for blocks of
Common Data for
size, 150, 12.5, 62.5, 25 can be satisfied
Questions 47 & 48
if we use,
Consider a paging system with 16 MB of (A) First fit but not best fit policy
physical memory, 256 pages of logical (B) Best fit but not first fit policy
address space and page size of 1 KB. (C) Either first fit or best fit policy
Q.47 How many bits are in logical address (D) None of the above
space
Q.51 Consider system with specifications
(A) 8 bits (B) 12 bits
TLB hit rate 85%
(C) 18 bits (D) 16 bits
Q.48 Suppose that the head of a moving head TLB access time 5 msec
disk with 192 tracks, numbered 0 to 191, Memory access time 150 msec
is currently serving a request at track 80 ______ percentage memory access is
and has just finished at track 62. The slow down due to two level paging?
queue of the request is kept in the FIFO (rounded upto two decimal places).
order: 119, 58, 114, 28, 111, 55, 103, 30, Q.52 Consider a single level paging scheme.
75. What is the total number of tracks The logical address space is 8 MB and
traversed by head movements needed to page size is 4 kB. The maximum page
satisfy these request for the Elevator table entry size possible such that the
disk-scheduling algorithms? entire page table fits well in one page is
(A) 143 (B) 130 _____ bytes
(C) 177 (D) 547 Q.53 Consider a single level paging scheme.
Q.49 The correct matching for the following The virtual address space is 8 GB and
pairs is page table entry size is 4 bytes. The
A Disk 1 Round minimum page size possible such that
scheduling robin entire page table fits well into single
B Batch 2 SCAN page is _____ kB. (integer value only)
processing Q.54 Consider a system using multilevel
C Time sharing 3 LIFO paging scheme. The page size is 1 MB.
D Interrupt 4 FIFO The memory is byte addressable and
processing virtual address is 64 bits long. The page
(A) a-3, b-4, c-2, d-1 table entry size is 4 bytes, The number
(B) a-4, b-3, c-2, d-1 of bits required to search an entry in
(C) a-2, b-4, c-1, d-3 outer page table is _____
(D) a-3, b-4, c-3, d-2 Q.55 Consider a system with Logical address
Q.50 Consider the following heap in which space = physical address space
blank regions are not in use and hatched 216 Bytes. System uses segmented
regions are in use.
paging, pager apply on segment pages
are power of 2 in size and page table
25 75 150 175 300 entry size is 4 B. The page size of

8 Operating System
segment is _____, so that page table of What is the total waiting time for
segment exactly fit into one page. Let process P2?
consider LAS is divided into 8 equal size (A) 5 (B) 15
segment. (integer value only) (C) 40 (D) 55
Q.56 A CPU has two modes - privileged and Q.59 For the processes listed in the following
non-privileged. In order to change the table, which of the following scheduling
mode from privileged to non-privileged schemes will give the lowest turnaround
(A) A hardware interrupt is needed. time?
(B) A software interrupt is needed. Arrival Processing
Process
(C) A privileged instruction (which does time time
not generate an interrupt) is needed. A 0 3
(D) A non- privileged instruction (which B 1 7
does not generate an interrupt) is C 4 4
needed.
D 6 2
Q.57 Consider the following statements about
(A) First Come First Serve
user level threads and kernel level
(B) Non- preemptive Shortest Job First
threads.
(C) Shortest Remaining Time
Which one of the following statements
is FALSE? (D) Round Robin with Quantum value
two
(A) Context switch time is longer for
kernel level threads than for user Q.60 Consider three concurrent processes P1,
level threads. P2 and P3 as shown below, which access
(B) User level threads do not need any a shared variable D that has been
hardware support. initialized to 100
(C) Related kernel level threads can be P1 P2 P3
scheduled on different processors in : : :
a multi- processor system. : : :
(D) Blocking one kernel level thread D = D + 20 D = D – 50 D = D + 10
blocks all related threads. : : :
Q.58 An operating system uses Shortest : : :
Remaining Time First (SRT) process The processes are executed on a
scheduling algorithm. Consider the uniprocessor system running a time –
arrival times and execution times for the shared operating system .If the
following processes: minimum and maximum possible values
Execution Arrival of D after the three process have
Process
time Time completed are X of Y respectively, then
P1 20 0 the value of Y-X is _________.
P2 25 15 Q.61 Which of the following is NOT true of
P3 10 30 deadlock prevention and deadlock
P4 15 45 avoidance schemes?

Operating System 9
(A) In deadlock prevention, the request (B) Any implementation of a critical
for resources is always granted if the section requires the use of an
resulting state is safe indivisible machine – instruction
(B) In deadlock avoidance, the request such as test-and-set.
for resources is always granted if the (C) The use of monitors ensures that no
resulting state is safe deadlocks will be caused.
(C) Deadlock avoidance is less (D) The LRU Page- replacement policy
restrictive than deadlock prevention. may cause thrashing for some type
(D) Deadlock avoidance requires of programs.
knowledge of resource requirements Q.65 The capacity of memory units is defined
apriori. by the number of words multiplied by
Q.62 A system has 6 identical resources and the number of bits/work. How many
N processes competing for them. Each separate address and data lines are
process can request at most 2 resources. needed for a memory of 4K u 16?
Which one of the following values of N (A) 10 address, 16 data lines
could lead to a deadlock?
(B) 11 address, 8 data lines
(A) 1 (B) 2
(C) 12 address, 16 data lines
(C) 3 (D) 6
(D) 13 address, 12 data lines
Q.63 A system shares 9 tape drives. The
Q.66 Consider a machine with 64 MB
current allocation and maximum
physical memory and a 32- bit virtual
requirement of tape drives for that
address space. If the page size is 4KB,
processes are shown below:
what is the approximate size of the page
Current Maximum table?
Process
Allocation Requirement
(A) 16 M (B) 8MB
P1 3 7
(C) 2MB (D) 24MB
P2 1 6
Q.67 Consider a virtual memory system with
P3 3 5 FIFO page replacement policy. For an
Which of the following best describes arbitrary page access pattern, increasing
current state of the system? the number of page frames in main
(A) Safe, Deadlocked memory will
(B) Safe, Not Deadlocked (A) Always decrease the number of page
(C) Not Safe, Deadlocked faults
(D) Not Safe, Not Deadlocked (B) Always increase the number of page
Q.64 Indicate all the false statements from the faults
statements given below: [MSQ] (C) Sometimes increase the number of
(A) The amount of virtual memory page faults
available is limited by the (D) Never affect the number of page
availability of secondary storage. faults.

10 Operating System
Q.68 Assume that there are 3 page frames (B) Loop instructions cannot be
which are initially empty. If the page interrupted till they complete.
reference string is 1, 2, 3, 4, 2, 1, 5, 3, 2, (C) A processor checks for interrupts
4, 6, the number of page faults using the before executing a new instruction.
optimal replacement policy is ____. (D) Only level triggered interrupts are
Q.69 Consider a computer system with 40-bit possible on microprocessors.
virtual addressing and page size of Q.73 Consider a disk system with 100
sixteen kilobytes. If the computer cylinders. The requests to access the
system has a one- level page table per cylinders occur in following sequence:
process and each page table entry 4, 35, 10, 7, 19, 73, 2, 15, 6, 20
requires 48 bits, then the size of the per- Assuming that the head is currently at
process page table is______ megabytes. cylinder 50, what is the time taken to
Q.70 Recall that Belady’s anomaly is that the satisfy all requests if it takes 1 ms to
page-fault rate may increase as the move from one cylinder to adjacent one
number of allocated frames increases. and shortest seek time first policy is
Now, consider the following statements: used?
S1 : Random page replacement (A) 95 ms (B) 119 ms
algorithm (where a page chosen at (C) 233 ms (D) 276 ms
random is replaced) Q.74 An application loads 100 libraries at
startup. Loading each library requires
Suffers from Belady’s anomaly
exactly one disk access. The seek time
S2 : LRU page replacement algorithm
of the disk to a random location is given
suffers from Belady’s anomaly
as 10 ms. Rotational speed of disk is
Which of the following is CORRECT?
5000 rpm. If all 100 libraries are loaded
(A) S1 is true, S2 is true from random locations on the disk, how
(B) S1 is true, S2 is false long does it take to load all libraries?
(C) S1 is false, S2 is true (The time to transfer data from the disk
(D) S1 is false, S2 is false block once the head has been positioned
Q.71 Disk requests come to disk driver for at the start of the block may be
cylinders 10, 22, 20, 2, 40, 55 and 36, in neglected.)
that order at a time when the disk drive (A) 0.50 s (B) 1.00 s
is reading from cylinder 20. The seek (C) 1.6 s (D) 1.50 s
time is 6 msec per cylinder. Compute the Q.75 A FAT (File allocation table) based file
total seek time if the disk arm scheduling system is being used and the total
algorithm is overhead of each entry in the FAT is 4
(A) First come first served bytes in size. Given a 100 u 106 bytes
(B) Closest cylinder next disk on which the file system is stored
Q.72 Which of the following is true? and data block size is 103 bytes, the
(A) When interrupt is enabled, a CPU maximum size of a file that can be stored
will be able to process the interrupt. on this disk in units of 106 bytes is___.

Operating System 11
Answers Operating System

1. B 2. B 3. C 4. B 5. D

6. A 7. B 8. D 9. B 10. A,D

11. 0.6 12. 14.89 13. B 14. 131072 15. B

16. D 17. 3 18. 11 19. 1 20. 42

21. D 22. D 23. A,D 24. A 25. D

26. D 27. D 28. C 29. B 30 B

31. A 32. D 33. B 34. D 35. D

36. A 37. C 38. C 39. A 40 B

41. B 42. B 43. C 44. B 45. D

46. B 47. C 48. D 49. C 50. A

51. 33.33 52. 2 53. 181 54. 8 55. 181

56. D 57. D 58. B 59. C 60. 80

61. A 62. D 63. B 64. B,D 65. C

66. C 67. C 68. 7 69. 384 70. B

71. * 72. C 73. B 74. C 75. 99.6

Explanations Operating System

1. (B) 3. (C)
Round Robin scheduling uses circular queue for Scheduler cannot interrupt a running process,
its implementation. but Device, timer and power failure can
Hence, the correct option is (B). interrupt a running process
2. (B) Hence, the correct option is (C).
4. (B)
Blocked to ready then to run is possible
sequence. Operating system does not have information
about user level threads, it consider all threads
of a process as a single process itself.
If one thread of user level is doing I/O it block
entire user level process.
When many processes are present in main
Hence, the correct option is (B). memory, if one process is busy on input/output

12 Operating System
then other process can be scheduled on CPU 10. A,D
from main memory. Hence, multiprogramming
CT o Completion time
improve CPU utilization.
When CPU is time shared among multiple task TAT o Turn Around time
is known as multitasking. It is done to increase WT o Waiting Time
responsiveness. PID AT BT CT TAT WT
Hence, the correct option is (B). P1 0 6 18 18 12
5. (D) P2 2 4 7 5 1
Process Control Block (PCB) holds the P3 3 5 12 9 4
information about a process. P4 1 2 3 2 0
GANTT Chart
P1 P4 P4 P2 P3 P1
0 1 2 3 7 12 18
TAT = CT – AT
WT = TAT – BT
18  5  9  2
Avg. TAT 8.5
4
12  1  4  0
Avg. WT 4.25
4
Hence, the correct option is (D). Hence, the correct options are (A, D).
6. (A) 11. 0.6
Stack and register are not shared by the threads In FCFS
of the same process while address space,
P1 P4 P2 P3 P5
message queue etc. are shared.
0 4 7 9 10 15
Hence, the correct option is (A). AT CT TAT
7. (B) 0 4 4
The number of processes created = 3 9 6
2number of times the fork called 5 10 5
23 8 1 7 6
But the number of child processes = 23  1 7 7 15 8
8. (D)
46568
Average TAT 5.8
Branches off the interrupt service routine after 5
finishing current execution. In SJF
9. (B) P1 P2 P3 P4 P5
Concurrent processes overlap in time. 0 4 6 7 10 15

Operating System 13
AT CT TAT x 150 kB
0 4 4 Hence, smallest memory request that cannot be
3 6 3 fulfilled = 151 kB.
5 7 2 14. 131072
1 10 9
Logical address space 232 B
7 15 8
LA 32 bit
4  3  2  9  8 26 Page size 210 B
Average TAT 5.2 Each byte is an address and each page consist of
5 5
1024 addresses
Hence, absolute difference 5.8  5.2 0.6
Total addresses mapped by TLB number of
12. 14.89 TLB entries u number of address per page
Process CPU Tine Input/Output time 128 u1024
(msec) (msec) 131072
P0 4 5
15. (B)
P1 2 8
Given :
P2 24 3
Let three processes are P1 , P2 and P3
P3 10 2
Process Arrival time Burst time
Gantt Chart P1 0 10
PI
1 /O PI
1 /O
P2 I / O
P2 2 20
P1 P0 P3 P3 P2 P2
P3 6 30
0 1 3 4 6 8 9 13 19 20 4 44 47
P0 I / O The Gantt chart for SRTF scheduling algorithm
07 is
CPU remains idle u100
47 P1 P2 P3
14.89% 0 10 30 60
Hence, the correct answer is 14.89 So, there is only two context switches at time
13. (B)
unit 10 context switches P1 and P2 and at time
unit 30 context switch from P2 to P3 .
Hence, the correct option is (B).
16. (D)
Initially S 1
Consider memory is allocated in above manner.
x  140  x  210  x 800
P Down operation ()
3x  350 800 V Up operation ( )
3x 450 So,
450 1  5P 4
x
3 Now 4  7V 3

14 Operating System
3  10 7 21. (D)
7  12 5 The order of execution of processes are not
5  18 13 unique, that is they can execute in any manner.
13  24 11 But, there should be 2-X's and 4-Y’s and 8-Z’s
Hence, the correct option is (D). in the result.
17. 3 22. (D)

1, 3, 5, 6, 3, 1, 3, 5 Value of the semaphore X = 1 and Y = 0


165 If Process P1 execute first then after executing
3 the P(X), X value become 0 and it will print 1.
51
P(Y) is executed, value of semaphore Y is 0 so
Process P1 is blocked and if Process P2 , started
= 3 page faults
executing, after executing P(X). X value is 0 so
Hence, the correct answer is 3.
Process P2 , is also block this is a deadlock
18. 11
condition.
P1 P2 P3 P1 P4 P2 P3 P4 P2 P3 P4 P2 P2 can run forever and in that case output will be
Ready Queue: 00000….
So option (D) is correct.
P1 , P2 , P3 , P1 , P4 , P2 , P3 , P4 , P2 , P3 , P4 , P2
23. A,D
Hence, the correct answer is 11.
exec () will execute the given command and
19. 1 wait () will allow the parent to wait till child
Need matrix: completes.
So, exec () and wait ( ) system call is generally
Process Need
paired with fork ( ) in the implementation of
P1 2
UNIX shell
P2 1 24. (A)
P3 6 FIFO scheduling results in the shortest possible
P4 5 average response time if the jobs happen to
arrive in the ready queue with the shortest
P5 5 completion times first (or. as a special case, if
all jobs have the same completion time).
Resources required to be available is 1.
Round robin scheduling behaves identically to
20. 42 FIFO if the job lengths are No longer than the
Given: length of the time slice. So. SI is true. S2 is false.
Counting semaphore value = 25 25. (D)
33 down operations results semaphore value to 232 B
be 25  33 8 and 50 UP operations result Page table size of 1st level u 4B
210 B
semaphore value to be 8  50 42 224 B ! 1KB

Operating System 15
224 B 16 KB
Page table size of 2nd level u4B Each page can store 212 page table
210 B 4
216 B ! 1KB entries.
234
216 B So, the number of innermost pages 222
Page table size of 3rd level u 4B 2 12
210 B
Now, pointers to all these innermost pages must
28 B  1 KB
be stored in the next level of the page table,
So 3 level of page table required.
222
26. (D) So, the next level of the page table has 210
212
Gantt Chart pages
Processes P1 P4 P3 P2 Finally, a single page can store all the 210 page,
CT 10 15 21 28 table entries, so the outermost level has one
Ready Queue page. So, the total number of pages that store
AT 0 1 2 3 page table entries are 222  210  1.
Processes P1 P2 P3 P4 28. (C)
Response ratio of
It only satisfied statement I, because increasing
P2 (WT BT) / BT (9  7) / 7 2.285
the memory size increases the rate at which
Response ratio of requests are satisfied but can not alter the
P3 (WT BT) / BT (8  6) / 6 2.333 possibility of deadlock and neither does it play
Response ratio of any role in implementation.
P4 (WT BT) / BT (7  5) / 5 2.4 Hence, the correct option is (C).
Turnaround time of P1 10 29. (B)
Turnaround time of P2 28  1 27
Feasible schedule is completing all the jobs
Turnaround time of P3 21  2 19 within deadline.
Turnaround time of P 4 15  3 12 From the dead line, we can deduce that Job
Average Turnaround Time J 2 & J 4 will complete by time “2” whereas
(10  27  19  12) / 4 17
remaining two requires time “4”.
Waiting time of P1 = 0 So the order of completion of Jobs are Either
Waiting time of P2 = 21-1 = 20 J 2 or J 4 and followed by either J1 or J 3 .
Waiting time of P3 = 15 – 2 = 13
From the given option, option A, C & D gives
Waiting time of P4 = 10 – 3 = 7
the solution because after completion of jobs
Average Waiting Time
J 2 & J 4 then only jobs J1 & J 3 is going to
= (0 + 20 + 13 + 7)/4 = 10
complete.
27. (D)
But in option B, order of completing jobs is
Page size 214 bytes. J 4 , J1 , J 2 , J 3 which is not possible and it is not
248 feasible schedule
So, the number of page table entries 234
214 Hence, the correct option is (B).

16 Operating System
30. (B) 33. (B)
A computer can address more memory than the The Operating System of a computer may
amount physically installed on the system. This periodically collect all the free memory space to
extra memory is actually called virtual memory form a contiguous block of free space. This is
and it is a section of a hard disk that’s set up to called garbage collection.
emulate the computer’s RAM. The main visible We can also use compaction to minimize the
advantage of this scheme is that programs can probability of external fragmentation.
be larger than physical memory. Virtual In compaction, all the free partitions are made
memory serves two purposes. First, it allows us contiguous and all the loaded partitions are
to extend the use of physical memory by using brought together.
disk. Second, it allows us to have memory
Hence, the correct option is (B).
protection, because each virtual address is
translated to a physical address. 34. (D)
Hence, the correct option is (B). FCFS Total seek time in FCFS Scheduling
31. (A) when the disk drive is reading from cylinder 20
for cylinders in the order 10, 22, 20, 2, 40, 6 and
There are two important tasks in virtual memory
38.
management: a page-replacement strategy and a
frame allocation strategy. Frame allocation 0 2 6 10 20 22 38 40
strategy says gives the idea of minimum number
of frames which should be allocated. The
absolute minimum number of frames that a
process must be allocated is dependent on
system architecture, and corresponds to the
number of pages that could be touched by a
single (machine) instruction. So, it is instruction
set architecture. 146 u 6 = 876 ms
Hence, the correct option is (A). Hence, the correct option is (D).
32. (D) 35. (D)
The computation requires 100 seconds on a
1. All processes are arrived at time 0.
single processor implies that 40% of the
2. Algorithm used for scheduling is round
computation takes 40 seconds on any number of
robin with time quantum of one unit
processors and the remaining 60 % takes 60
time.
seconds on parallel computation which becomes
30 seconds on two processors and 15 seconds on 3. The order of execution of the processes
four. A, B, C, D, A, C, A, C, A, C, C, C, C, C
Hence, in total, the computation takes 4. After 8 context switches, process A
40+30=70 seconds on two processors and completes it execution so the completion
40+15=55 seconds on four processors. time is 9.
Hence, the correct option is (D). Hence, the correct option is (D).

Operating System 17
36. (A) 37. (C)
The purpose of the fork system call is to create P: Wait operation decrements the value of the
a child process. counting semaphore by 1.
The parent process fork call will return process V: Signal operation increments the value of
ID which will make if condition false then counting semaphore by 1.
parent process will print 10 Current value of the counting semaphore = 10
The child process will execute the next (b) after 3 P operations, value of semaphore =
instruction is a++ because in the child process if 10–3 = 7
the condition is not tested. Execution starts from (d) after 2 V operations, and 5 P operations
next instruction and it will print 11 value of semaphore = 10+ 2 – 5 = 7
Hence, the correct option is (D). Hence, the correct option is (C).
38. (C)
Following is the Gantt diagram :
P1 P3 P4 P5 P1
0 5 8 28 30 40

Process Arrival Time (in ms) CPU Time Needed Priority Waiting Time
P1 0 10 5 30–0=30
P2 0 5 2 0
P3 2 3 1 5–2=3
P4 5 20 4 8–5=3
P5 10 2 3 28–10=18
30  3  3  18
Average Waiting Time 10.8
5
Hence, the correct option is (C).
39. (A) 40. (B)
Here, 20 P operations means 20 wait operations. Shortest Remaining Time. SRT is a preemptive
It decrement value by 1 every time. xV scheduling. In SRT. The process with smallest
operations means x increments operations. It runtime to complete (i.e remaining time) is
increment value by 1 every time. - New value of scheduled to run next, including new arrivals
semaphore is 5 after performing xV operations In SRT, a running process may be preempted by
13  xV new process with shorter estimated run time.
=5 Process AT BT
xV 5  13 = 18 P1 0 10
After applying 20 P operations in semaphore P2 2 20
value is = 7–20 = –13
Hence, the correct option is (A). P3 6 30

18 Operating System
I II II. T3 and T6
III. T4 and T7
P1 P2 P3 IV. T5 and T8
0 10 30 60 (T3, T6), (T4, T7) and (T5, T8 ) will execute
Total no. of context switches is 2. parallely. So total number of processes that can
Hence, the correct option is (B). be executed in 4 units time using 5 available
processors = 5 u 4 20
41. (B)
Maximum number of tasks are 8
From the precedence graph, we say that the 8
following tasks executed sequentially Efficiency = 40%
20 u100
I. Tl, T2 Hence, the correct option (B).
42. (B)
Process ID Priority Arrival Time CPU Time Completion time T.A.T.
(C.T. – A.T.)
P1 5 0 10 18 18
P2 2 0 5 5 5
P3 1 2 3 8 6
P4 4 5 20 40 35
P5 3 10 2 20 10

P2 P3 P1 P5 P4
0 5 8 18 20 40
Average waiting time
(18  10)  (5  5)  (6  3)  (35  20)  (10  2) 8  10  3  15  8 34
6.8m.s
5 5 5
43. (C) 45. (D)

In round robin policy each process has allotted The given operating system follows DEAD
fix time quantum, after its time quantum is over LOCK prevention policy which also ensures
it goes to tail of the ready queue if not neither starvation nor deadlock can occur.
completed. Hence it act as a circular queue
46. (B)
implementation.
44. (B) Vitual address space 232 Bytes

Semaphores are used in deadlock avoidance by Physical address spaces 230 Bytes
using them during interprocess communication. 212 Bytes
Page size = 4 KB
It is used to solve the problem of
synchronization among processes. Number of frames in physical memory

Operating System 19
230 218 u 22 bytes = 220 Bytes
218
212
47. (C)
Number of Bits in each page table entry
Physical memory size = 16MB = 224 Bytes
Page Number Overhead (offset)
Page size 1KB = 210Bytes
20 bits 12 bits
Virtual address space = 256 Pages
Page table size = No. of frames u(20  12) bits
256 u1KB
218 u 32 bits
218 Bytes
32
218 u bytes Number of bits to identify each address in
8
logical address space of 218 Bytes = 18 bits.
48. (D)
0 28 30 55 58 75 80 103 111 114 119 192

Total number of tracks traversed


Ÿ (119 – 80) + (119 – 58) + (114 – 58) + (114 – 28) + (111 – 28) + (111 – 55) + (103 – 55) + (103
– 30) + (75 – 30)
Ÿ 39 + 61 + 56 + 86 + 83 + 56 + 48 + 73 + 45
Ÿ 547 tracks
49. (C) I. Allocation using First fit policy :
12.5 62.5 150 25
1. Scan method is used in Disk scheduling
25 75 150 175 300
2. FIFO method is used in Batch
processing P1 150
3. Round Robin method is used in Time P2 12.5
sharing operations P3 62.5
4. LIFO method is used in Interrupt
P4 25
processing.
II. Allocation using Best fit policy :
50. (A)

20 Operating System
62.5 150 12.5 Page Table size Page size
m o 300 2k Bytes
25 75 m
12.5
o 150 175 12.5 Let page size
P1 150 LAS 233 B 33k
Number of pages 2
P2 12.5 PS 2k B
P3 62.5 Page Table size entry size u number of pages
Page size eu number of pages
As it gives non contiguous blocks, this policy is
not possible 2k 22 B u 233k
51. 33.33 2k 235k B
TLB hit rate (Th ) 0.85 log2 (2k ) log2 (235k ) B
TLB miss rate (1  Th ) 0.15 k 35  k . B
Average memory access time
2k 35 . B
0.85(5  150)  0.15(5  3 u150) k 17.5 B
131.75  68.25 Page size 217.5 B 210 ˜ 27.5 B 27.5 kB
200 msec 181.019 kB
% slow down 54. 8
§ 200 150 · Given:
¨ 150 ¸ u100
© ¹ Logical address space 264 B
50
u100 33.33% Page size 1 MB 220 B
150
52. 2
e 4 B 22 B
Entry size represents the frame bits,
Given:
So, number of frame bits 32 bits
Logical Address space 8 MB 223 B 52 bits
Page size 4 kB 212 B PA
Frame Offset
LAS 223 B 2312
Number of pages 2 211 32 bits
mo mo
20 bits
PS 212 B
Number of pages
Page Table size 1 Page size 4 kB
LAS 264 B 6420
Page Table size entry size u number of pages 2 244 Pages
Page Table size PS 220 B
Entry size
number of pages Inner Page Table size 244 u e
212 B 1211 1
244 u 22 B
e 2 B 2 Byte
211 246 B > Page size
53. 181 Number of pages of inner page Table
Given: 246 B 26
2 Pages
Logical address space 8 GB 233 B 220 B
e 4 B 22 B Layer-2 Page Table size 226 pages u 22 B

Operating System 21
228 B > Page size 57. (D)
Number of pages of Layer-2 PT Given statements are as follows :
228 pages (A) Context switch time is longer for Kernel
28 pages
220 B level threads than for user level threads
Outer Page Table size 28 u 22 B It is True, user level threads are managed
by users and Kernel level thread
210 B managed by OS. There are many
Number of searches number of pages in outer overheads involved in Kernel level
Page Table thread management, which are not
28 present in user level thread, so context
Ÿ 8 bits switch time is longer for Kernel than for
55. 181 user level threads.
(B) User level threads do not need any
LAS 216 B, PAS 216 B
hardware support, It is true, As we know
Let page size 2k B user level threads are managed by users,
Number of segments 8 there is no need for hardware support.
(Page Table of segment) size 1 page size (C) Related Kernel level threads can be
LAS 216 B 13 scheduled on different processors in a
One segment size 2 B
8 23 multi-processor system.
213 B 13k It is true
Number of pages/segment 2 (D) Blocking one Kernel level threads
2k B
blocks all related threads. It is false
(Page table of segment) size number of pages Kernel level threads are managed by os,
ue If one thread block, it does not cause
213k u 4 B other threads.
Hence, the correct option is (D).
2k 215k B
58. (B)
2k 215k
log2 2k log2 215k Given :
Process Execution time Arrival time
k 15  k
P1 20 0
2k 15
k 7.5 P2 25 15
Page size 2k B 27.5 B 181 Byte P3 10 30
56. (D) P4 15 45
A CPU has two modes-privileged and non- The Gantt chart for SRT scheduling algorithm is
privileged. In order to change the mode from P1 P2 P3 P2 P4
privileged to non-privileged, the next 0 20 30 40 55 70
instruction to be executed should be non- So the waiting time for
privileged instruction. P2 (20  15)  (40  30) 5  10 15
Hence, the correct option is (D). Hence, the correct option is (B).

22 Operating System
59. (C) Minimum value occurs when P1 , P2 , P3 read and
Given : P1 , P3 update the value
Processing P3 Update D 110
Process Arrival time
time
P1 Update D 120
A 0 3
B 1 7 And last P2 will update the
C 4 4 D 100  50 50 X maximum value will
D 6 2 occur when P2 and P3 read the initial value of D
(1) FCFS : and update, first own P2 and update D 50 , P3
A B C D will run and update
0 3 10 14 16 D 100  10 110
3  9  10  10 32 Now P1 will read the value of D 110 and
Avg TAT 8
4 4 update:
(2) Non preemptive SJF : D D  20 110  20
A B D C D 130 Y
0 3 10 12 16 Y  X 130  50 80
3  9  6  12 30
Avg TAT 7.5 Hence, the correct option is 80.
4 4
(3) SRTF : 61. (A)
A B C D B In deadlock prevention, the request for n
0 3 4 8 10 16 resource may not be granted even if the resulting
3  15  4  4 26 state is safe.
Avg TAT 6.5
4 4 Deadlock prevention scheme handles deadlock
(4) RR : by making sure that one of the four necessary
A B A C B D C B B conditions don’t occur. So, it may be the case
0 2 4 5 7 9 11 13 15 16 that a resource request might be rejected even if
5  15  9  5 34 the resulting state is safe.
Avg TAT 8.5
4 4 Hence, the correct option is (A).
SRTF has lowest turn around time.
62. (D)
Hence, the correct option is (C).
60. 80 Let’s assume that each process requests 2
resources each. Now there are total 6 identical
Given :
resources available. Give 1 resources to every
P1 P2 P3 process then there will be deadlock because now
: : : each process will wait for another resource
: : : which is not available. Since there are total 6
D = D + 20 D = D – 50 D = D + 10 resources so for deadlock to be possible there
: : : should be 6 process available. Hence, the value
: : : of N is 6.
Initial value of D 100 Hence, the correct option is (D).

Operating System 23
63. (B) 66. (C)

Given : Given :
Current Maximum Physical memory 64MB 226 B
Process Need
Allocation Requirement Size of frame 4KB 212 B
P1 3 7 4 physical memory
Number of frames
P2 1 6 5 size of frame
P3 3 5 2 226 B
214
212 B
Number of resources = 9
Frame number =14 bits
Therefore, Available = 9 – 7 = 2
Virtual memory 32bits 232 B
From current available need of process P3 can
be satisfied, releasing 3 additional resources. Size of page = size of frame 4KB 212 B
After execution of P3 number of available virtual memory
Number of pages
size of page
resources = 5.
Now, form current available need of any of the 232 B
220
two processes P1 or P2 can be satisfied. 212 B
Size of page table
Safe sequence Ÿ P3 o P1 o P2
= Number of pages u Size of each entry size of
Safe and not deadlock.
page table
Hence, the correct option is (B).
= Number of pages u Page table entry
64. B,D Size of page table
(B) Without indivisible machine instruction = Number of pages u Frame number
critical section can be implemented like Assume Frame number = 16bits
using monitors.
Size of page table 220 u16 bits | 2MB
(D) Best fit also suffers from fragmental
Hence, the correct option is (C).
Hence, the correct option is (B) and (D).
67. (C)
65. (C)
Incrementing the number of page frames
Given :
doesn’t always decrease the page faults
ROM memory size 2m u n
(Belady’s Anomaly).
number of address lines m
Hence, the correct option is (C).
number of data lines n
68. 7
4k u16 22 u 210 u16
4k u16 212 u16 Given :
Number of page frame = 3
Address lines 12
Reference string 1, 2, 3, 4, 2, 1, 5, 3, 2, 4, 6
Data lines 16
Optimal page replacement policy.
Hence, the correct option is (C).

24 Operating System
3 4 4 4 71. (*)

2 2 2 2 2 Given :
Disk requests : 10, 22, 20, 2, 40, 55, 36
1 1 1 1 1 1
seek time = 6 msec per cylinder
1 2 3 4 2 1 (A) FCFS
2 10 20 22 36 40 55
4 4 4 4 6

2 2 2 2 2

5 3 3 3 3

5 3 2 4 6
? 7 page faults.
Hence, the correct answer is 7.
69. 384 6 u (10  12  2  18  38  15  19) 684

Given : (B) Closet cylinder next


2 10 20 22 36 40 55
Page table entry size = 48 bits
Page table size = Number of entries in page table
u page table entry size
§ 240 ·
¨ 14 ¸ u 48 bits 2 u 6 bytes
26

©2 ¹
64 M u 6 B 384 MB
Hence, the correct answer is 384.
70. (B)
6 u (2  12  18  34  4  19) 534
Given : Hence, the correct answer is (684, 534).
Following statements:
72. (C)
S1 : Random page replacement algorithm
(where a page chosen at random is replaced) (C) CPU checks for interrupts before
executing a new instruction.
Suffers from Belady’s anomaly
Hence, the correct option is (C).
S2 : LRU page replacement algorithm suffers
from Belady’s anomaly 73. (B)
Considering each statement Given :
Random page replacement algorithm can Number of cylinders = 100
behave like only algorithm probably FCFS too, Cylinder access request :
hence it can suffer from Belay’s anomaly. 4, 35, 10, 7, 19, 73, 2, 15, 6, 20
LRU page replacement algorithm doesn’t suffer Initial position of head = 50
from Belady’s anomaly. Seek time = 1 ms
Hence, the correct option is (B). Head is currently at cylinder 50

Operating System 25
0 2 4 6 7 10 15 19 20 35 50 73 Number of entries in FAT
100 u106
0.099601
1004
Maximum size of a file
0.099601u103 bytes
99.601u106 bytes .
50  35 15 35  20 15 Hence, the correct answer is 99.6.
20  19 1 , 19  15 4 ™™™™
15  10 5 , 10  7 3
7  6 1, 64 2
42 2, 2  73 71
Total move
15  15  1  4  5  3  1  2  2  71
119
Hence, the correct option is (B).
74. (C)
Given :
Seek time = 10 ms
Rotational speed = 5000 rpm
60 s o 5000 rotations
60
1 rotation o s
5000
1 60
Rotational latency u s 6 ms
2 5000
Total time to transfer one library
10  6 16 ms
? Total time to transfer 100 libraries
100 u16 ms 1.6s
Hence, the correct option is (C).
75. 99.6
Given :
Total overhead of each entry = 4 bytes
Disk size = 100 u 106 bytes
Data block size = 103 bytes
Total size for each entry 1004 bytes

26 Operating System

You might also like