Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Final Exam

Question 1: OS Structures, Process Management, and CPU Scheduling (10 Marks)

1.1. True or False: System calls are accessed by programs through a high-level API that
hides the underlying system call interface. (2 marks)

Answer: False
Explanation: System calls are accessed directly by programs through software interrupts or
traps that switch the CPU from user mode to kernel mode. A high-level API may simplify the
process, but the actual access mechanism involves system calls.

1.2. True or False: The short-term scheduler selects from the processes that are ready to
execute and allocates the CPU to one of them, whereas the long-term scheduler decides
which processes are admitted to the system for processing. (2 marks)

Answer: True
Explanation: The short-term scheduler, or CPU scheduler, makes frequent decisions on
which process to run next, while the long-term scheduler, or job scheduler, controls the
degree of multiprogramming by deciding which processes should be brought into memory for
execution.

1.3. When does a CPU scheduling decision take place? (Choose one) (6 marks)
A. When a process terminates.
B. When a process switches from running to waiting state.
C. When a process switches from running to ready state.
D. All of the above.

Answer: D. All of the above


Explanation: CPU scheduling decisions take place in various scenarios, including when a
process terminates, switches from running to waiting state, switches from running to ready
state, or switches from waiting to ready state. These decisions are crucial for maintaining
efficient and fair CPU utilization.
Question 2: Process Synchronization and Deadlocks (15 Marks)

2.1. True or False: Locks and semaphores are mechanisms used to ensure mutual
exclusion in process synchronization. (3 marks)

Answer: True
Explanation: Locks and semaphores are essential synchronization tools that prevent race
conditions by ensuring that only one process can access a critical section at a time. They help
maintain data consistency and prevent concurrent access issues.

2.2. True or False: In the readers-writers problem, writers need exclusive access to the
resource, but multiple readers can access the resource simultaneously. (3 marks)

Answer: True
Explanation: The readers-writers problem is designed to handle concurrent read and write
operations. Multiple readers can access the shared resource simultaneously without conflict,
but writers require exclusive access to prevent data inconsistencies.

2.3. What is a deadlock, and what are the conditions that cause it? (Choose one) (9
marks)
A. A situation where a single process is stuck in an infinite loop.
B. A state where processes are unable to progress because they are waiting for resources held
by other processes.
C. A temporary halt in process execution.
D. An error in process synchronization.

Answer: B. A state where processes are unable to progress because they are waiting for
resources held by other processes.
Explanation: Deadlock occurs when a set of processes are blocked, each holding a resource
and waiting for another resource held by another process. The four necessary conditions for
deadlock are mutual exclusion, hold and wait, no preemption, and circular wait.
Question 3: Memory Management, File System, and I/O (15 Marks)

3.1. True or False: In the context of memory allocation strategies, first-fit allocates the
first hole that is big enough, best-fit allocates the smallest hole that is big enough, and
worst-fit allocates the largest hole available. (3 marks)

Answer: True
Explanation: These are standard memory allocation strategies. First-fit finds the first
available block that fits the request, best-fit finds the smallest sufficient block to minimize
wastage, and worst-fit finds the largest block to potentially leave larger remaining spaces.

3.2. True or False: Virtual memory allows a system to use more memory than is
physically available by using disk space as an extension of RAM. (3 marks)

Answer: True
Explanation: Virtual memory enables a computer to compensate for physical memory
shortages by temporarily transferring data from RAM to disk storage. This process allows the
system to run larger applications and manage more processes simultaneously.

3.3. What is the purpose of the valid-invalid bit in a page table entry? (Choose one) (9
marks)
A. To indicate whether a page is currently in memory or on disk.
B. To specify the read/write permissions of a page.
C. To keep track of the age of a page.
D. To indicate whether a page is shared among multiple processes.

Answer: A. To indicate whether a page is currently in memory or on disk.


Explanation: The valid-invalid bit in a page table entry is used to indicate whether the
referenced page is currently loaded in physical memory (valid) or if it is stored on the disk
and needs to be fetched (invalid). This bit helps manage memory efficiently by distinguishing
between pages that are readily accessible and those that require disk access.

You might also like