GATE CS — Computer Science & IT Subject test

Operating Systems — GATE Previous Year Questions

  • 11Questions
  • 19Total marks
  • 33Minutes

Every verified previous-year GATE question in the Operating Systems section of the W3Colleges bank, in chronological order. Practise them untimed with worked explanations, or take the set as a timed test.

Start timed test Practice without timer

The timed run lasts 33 minutes and is held on the server.

Questions

Operating Systems

Question 1

MCQ 2 marks · −0.66 Operating Systems

Consider the following code fragment, where the variable a already holds a value before the fragment starts executing:

if (fork() == 0) {
    a = a + 5;
    printf("%d, %d\n", a, &a);
} else {
    a = a - 5;
    printf("%d, %d\n", a, &a);
}

Let \(u, v\) be the values printed by the parent process, and \(x, y\) be the values printed by the child process. Which one of the following is TRUE?

Answers and explanations are free — they just need an account.

Question 2

MCQ 2 marks · −0.66 Operating Systems

Consider three CPU-intensive processes, which require 10, 20 and 30 time units and arrive at times 0, 2 and 6, respectively. How many context switches are needed if the operating system implements a shortest remaining time first scheduling algorithm? Do not count the context switches at time zero and at the end.

Answers and explanations are free — they just need an account.

Question 3

MCQ 2 marks · −0.66 Operating Systems

A system uses FIFO policy for page replacement. It has 4 page frames with no pages loaded to begin with. The system first accesses 100 distinct pages in some order and then accesses the same 100 pages but now in the reverse order. How many page faults will occur?

Answers and explanations are free — they just need an account.

Question 4

MCQ 1 marks · −0.33 Operating Systems

A thread is usually defined as a "light weight process" because an operating system (OS) maintains smaller data structures for a thread than for a process. In relation to this, which of the following is TRUE?

Answers and explanations are free — they just need an account.

Question 6

MCQ 2 marks · −0.66 Operating Systems

A shared variable \(x\), initialized to zero, is operated on by four concurrent processes W, X, Y, Z as follows. Each of the processes W and X reads \(x\) from memory, increments by one, stores it to memory, and then terminates. Each of the processes Y and Z reads \(x\) from memory, decrements by two, stores it to memory, and then terminates. Each process before reading \(x\) invokes the P operation (i.e., wait) on a counting semaphore S and invokes the V operation (i.e., signal) on the semaphore S after storing \(x\) to memory. Semaphore S is initialized to two. What is the maximum possible value of \(x\) after all processes complete execution?

Answers and explanations are free — they just need an account.

Question 7

NAT 2 marks · no negative Operating Systems

A system uses 3 page frames for storing process pages in main memory. It uses the Least Recently Used (LRU) page replacement policy. Assume that all the page frames are initially empty. What is the total number of page faults that will occur while processing the page reference string given below?

4, 7, 6, 1, 7, 6, 1, 2, 7, 2

Answers and explanations are free — they just need an account.

Question 8

MCQ 2 marks · −0.66 Operating Systems

An operating system uses the Banker's algorithm for deadlock avoidance when managing the allocation of three resource types X, Y and Z to three processes P0, P1 and P2. The table given below presents the current system state. Here, the Allocation matrix shows the current number of resources of each type allocated to each process and the Max matrix shows the maximum number of resources of each type required by each process during its execution.

ProcessAllocationMax
XYZXYZ
P0001843
P1320620
P2211333

There are 3 units of type X, 2 units of type Y and 2 units of type Z still available. The system is currently in a safe state. Consider the following independent requests for additional resources in the current state:

REQ1: P0 requests 0 units of X, 0 units of Y and 2 units of Z
REQ2: P1 requests 2 units of X, 0 units of Y and 0 units of Z

Which one of the following is TRUE?

Answers and explanations are free — they just need an account.

Question 9

NAT 2 marks · no negative Operating Systems

Consider a computer system with 40-bit virtual addressing and page size of sixteen kilobytes. If the computer system has a one-level page table per process and each page table entry requires 48 bits, then the size of the per-process page table is _______ megabytes.

Answers and explanations are free — they just need an account.

Question 10

NAT 2 marks · no negative Operating Systems

Consider the following CPU processes with arrival times (in milliseconds) and length of CPU bursts (in milliseconds) as given below:

ProcessArrival timeBurst time
P107
P233
P355
P462

If the pre-emptive shortest remaining time first scheduling algorithm is used to schedule the processes, then the average waiting time across all processes is _______ milliseconds.

Answers and explanations are free — they just need an account.

Question 11

MCQ 1 marks · −0.33 Operating Systems

Consider a process executing on an operating system that uses demand paging. The average time for a memory access in the system is \(M\) units if the corresponding memory page is available in memory, and \(D\) units if the memory access causes a page fault. It has been experimentally measured that the average time taken for a memory access in the process is \(X\) units.

Which one of the following is the correct expression for the page fault rate experienced by the process?

Answers and explanations are free — they just need an account.