Operating System
Operating System
Operating System
Answer: a) Starvation
What is the process control block (PCB)?
• a) It stores all the information about a process.
• b) It controls the execution of processes.
• c) It allocates memory to the processes.
• d) It terminates the process.
Answer: c) The page is referenced but not yet loaded into memory.
In a paged memory system, each page has a size of 4KB, and the
address size is 32 bits. What is the maximum number of pages a
process can have?
• a) 2^10
• b) 2^12
• c) 2^20
• d) 2^22
Answer: c) 2^20
Explanation: 32-bit address space means 2^32
addresses. Since the page size is 4KB (2^12), the
number of pages is 2^32 / 2^12 = 2^20.
In a multithreaded environment, when multiple threads access
shared data concurrently, which mechanism can be used to
ensure correct execution of operations?
• a) Context switching
• b) Interrupt handling
• c) Mutual exclusion using locks or semaphores
• d) Paging
Answer: b) Processes are moved between queues based on their behavior and execution history.
Explanation: The Multilevel Feedback Queue scheduling algorithm moves processes between
different priority queues based on how long they run and how often they are preempted, thus
dynamically adjusting the process priorities.
fi
In UNIX, a fork system call is used to create a new process. Which of the
following is NOT true about the process created by the fork call (child
process)?
• a) It is a duplicate of the parent process, with the same memory contents and
program counter.
• b) The child process has a different Process ID (PID) than the parent.
• c) File descriptors opened by the parent are also shared with the child.
• d) The child process inherits the memory and le locks of the parent.
Answer: d) The child process inherits the memory and le locks of the parent.
Explanation: The child process does not inherit the memory and le locks of the
parent process. While it inherits le descriptors, the locks and memory regions are
distinct.
fi
fi
fi
fi
Consider a set of processes with the following burst times:
• P1 = 10 ms, P2 = 5 ms, P3 = 8 ms.
• The scheduling algorithm used is Shortest Job First (SJF).
• What is the average waiting time for these processes?
Solution
Order of execution (Shortest Job First): P2 -> P3 -> P1.
• Waiting time:
P2 = 0 ms,
P3 = 5 ms (after P2),
P1 = 13 ms (after P2 and P3).
• Average waiting time = (0 + 5 + 13) / 3 = 6 ms.
Consider a set of 3 processes with the following burst times:
• P1 = 5 ms, P2 = 8 ms, P3 = 12 ms.
• If the system uses Round Robin (RR) scheduling with a time quantum of 4 ms,
calculate the total time required to complete all processes.
First Round: Each process gets 4 ms.
P1 (done), P2 (remaining 4 ms), P3 (remaining 8 ms)
Second Round: P2 (done), P3 (remaining 4 ms)
Third Round: P3 (done).
Total time = 5 ms (P1) + 8 ms (P2) + 12 ms (P3) = 25 ms.
A system uses Priority Scheduling with the following processes:
• P1 (priority 3), P2 (priority 1), P3 (priority 2), P4 (priority 4).
• Process burst times are: P1 = 4 ms, P2 = 9 ms, P3 = 3 ms, P4 = 5 ms.
• What is the order of execution of processes and the total completion
time?
Higher priority (lower number) processes are executed rst:
Order: P2 -> P3 -> P1 -> P4.
Total completion time: 9 ms (P2) + 3 ms (P3) + 4 ms (P1) + 5 ms
(P4) = 21 ms.
fi
Consider the following processes with their burst times and arrival times:
• a) 64 bytes
• b) 256 bytes
• c) 512 bytes
• d) 1024 bytes
Explanation: The segment has 64 pages, and each segment table entry is 4 bytes.
Therefore, the total size of the segment table is 64 *4 = 256 bytes for page entries,
and IF we also need to store segment information, the total size is 512 bytes.
In a system with non-contiguous memory allocation using paging, the TLB miss rate is
8%, and the main memory access time is 200 ns. If the time to handle a TLB miss is
600 ns, what is the e ective memory access time?
• a) 216 ns
• b) 248 ns
• c) 256 ns
• d) 296 ns
Answer: d) 296 ns
ff
Consider a system with hardware support for segmentation and paging. A
process has 5 segments, each containing 16 pages, with each page being 1KB.
What is the minimum number of bits required to represent a logical address in
this system?
• a) 10 bits
• b) 15 bits
• c) 19 bits
fi
In process creation, which of the following is responsible for copying the address space
and process environment of the parent to the child?
• A) fork()
• B) exec()
• C) clone()
• D) thread_create()
Answer: A) fork()
Which of the following is a major problem with Race Conditions?
• A) The execution outcome depends on the order of thread/process execution.
• B) It prevents multithreading.
• C) It uses excessive CPU time.
• D) It blocks user input.
fi
The concept of Monitors in concurrency control:
• A) Requires that only one process is active within a monitor at any time.
• B) Provides a hardware-based solution to synchronization.
• C) Is used only in non-preemptive systems.
• D) Cannot be implemented using semaphores.
Answer: A) Requires that only one process is active within a monitor at any time.
Which of the following is TRUE for Mutexes?
• A) A mutex allows multiple threads to access the same critical section at once.
• B) A mutex must be unlocked by the thread that locked it.
• C) Mutexes can lead to race conditions if used incorrectly.
• D) A mutex can be locked by one thread and unlocked by another.
Answer: B) A mutex must be unlocked by the thread that locked it.
In a system with priority scheduling, which of the following is a common problem, and how i
resolved?
• A) Starvation, solved by aging
• B) Deadlock, solved by preemption
• C) High CPU utilization, solved by round robin
• D) Low throughput, solved by First-Come-First-Served
fl
Which of the following page replacement algorithms is theoretically optimal but
impractical to implement, and why?
• A) Least Recently Used (LRU), because it requires additional hardware for tracking
usage.
• B) FIFO, because it does not consider the frequency of page accesses.
• C) Optimal Page Replacement, because it requires future knowledge of the memory
reference string.
• D) Clock Algorithm, because it has higher overhead than LRU.
Answer: C) Optimal Page Replacement, because it requires future knowledge of the
memory reference string.
In the context of deadlock recovery, why is process termination typically avoided as a
rst option?
• A) It may cause cascading failures in other processes due to dependency chains.
• B) It does not guarantee that resources will be freed for other processes.
• C) It requires signi cant computational resources to restart terminated processes.
• D) It leads to permanent resource leaks in the system.
Answer: A) It may cause cascading failures in other processes due to dependency
chains.
fi
fi
Which of the following is TRUE regarding Belady’s anomaly in page
replacement algorithms?
• A) It is observed in the Least Recently Used (LRU) algorithm.
• B) It describes the situation where more frames result in fewer page faults.
• C) It occurs when adding more frames increases the number of page faults.
• D) It is caused by improper process synchronization.
Answer: C) It occurs when adding more frames increases the number of page faults.
Given a system using segmented paging with a segment size of 64KB and a page size of
4KB, how many bits are needed for the page offset, and what does this imply about the
page table structure?
• A) 10 bits for page offset, implying each page table entry points to a segment.
• B) 12 bits for page offset, implying the system supports large page sizes.
• C) 12 bits for page offset, implying that each segment can contain up to 16 pages.
• D) 10 bits for page offset, implying that the page tables themselves are segmented.
Answer: D) 10 bits for page offset, implying that the page tables themselves are segmented.
Which of the following is true about a CPU-bound process?
•A) Spends more time on I/O operations
• B) Spends more time on computation
• C) Requires less memory than I/O-bound processes
• D) Utilizes the CPU and I/O equally
Answer: C (First-In-First-Out)
Explanation:
Belady's anomaly occurs in FIFO when increasing the number of page frames
results in more page faults. LRU and Optimal do not suffer from this anomaly.
In virtual memory, when the system spends most of its time swapping pages rather than executin
processes, this condition is known as:
• A) Fragmentation
• B) Paging
• C) Thrashing
• D) Segmentation
Answer: C (Thrashing)
What is a zombie process in Unix-like systems?
• A) A process that has completed execution but still has an entry in the process table
• B) A process that is running in the background inde nitely
• C) A process that consumes all CPU resources without completing
• D) A process that has been suspended by the user
Answer: A (A process that has completed execution but still has an entry in the
process table)
Explanation:
A zombie process occurs when a process has nished execution, but its parent process has
not yet read its exit status, leaving an entry in the process table.
fi
fi
In UNIX, the le descriptor for standard input (stdin) is:
• A) 0
• B) 1
• C) 2
• D) 3
Answer: A (0)
Explanation:
In UNIX, le descriptors are integers that refer to open les. 0 is for standard input, 1 for standard
output, and 2 for standard error.
fi
fi
fi