GATE GATE Operating Systems 2 — Questions and Answers
Question 1: In a demand-paging system, a page fault occurs when:
- A page is swapped out to disk
- A referenced page is not in physical memory (Correct answer)
- The page table overflows
- Two processes share the same page
Correct answer: A referenced page is not in physical memory
A page fault is triggered when a process accesses a virtual page that is not currently loaded into physical memory.
Question 2: What is the purpose of a semaphore in operating systems?
- To allocate memory pages
- To synchronize concurrent processes (Correct answer)
- To handle I/O interrupts
- To manage the page table
Correct answer: To synchronize concurrent processes
Semaphores are synchronization primitives used to control access to shared resources among concurrent processes.
Question 3: Which of the following is a non-preemptive CPU scheduling algorithm?
- Shortest Remaining Time First
- Round Robin
- First Come First Served (FCFS) (Correct answer)
- Preemptive Priority
Correct answer: First Come First Served (FCFS)
FCFS is non-preemptive because once a process starts executing, it runs to completion without being interrupted.
Question 4: In the context of file systems, what does inode contain?
- File name and directory path
- File metadata and pointers to data blocks (Correct answer)
- File content only
- User and group permissions only
Correct answer: File metadata and pointers to data blocks
An inode stores file metadata (size, permissions, timestamps) and pointers to the actual data blocks on disk, but not the filename.
Question 5: What is thrashing in the context of virtual memory?
- Excessive disk I/O due to constant page swapping (Correct answer)
- CPU spending more time on process execution
- Too many processes waiting for I/O
- Memory fragmentation causing allocation failures
Correct answer: Excessive disk I/O due to constant page swapping
Thrashing occurs when a system spends more time swapping pages in and out of memory than executing actual process instructions.
Question 6: Which process state transition is NOT valid in a typical OS process state diagram?
- Running → Waiting
- Ready → Running
- Waiting → Running (Correct answer)
- Running → Ready
Correct answer: Waiting → Running
A process in the Waiting state must first move to the Ready state after its I/O completes before it can be scheduled to run again.
In a demand-paging system, a page fault occurs when: