Operating System

Operating System Questions Answers GATE 2021

Operating System GATE Question Answers with Explanation.

Q1 – In the context of operating systems, which of the following statements is/are correct with respect to paging? (GATE 2021 SET 1)

 

  1. Paging helps solve the issue of external fragmentation.
  2. Page size has no impact on internal fragmentation.
  3. Paging incurs memory overheads.
  4. Multi-level paging is necessary to support pages of different sizes.

Ans – (1, 3)

Explanation –

Q2 – Which of the following standard C library functions will always invoke a system call when executed from a single-threaded process in a UNIX/Linux operating system? (GATE 2021 SET 1)
  1. exit
  2. malloc
  3. sleep
  4. strlen

Ans – (1, 3)

Explanation –

Q3 – Consider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory foo. Which of the following operations will necessarily require a full scan of foo for successful completion? (GATE 2021 SET 1)
  1. Creation of a new file in foo
  2. Deletion of an existing file from foo
  3. Renaming of an existing file in foo
  4. Opening of an existing file in foo

Ans – (1, 3)

Explanation – 

Q4 – Consider a computer system with a byte-addressable primary memory of size 232 bytes. Assume the computer system has a direct-mapped cache of size 32 KB (1 KB = 210 bytes), and each cache block is of size 64 bytes. The size of the tag field is __________ bits. (GATE 2021 SET 1)

Ans – (17)

Explanation

Q – Three processes arrive at time zero with CPU bursts of 16, 20 and 10 milliseconds. If the scheduler has prior knowledge about the length of the CPU bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest integer) is _____________ milliseconds. (GATE 2021 SET 1)

Ans – (12)

Explanation

Q – Consider the following pseudocode, where S is a semaphore initialized to 5 in line#2 and counter is a shared variable initialized to 0 in line#1. Assume that the increment operation in line#7 is not atomic.
  1. int counter =0;
  2. Semaphore S= init(5);
  3. void parop(void)
  4. {
  5. wait(S);
  6. wait(S);
  7. counter++;
  8. signal(S);
  9. signal(S);
  10. }
If five threads execute the function parop concurrently, which of the following program behavior(s) is/are possible? (GATE 2021 SET 1)

 

  1. The value of counter is 5 after all the threads successfully complete the execution of parop.
  2. The value of counter is 1 after all the threads successfully complete the execution of parop.
  3. The value of counter is 0 after all the threads successfully complete the execution of parop.
  4. There is a deadlock involving all the threads.

Ans – (1, 2, 4)

Explanation