Operating Systems questions — page 2 of 7

Q24

GATE CS 2024 CS-1Processes and ThreadsMSQ1 mark
Which of the following statements about threads is/are TRUE?
More than one option can be correct.
Show answer without attempting

Answer: D

Q25

GATE CS 2024 CS-1Processes and ThreadsMSQ1 mark
Which of the following process state transitions is/are NOT possible?
More than one option can be correct.
Show answer without attempting

Answer: B, C

Q40

GATE CS 2024 CS-1Concurrency and SynchronizationMCQ2 marks−2/3 if wrong
Consider the following two threads T1 and T2 that update two shared variables a and b. Assume that initially a = b = 1. Though context switching between threads can happen at any time, each statement of T1 or T2 is executed atomically without interruption.
T1:
a = a + 1;
b = b + 1;
T2:
b = 2 * b;
a = 2 * a;
Which one of the following options lists all the possible combinations of values of a and b after both T1 and T2 finish execution?
Show answer without attempting

Answer: A

Q57

GATE CS 2024 CS-1Processes and ThreadsNAT2 marks
Consider the following code snippet using the fork() and wait() system calls. Assume that the code compiles and runs correctly, and that the system calls run successfully without any errors.
int x = 3;
while(x > 0) {
 fork();
 printf("hello");
 wait(NULL);
 x--;
}
The total number of times the printf statement is executed is _______
Show answer without attempting

Answer: 14

Q62

GATE CS 2024 CS-1Memory ManagementNAT2 marks
Consider a memory management system that uses a page size of 2 KB. Assume that both the physical and virtual addresses start from 0. Assume that the pages 0, 1, 2, and 3 are stored in the page frames 1, 3, 2, and 0, respectively. The physical address (in decimal format) corresponding to the virtual address 2500 (in decimal format) is _________
Show answer without attempting

Answer: 6596

Q24

GATE CS 2024 CS-2Memory ManagementMSQ1 mark
Which of the following tasks is/are the responsibility/responsibilities of the memory management unit (MMU) in a system with paging-based memory management?
More than one option can be correct.
Show answer without attempting

Answer: B, C, D

Q25

GATE CS 2024 CS-2Processes and ThreadsMSQ1 mark
Consider a process P running on a CPU. Which one or more of the following events will always trigger a context switch by the OS that results in process P moving to a non-running state (e.g., ready, blocked)?
More than one option can be correct.
Show answer without attempting

Answer: A, B

Q37

GATE CS 2024 CS-2SchedulingMCQ2 marks−2/3 if wrong
Consider a single processor system with four processes A, B, C, and D, represented as given below, where for each process the first value is its arrival time, and the second value is its CPU burst time.

A (0, 10), B (2, 6), C (4, 3), and D (6, 7).

Which one of the following options gives the average waiting times when preemptive Shortest Remaining Time First (SRTF) and Non-Preemptive Shortest Job First (NP-SJF) CPU scheduling algorithms are applied to the processes?
Show answer without attempting

Answer: B

Q46

GATE CS 2024 CS-2Concurrency and SynchronizationMSQ2 marks
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.
// code of T1
wait(s1);
x = x+1;
print(x);
wait(s2);
signal(s1);

// code of T2
wait(s1);
x = x+1;
print(x);
signal(s2);
signal(s1);
Which of the following outcomes is/are possible when threads T1 and T2 execute concurrently?
More than one option can be correct.
Show answer without attempting

Answer: B, C

Q64

GATE CS 2024 CS-2Memory ManagementNAT2 marks
Consider a 32-bit system with 4 KB page size and page table entries of size 4 bytes each. Assume 1 KB=2101 \text{ KB} = 2^{10} bytes. The OS uses a 2-level page table for memory management, with the page table containing an outer page directory and an inner page table. The OS allocates a page for the outer page directory upon process creation. The OS uses demand paging when allocating memory for the inner page table, i.e., a page of the inner page table is allocated only if it contains at least one valid page table entry.

An active process in this system accesses 2000 unique pages during its execution, and none of the pages are swapped out to disk. After it completes the page accesses, let XX denote the minimum and YY denote the maximum number of pages across the two levels of the page table of the process.

The value of X+YX+Y is ________
Show answer without attempting

Answer: 1028

Q22

GATE CS 2023 CSProcesses and ThreadsMSQ1 mark
Which one or more of the following need to be saved on a context switch from one thread (T1T_1) of a process to another thread (T2T_2) of the same process?
More than one option can be correct.
Show answer without attempting

Answer: B, C, D

Q23

GATE CS 2023 CSProcesses and ThreadsMSQ1 mark
Which one or more of the following options guarantee that a computer system will transition from user mode to kernel mode?
More than one option can be correct.
Show answer without attempting

Answer: C, D

Q27

GATE CS 2023 CSSchedulingMSQ1 mark
Which one or more of the following CPU scheduling algorithms can potentially cause starvation?
More than one option can be correct.
Show answer without attempting

Answer: A, C, D OR C, D

Q38

GATE CS 2023 CSConcurrency and SynchronizationMCQ2 marks−2/3 if wrong
Consider the two functions incr and decr shown below.
incr(){
wait(s);
X = X+1;
signal(s);
}
decr(){
wait(s);
X = X-1;
signal(s);
}
There are 5 threads each invoking incr once, and 3 threads each invoking decr once, on the same shared variable X. The initial value of X is 10.
Suppose there are two implementations of the semaphore s, as follows:

I-1: s is a binary semaphore initialized to 1.
I-2: s is a counting semaphore initialized to 2.

Let V1, V2 be the values of X at the end of execution of all the threads with implementations I-1, I-2, respectively.

Which one of the following choices corresponds to the minimum possible values of V1, V2, respectively?
Show answer without attempting

Answer: C

Q57

GATE CS 2023 CSMemory ManagementNAT2 marks
Consider the following two-dimensional array D in the C programming language, which is stored in row-major order:
int D[128][128];
Demand paging is used for allocating memory and each physical page frame holds 512 elements of the array D. The Least Recently Used (LRU) page-replacement policy is used by the operating system. A total of 30 physical page frames are allocated to a process which executes the following code snippet:
for (int i = 0; i < 128; i++)
  for (int j = 0; j < 128; j++)
    D[j][i] *= 10;
The number of page faults generated during the execution of this code snippet is ____________.
Show answer without attempting

Answer: 4096

Q58

GATE CS 2023 CSMemory ManagementNAT2 marks
Consider a computer system with 57-bit virtual addressing using multi-level tree-structured page tables with LL levels for virtual to physical address translation. The page size is 4 KB (1 KB=1024 B1 \text{ KB} = 1024 \text{ B}) and a page table entry at any of the levels occupies 8 bytes.

The value of LL is ____________.
Show answer without attempting

Answer: 5

Q19

GATE CS 2022 CSConcurrency and SynchronizationMCQ1 mark−1/3 if wrong
Consider the following threads, T1T_1, T2T_2, and T3T_3 executing on a single processor, synchronized using three binary semaphore variables, S1S_1, S2S_2, and S3S_3, operated upon using standard wait() and signal(). The threads can be context switched in any order and at any time.
T1
while(true){
  wait(S3);
  print(“C”);
  signal(S2);
}

T2
while(true){
  wait(S1);
  print(“B”);
  signal(S3);
}

T3
while(true){
  wait(S2);
  print(“A”);
  signal(S1);
}
Which initialization of the semaphores would print the sequence BCABCABCA....?
Show answer without attempting

Answer: C

Q26

GATE CS 2022 CSDeadlocksMSQ1 mark
Which of the following statements is/are TRUE with respect to deadlocks?
More than one option can be correct.
Show answer without attempting

Answer: A, D

Q38

GATE CS 2022 CSMemory ManagementMCQ2 marks−2/3 if wrong
Which one of the following statements is FALSE?
Show answer without attempting

Answer: C

Q42

GATE CS 2022 CSSchedulingMCQ2 marks−2/3 if wrong
Consider four processes PP, QQ, RR, and SS scheduled on a CPU as per round robin algorithm with a time quantum of 4 units. The processes arrive in the order PP, QQ, RR, SS, all at time t=0t = 0. There is exactly one context switch from SS to QQ, exactly one context switch from RR to QQ, and exactly two context switches from QQ to RR. There is no context switch from SS to PP. 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?
Show answer without attempting

Answer: D

0/200 correct0 marks

Related topics in GATE CS