📝 Operating System Operations (30 MCQs)
Privileged Execution and the Operating System Control Model
Operating system operations describe the rules and mechanisms through which the kernel controls processor execution, hardware access, and application activity. Dual-mode operation separates restricted user execution from privileged kernel execution using a hardware-supported mode indicator. The kernel responds to interrupts, exceptions, and system calls, maintaining control over critical resources while providing applications with authorised access to system services.
Why Privilege Separation and Controlled Execution Are Necessary
Without hardware-enforced execution restrictions, an application could modify kernel memory, execute privileged instructions, or interfere with another process. Dual-mode operation establishes a protection boundary, while timer interrupts prevent one process from monopolising the CPU indefinitely. These mechanisms allow the kernel to retain control even when applications behave incorrectly or consume excessive processor time.
System Calls, Interrupts, Exceptions, and Timer Operation
A system call deliberately transfers execution into a kernel handler, whereas an interrupt normally reports an asynchronous hardware event. An exception occurs during instruction execution, for example through an invalid memory access or division error. A timer interrupt allows the scheduler to regain control after a configured interval. The kernel handles each event and resumes, blocks, or terminates the affected process as appropriate.
Tracing a User Process After a Timer Interrupt
Suppose a process executes in user mode while a timer is configured to interrupt the CPU after 10 milliseconds. When the timer expires, hardware transfers control to the kernel's interrupt handler. The scheduler may select another ready process, save the previous execution context, and dispatch the next process. This prevents unrestricted CPU occupation by one application.
Protection Boundaries, Interrupt Handling, and System Efficiency
Privilege separation protects kernel instructions and sensitive resources, while interrupts provide timely responses to hardware events and exceptions. Timer-based control supports preemptive scheduling and fairer CPU sharing. However, transitions between modes, interrupt handling, and context switching consume processing time. Excessive interrupts or poorly designed handlers can increase overhead and reduce application responsiveness.
Misconceptions About Modes and Kernel Events
'A system call and an interrupt are identical' is incorrect because a system call is an intentional service request, whereas hardware interrupts generally report asynchronous events. 'User mode cannot execute application instructions' is incorrect because ordinary application code executes there. 'Every exception is caused by faulty hardware' is incorrect because software instructions can generate exceptions.
Exam Focus: Privilege Levels and Control Transfers
Trace the transitions between user mode and kernel mode for system calls, interrupts, and exceptions. Distinguish synchronous exceptions from asynchronous interrupts and explain how timer events support preemption. Questions may involve privileged instructions, mode bits, interrupt handlers, context switching, and the consequences of attempting unauthorised kernel operations.
Key Terms of Operating System Operations
- User mode - Restricted application execution mode.
- Kernel mode - Privileged operating system execution mode.
- System call - Explicit request for kernel service.
- Interrupt - Asynchronous event notification.
- Exception - Synchronous instruction-related event.
- Timer - Hardware mechanism generating periodic interrupts.
📝 All Operating System Operations MCQs
Q1. A user application attempts to execute an instruction that changes the page-table base register. What should the processor do while the application is in user mode?
📖 Explanation: The instruction is privileged, so the processor traps to the kernel, which checks whether the caller has authority to perform the change. Direct execution is tempting, but user mode cannot alter protected translation state.
Q2. A process enters an infinite loop and never voluntarily yields the CPU. Which mechanism allows the operating system to regain control?
📖 Explanation: A timer interrupt periodically returns control to the kernel, allowing it to preempt a process that never yields. Waiting for voluntary cooperation cannot protect the system from an infinite loop or runaway application.
Q3. When a device raises interrupt vector number 12, what does the corresponding vector entry normally identify?
📖 Explanation: The interrupt vector supplies the entry address for the handler associated with an interrupt number. A device-register answer confuses event identification with the routine address used to service that event.
Q4. A processor encounters division by zero while executing an application instruction. How should this event be classified compared with a hardware disk interrupt?
📖 Explanation: An exception is synchronous with the instruction causing it, while a hardware interrupt is asynchronous to the current instruction stream. Reversing these terms is tempting, but external device events need not originate from executing instructions.
Q5. A monitoring application receives temperature readings only once every several seconds. Which device communication approach generally avoids wasting CPU cycles continuously checking for new readings?
📖 Explanation: For infrequent events, interrupts avoid repeated status checks while the CPU performs useful work. Polling may suit predictable high-rate events; repeated polling wastes cycles during long idle periods and consumes processor time.
Q6. A company's print server accepts documents from several employees and stores completed print jobs on disk until the printer becomes available. Which operating-system technique is being used?
📖 Explanation: Spooling places completed jobs in a disk-backed queue for a shared device such as a printer. Buffering smooths data flow during transfer; the buffer-only answer misses queued-job management and scheduling.
Q7. A processor maintains a hardware mode bit to distinguish application execution from privileged operating-system execution. What information does this bit represent?
📖 Explanation: The mode bit records the current privilege level, allowing hardware to distinguish restricted application execution from privileged kernel execution. Process identity is separate; the tempting process-identifier interpretation confuses two different attributes.
Q8. A web server submits an asynchronous disk-read request and continues processing other incoming requests. What is the main characteristic of this I/O operation?
📖 Explanation: After an asynchronous I/O request is submitted, the application may continue other work rather than waiting for completion. The tempting blocking choice prevents overlap, but it is not required by asynchronous I/O.
Q9. A database uses a write-back cache. A recently modified database block exists in cache but has not yet been written to main memory or persistent storage. Which consequence is possible after an unexpected power failure?
📖 Explanation: A write-back cache can hold newer data than main memory until its dirty line is flushed. Immediate consistency is tempting but wrong; a failure before flushing may lose recent updates.
Q10. A computer allows several users to interact with applications while the processor rapidly switches among runnable tasks. Which operating-system capability primarily supports this interactive behavior?
📖 Explanation: A time-sharing system switches among runnable jobs so users experience interactive responsiveness. Frequent preemption and rapid CPU sharing distinguish it from simple multiprogramming, which need not provide short interactive response intervals.
Q11. A hardware timer generates 250 interrupts per second. What is the time interval between successive interrupts?
📖 Explanation: A timer generates 250 interrupts per second. Its interval is second, or 4 milliseconds under steady periodic operation. The tempting 250-millisecond answer confuses interrupt frequency with the time between successive events.
Q12. A process has base address 8000 and limit 1200. It requests logical offset 1199. Which physical address should the memory-protection hardware generate?
📖 Explanation: With base address 8000 and limit 1200, a process requests logical offset 1199. Hardware permits it because the offset is below the exclusive limit; the tempting 1200-byte boundary is outside the valid range.
Q13. A student claims that a synchronous disk-read request always allows its calling process to continue immediately after issuing the request. Which correction is accurate?
📖 Explanation: The claim ignores the wait for completion: a synchronous read may block its caller until data arrives. The tempting immediate-continuation answer describes asynchronous behavior, not the usual synchronous request semantics.
Q14. A process is blocked while waiting for a disk operation. The controller completes the operation and signals the processor. What is the normal next state of that process?
📖 Explanation: When a disk operation completes for a process waiting on that operation, the operating system moves it from Blocked to Ready. The tempting direct-running transition ignores the scheduler's dispatch decision.
Q15. A storage controller transfers 6 MiB of data using DMA at an effective rate of 150 MiB/s. Ignoring setup and notification overhead, how long does the transfer take?
📖 Explanation: A controller transfers 6 MiB using DMA at 150 MiB/s. Ignoring setup, time is seconds, or 40 milliseconds. The tempting 25-millisecond result reverses the ratio and miscalculates transfer time.
Q16. A user process invokes a system call, the kernel performs the requested operation, and control returns to the same process. Which statement is correct?
📖 Explanation: A system call can cause a mode switch without changing the running process. The tempting context-switch answer is wrong: the kernel can return to the same caller without scheduling another process.
Q17. A device is polled 500 times per second, and each check consumes 20 microseconds of CPU time. What percentage of one CPU's time is spent polling?
📖 Explanation: A device is polled 500 times per second, and each check consumes 20 microseconds. CPU time spent polling is microseconds per second, or 1%; 10% is a decimal-place error.
Q18. A monitoring system records CPU utilization against polling frequency: (1, 95%) ; (2, 92%) ; (4, 86%) ; (8, 74%) ; (10, 68%), where frequency is measured in thousands of checks per second. What utilization is recorded at eight thousand checks per second?
📖 Explanation: The table shows utilization falling as polling frequency rises. At eight thousand checks per second, utilization is 74%; the tempting 68% belongs to ten thousand checks, not the requested frequency.
Q19. A kernel temporarily masks a particular hardware interrupt while updating a shared interrupt-related data structure. What may happen if that interrupt occurs during the masked interval?
📖 Explanation: Masking prevents a selected interrupt from being serviced immediately, but its request may remain pending. The tempting permanent-loss assumption is wrong; after unmasking, the processor can deliver the event when safely possible.
Q20. A system call receives a pointer to a memory buffer supplied by an application. A student claims that the kernel can trust this pointer because the request entered through a system call. What is the correct approach?
📖 Explanation: A system call does not make a user pointer trustworthy. The kernel must validate the address range and access permissions before using it; the tempting automatic-trust assumption would let applications request unsafe memory access.
Q21. A system call enters kernel mode and returns to the same process. A student records both a mode switch and a context switch. Which step in the student's reasoning is flawed?
📖 Explanation: Entering kernel mode and returning to the same process is a mode switch, not necessarily a context switch. The flawed step is counting a process change; context switching occurs only when execution changes to another process.
Q22. A device generates 2,000 interrupts per second, and each interrupt handler consumes 8 microseconds of CPU time. What percentage of one processor's time is spent executing these handlers?
📖 Explanation: At 2,000 interrupts per second, handlers consume microseconds each second, equal to 1.6% of one CPU. The tempting 16% misplaces the decimal by a factor of ten in the utilization calculation.
Q23. A low-priority disk interrupt arrives while the processor is handling a higher-priority timer interrupt. The disk interrupt is currently masked. What should happen to the disk request?
📖 Explanation: A masked low-priority interrupt remains pending until the processor can accept it. It cannot preempt the higher-priority handler; the tempting immediate-preemption answer ignores priority masking and interrupt acceptance rules at that moment.
Q24. A monitoring system records interrupt rate and CPU time spent in handlers: (1, 1%) ; (2, 2%) ; (4, 4%) ; (6, 6%) ; (8, 8%), with interrupt rate measured in thousands per second. What handler overhead is expected at six thousand interrupts per second?
📖 Explanation: At six thousand interrupts per second, the table reports 6% handler overhead. The linear pattern assigns one percentage point per thousand interrupts; the tempting 8% value belongs to the highest listed rate.
Q25. A server submits a large asynchronous disk read using DMA. The application continues computing while the controller transfers the data and raises an interrupt when finished. Which statement correctly describes these operations?
📖 Explanation: DMA can transfer the block without the CPU copying every byte, while an interrupt notifies the kernel when the transfer finishes. The tempting byte-copy assumption confuses data movement with completion notification.
Q26. A DMA controller writes new data into RAM while a processor retains an older cached copy of the same memory address. What is required to prevent the processor from consuming stale data?
📖 Explanation: DMA may update RAM while a processor retains an older cache line. Coherence or explicit cache maintenance must prevent stale data use; the tempting assumption that DMA updates every private cache is unsafe.
Q27. A user application attempts to disable hardware interrupts directly to prevent interruption during its calculation. How should the processor handle this request?
📖 Explanation: Disabling interrupts is privileged because doing so could prevent essential kernel events from being serviced. Hardware therefore traps or rejects the user request; the tempting direct-execution choice would undermine system control.
Q28. A system records interrupt-mask duration and maximum observed interrupt delay: (0, 0.2 ms) ; (1, 1.2 ms) ; (2, 2.2 ms) ; (4, 4.2 ms) ; (8, 8.2 ms). What maximum delay corresponds to a four-millisecond masking interval?
📖 Explanation: The table shows interrupt delay increasing with the duration of masking. At a four-millisecond mask interval, the recorded maximum delay is 4.2 milliseconds; the tempting 8.2 milliseconds belongs to eight milliseconds.
Q29. A server handles 100,000 device interrupts per second. Each handler consumes 2 microseconds, and each interrupt entry-return transition adds 0.5 microseconds. What percentage of one CPU is consumed by this overhead?
📖 Explanation: Each interrupt costs 2 microseconds in the handler plus 0.5 microseconds for entry and return. Thus microseconds per second, or 25% CPU overhead for the processor during each one-second measurement interval.
Q30. A process submits a DMA request for 8 MiB at 400 MiB/s. The transfer takes place first, and the completion handler then requires 1 millisecond to finish. What is the earliest time at which completion can be reported to the waiting process?
📖 Explanation: DMA transfer takes seconds, or 20 milliseconds. Adding the 1-millisecond completion handler gives 21 milliseconds; the tempting 20 milliseconds omits notification handling after transfer completes to the waiting process.