Operating Systems questions

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

0/100 correct0 marks

Related topics in GATE CS