Menu
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)
Â
Paging helps solve the issue of external fragmentation.
Page size has no impact on internal fragmentation.
Paging incurs memory overheads.
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)
exit
malloc
sleep
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)
Creation of a new file in foo
Deletion of an existing file from foo
Renaming of an existing file in foo
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.
int counter =0;
Semaphore S= init(5);
void parop(void)
{
wait(S);
wait(S);
counter++;
signal(S);
signal(S);
}
If five threads execute the function parop concurrently, which of the following program behavior(s) is/are possible? (GATE 2021 SET 1)
Â
The value of counter is 5 after all the threads successfully complete the execution of parop.
The value of counter is 1 after all the threads successfully complete the execution of parop.
The value of counter is 0 after all the threads successfully complete the execution of parop.
There is a deadlock involving all the threads.
Ans – (1, 2, 4)
Explanation –