You are on page 1of 8

Operating System GATE 2023 – 2024 (CS/IT)

GATE | PSUs | UGC-NET | IIIT H | BITSP | ISRO |BARC | DRDO | SAIL |


CIL | ECIL | ISIK | JRF | SRF | UP-PSC | CG-PSC | CSEB | HAL | BEL
Test ID 20287 Date:25/09/2022 Branch: CS/IT

Duration: 1 Hours Maximum marks: 35

Q.1 to 5 Carry One Mark Each

Q.1) Which of the following is disadvantage of banker algorithm? (MSQ,Hard)


A. Reduces system throughput
B. Low device utilization
C. If a new process arrives then the system can go to unsafe state
D. No resources may leave while it is executing otherwise it can lead to unsafe
state.

Q.2) Which of the following is true? (MSQ,Medium)


A. In an unsafe state, the operating system cannot prevent processes from
requesting resources in such a way that a deadlock occurs.
B. Deadlock → Unsafe state
C. Unsafe state→ Deadlock
D. None of these

Consider the common data for question 3 and 4


Consider the following resource allocation graph:

Q.3) Which of the following is true? (MCQ,Medium)


A. The system is in safe state.
B. The system is in deadlocked state.

_________________________________________________________________i-
GATE,B-713, Street 22, Smriti Nagar, Bhilai- 0788-4902937, Contact 98271-62352
[1]
Operating System GATE 2023 – 2024 (CS/IT)

C. The system is in unsafe state.


D. We can’t say whether system is in safe state or not.

Q.4) Which of the following are safe sequences of above RAG? (MSQ,Medium)
A. P2,P1,P5,P4,P3,P6
B. P2,P1,P5,P3,P4,P6
C. P2,P5,P4,P3,P1,P6
D. None of these

Q.5) Time complexity of an algorithm to determine cycle in a wait-for graph is (n is the


no. of resource+no. of process ) (MCQ,Medium)
2
A. O(n logn)
B. O(nlogn)
C. O(n)
D. O(n2)

Q.6 to 20 Carry two Mark Each

Q6) Consider the following statements?


1. In case of resource preemption technique of deadlock prevention,some process
can starve.
2. In multiple instanced resource type graph contains a cycle then it leads to
deadlock.
Which of the following is true? (MCQ,Hard)
A. Only 1
B. Only 2
C. Both 1 and 2
D. Neither 1 nor 2

Consider the common data for question 7 and 8

Consider the following request of resources(X,Y and Z) by processes and their current
allocation:

Process Priority MAX ALLOCATION


X Y Z X Y Z

P1 1(high) 2 4 3 0 0 1

_________________________________________________________________i-
GATE,B-713, Street 22, Smriti Nagar, Bhilai- 0788-4902937, Contact 98271-62352
[2]
Operating System GATE 2023 – 2024 (CS/IT)

P2 2 6 7 0 3 2 0

P3 3 2 8 5 4 3 3

P4 4 6 7 5 4 2 4

P5 5(low) 7 7 10 4 1 5

If the deadlock occurs,then OS recover from deadlock by suspending the process which
is holding the resources according to priority and then assigning the lowest priority to
the suspended process.
If current 1 instance of X,3 instance of Y and 2 instance of Z are available,then

Q.7) How many processes are suspended so that all of the request has been satisfied?
(NAT,Hard)
Q. 8) Which of the following process will finish last? (MCQ,Hard)
A. P2
B. P3
C. P4
D. P5
Q.9) Which of the following are true regarding threads? (MSQ,Hard)
A. State is not shared by threads.
B. Open files are not shared by threads
C. Scheduling policy and priority is not shared by threads
D. CPU time consumed is shared by threads.

Q.10) Which of the following are true? (MSQ,Hard)


A. User level threads are faster to create and manage than kernel level thread.
B. Kernel level threads are faster to create and manage than user level thread.
C. User level threads are generic and run on any operating system.
D. For kernel level threads,transfer of control from one thread to another within the
same process requires a mode switch to the Kernel.

Q.11) Which of the following are applications in which threads are used?
(MCQ,Medium)
A. Browsers
B. Wordpad
C. Both A and B
D. None of these

_________________________________________________________________i-
GATE,B-713, Street 22, Smriti Nagar, Bhilai- 0788-4902937, Contact 98271-62352
[3]
Operating System GATE 2023 – 2024 (CS/IT)

Q12) Which of the following statements are true? (MSQ,Hard)


A. Process switching does not need interaction with operating system.
B. Thread switch needs interaction with Operating system.
C. In case of user level threads,multithreaded application cannot take advantage of
multiprocessing.
D. None of these

Q.13) Consider the following code for synchronization of three process


(Initially turn=0)
P0 P1 P2

void(P0) void(P1) void(P1)


{ { {
while(1) while(1) while(1)
{ { {
while(turn!=0); while(turn!=1); while(turn!=2);
-----critical section---- -----critical section---- -----critical section----
} } }
turn=1; turn=2; turn=0;
} } }

Which of the following is satisfied by above code? (MSQ,Medium)


A. Mutual exclusion
B. There is no busy waiting
C. Progress
D. Bounded waiting

Q.14) Consider the following code for synchronization of three process


(Initially turn=0)
P0 P1 P2

void(P0) void(P1) void(P1)


{ { {
while(1) while(1) while(1)
{ { {
while(turn==1 || turn==2); while(turn==2 || turn==0); while(turn==1 || turn==0);
-----critical section---- -----critical section---- -----critical section----
} } }
turn=1; turn=2; turn=0;
} } }

_________________________________________________________________i-
GATE,B-713, Street 22, Smriti Nagar, Bhilai- 0788-4902937, Contact 98271-62352
[4]
Operating System GATE 2023 – 2024 (CS/IT)

Which of the following is satisfied by above code? (MSQ,Hard)


A. Mutual exclusion
B. There is no busy waiting
C. Progress
D. Bounded waiting

Q.15) Consider the following code:

Void main()
{
fork();
for(int i=0;i<10;i++)
{
if(i%2==0)
fork();
}
}
Total number of child process created is____ (NAT,Medium)

Q.16) Consider the following code

Void main()
{
fork();
for(int i=0;i<20;i++)
{
fork();
if(i>10)
{
for(j=i;j<20;j++){
if(i%2==0)
fork();
}
}
}
fork();
}
If the total number of process created in above code is n then log2n
is______(NAT,Hard)

_________________________________________________________________i-
GATE,B-713, Street 22, Smriti Nagar, Bhilai- 0788-4902937, Contact 98271-62352
[5]
Operating System GATE 2023 – 2024 (CS/IT)

Q.17) What is the output of the code (MCQ,Medium)

Void main()
{
if(fork() && (!fork()))
{
if(fork() || fork())
fork();
}
print(“1”)
return 0;
}
A. 111111
B. 1111111
C. 11111
D. 11111111

Q.18 A system shares 20 instances of a resource. The current allocation and maximum
requirement of this resource for four concurrent processes are shown below in tuple
format as: (process id, current allocation, maximum need).
(P1, 4, 6), (P2, 7, 8), (P3, 2, 4), (P4, 3, 5)
The possible number of safe sequences in this system is:
A. 24
B. 16
C. 18
D. 20

Q.19 Consider the following snapshot of a system. There are no outstanding unsatisfied
requests for resources.

_________________________________________________________________i-
GATE,B-713, Street 22, Smriti Nagar, Bhilai- 0788-4902937, Contact 98271-62352
[6]
Operating System GATE 2023 – 2024 (CS/IT)

Available resources are <R1, R2, R3, R4> = <2, 1, 0, 0>. Consider the following
statements
S1 : The system is currently in safe state.
S2 : If a new request from P2 arrives for [0, 1, 0, 0], this request can be safely granted
immediately.
A. Only S1 is true
B. Only S2 is true
C. Both S1 and S2 are true
D. Neither S1 or S2 is true

Q.20 Consider the resource allocation graphs of systems S1 and S2 given below.
Which of the following system(s) are in deadlock?

_________________________________________________________________i-
GATE,B-713, Street 22, Smriti Nagar, Bhilai- 0788-4902937, Contact 98271-62352
[7]
Operating System GATE 2023 – 2024 (CS/IT)

A. Both S1 and S2 are in deadlock.


B. Only S1 is in deadlock.
C. Only S2 is in deadlock.
D. Neither S1 or S2 are in deadlock.

_________________________________________________________________i-
GATE,B-713, Street 22, Smriti Nagar, Bhilai- 0788-4902937, Contact 98271-62352
[8]

You might also like