CPA CPA Operating Systems & Process Management 2 — Questions and Answers
Question 1: What is virtual memory in modern operating systems?
- RAM installed on the GPU
- A technique that uses disk space to extend apparent RAM (Correct answer)
- Memory reserved for the OS kernel only
- Cache memory inside the CPU
Correct answer: A technique that uses disk space to extend apparent RAM
Virtual memory uses secondary storage to give processes the illusion of more RAM than physically exists by swapping pages in and out.
Question 2: In memory management, what is a 'page fault'?
- A hardware defect in a RAM chip
- An error in the CPU cache
- An interrupt triggered when a process accesses a page not currently in physical memory (Correct answer)
- A permissions error on a file page
Correct answer: An interrupt triggered when a process accesses a page not currently in physical memory
A page fault is an interrupt raised by the MMU when the requested memory page is not present in RAM and must be loaded from disk.
Question 3: Which inter-process communication (IPC) method provides a one-way data stream between a producer and consumer process?
- Shared memory
- Pipe (Correct answer)
- Semaphore
- Signal
Correct answer: Pipe
A pipe provides a unidirectional byte stream that lets one process write data which another process reads.
Question 4: What is the difference between a process and a thread?
- Threads have their own memory space; processes share memory
- A process has its own memory space; threads within a process share the same memory space (Correct answer)
- Threads can only run on a single CPU core
- Processes are always faster than threads
Correct answer: A process has its own memory space; threads within a process share the same memory space
A process has an independent address space, while threads within the same process share the same address space but have separate stacks and registers.
Question 5: What does the fork() system call do in Unix/Linux?
- Loads a new executable into the current process
- Creates a new thread in the current process
- Creates a child process that is a copy of the calling process (Correct answer)
- Terminates the calling process and spawns a replacement
Correct answer: Creates a child process that is a copy of the calling process
fork() duplicates the calling process, creating a child with the same code, data, and file descriptors but a different PID.
Question 6: Which page replacement algorithm replaces the page that has not been used for the longest period of time?
- FIFO
- Optimal
- Least Recently Used (LRU) (Correct answer)
- Clock
Correct answer: Least Recently Used (LRU)
LRU evicts the page whose most recent use is furthest in the past, approximating optimal replacement based on past access history.
What is virtual memory in modern operating systems?