Operating System GATE CS and IT previous year questions with Answer


Ques 1 Gate 2024 Set-2


Consider a multi-threaded program with two threads T1 and T2. The threads share two semaphores: s1 (initialized to 1) and s2 (initialized to 0). The threads also share a global variable x (initialized to 0). The threads execute the code shown below.

Which of the following outcomes is/are possible when threads T1 and T2 execute concurrently?

A

T1 runs first and prints 1, T2 runs next and prints 2

B

T2 runs first and prints 1, T1 runs next and prints 2

C

T1 runs first and prints 1, T2 does not print anything (deadlock)

D

T2 runs first and prints 1, T1 does not print anything (deadlock)



Ques 2 Gate 2024 Set-1


Which one of the following statements is FALSE?

A

In the cycle stealing mode of DMA, one word of data is transferred between an I/O device and main memory in a stolen cycle

B

For bulk data transfer, the burst mode of DMA has a higher throughput than the cycle stealing mode

C

Programmed I/O mechanism has a better CPU utilization than the interrupt driven I/O mechanism

D

The CPU can start executing an interrupt service routine faster with vectored interrupts than with non-vectored interrupts



Ques 3 Gate 2023


Which of the following CPU scheduling algorithm can potential cause starvation?

A

FCFS

B

SJF

C

Priority scheduling

D

Round Robin



Ques 4 Gate 2022


Consider four processes P, Q, R, and S scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order P, Q, R, S, all at time t = 0. There is exactly one context switch from S to Q, exactly one context switch from R to Q, and exactly two context switches from Q to R. There is no context switch from S to P. Switching to a ready process after the termination of another process is also considered a context switch. Which one of the following is NOT possible as CPU burst time (in time units) of these processes?

A

P=4, Q=10, R=6, S=2

B

P=2, Q=9, R=5, S=1

C

P=4, Q=12, R=5, S=4

D

P=3, Q=7, R=7, S=3



Ques 5 Gate 2022


Which of the following statements is/are TRUE with respect to deadlocks?

A

Circular wait is a necessary condition for the formation of deadlock.

B

In a system where each resource has more than one instance, a cycle in its wait-for graph indicates the presence of a deadlock.

C

If the current allocation of resources to processes leads the system to unsafe state, then deadlock will necessarily occur.

D

In the resource-allocation graph of a system, if every edge is an assignment edge, then the system is not in deadlock state.



Ques 6 Gate 2022


Consider a demand paging system with four-page frames (initially empty) and an LRU page replacement policy. For the following page reference string 7, 2,7,3, 2,5,3, 4,6,7,7,1,5,6,1 the page fault rate, defined as the ratio of number of page faults to the number of memory accesses (rounded off to one decimal place) is_________.


0.6 is the correct answer.


Ques 7 Gate 2022


A cache memory that has a hit rate of 0.8 has an access latency 10 ns and miss penalty 100 ns. Optimization is done on the cache to reduce the miss rate. However, the optimization results in an increase of cache access latency to 15 ns, whereas the miss penalty is not affected. The minimum hit rate (rounded off to two decimal places) needed after the optimization such that it should not increase the average memory access time is _____.


0.85 is the correct answer.


Ques 8 Gate 2020


Consider the following five disk five disk access requests of the form (request id, cylinder number) that are present in the disk scheduler queue at a given time.

(P, 155), (Q, 85), (R, 110), (S, 30), (T, 115)

Assume the head is positioned at cylinder 100. The scheduler follows Shortest Seek Time First scheduling to service the requests. Which one of the following statements is FALSE ?

A

T is serviced before P.

B

Q is serviced after S, but before T.

C

The head reverses its direction of movement between servicing of Q and P.

D

R is serviced before P.



Ques 9 Gate 2020


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 initialized to 0 and not used in CODE SECTION P.

CODE SECTION P
wait(a); count=count+1;
if (count==n) signal (b);
signal (a): wait (b) ; signal (b);
CODE SECTION Q

What does the code achieve ?

A

It ensures that no process executes CODE SECTION Q before every process has finished CODE SECTION P.

B

It ensures that two processes are in CODE SECTION Q at any time.

C

It ensures that all processes execute CODE SECTION P mutually exclusively.

D

It ensures that at most nโˆ’1 processes are in CODE SECTION P at any time.



Ques 10 Gate 2020


Consider the following statements about process state transitions for a system using preemptive scheduling.

I. A running process can move to ready state.
II. A ready process can move to running state.
III. A blocked process can move to running state.
IV. A blocked process can move to ready state.
Which of the above statements are TRUE ?

A

I, II, and III only

B

II and III only

C

I, II, and IV only

D

I, II, III and IV only