📝 Operating System Services (30 MCQs)
Essential Services Provided by the Operating System
Operating system services provide the interfaces and facilities that applications and users require to interact with computer hardware. They belong to the kernel and associated system software and include program execution, input/output operations, file manipulation, communication, error detection, resource allocation, accounting, and protection. These services coordinate hardware resources while presenting consistent facilities that reduce the need for applications to manage devices independently.
Why Applications Depend on Standard Operating System Facilities
Applications cannot safely or efficiently control every processor, storage device, and peripheral directly. Different hardware models require different control procedures, while concurrent applications must share resources without interfering with one another. Operating system services address these requirements through standard interfaces, controlled hardware access, resource management, and protection mechanisms, allowing software to remain relatively independent of particular hardware implementations.
How Kernel Services Handle Application Requests
An application requests an operation through a library interface or system call. The kernel validates the request, checks permissions, and transfers it to the appropriate subsystem. A file request reaches the file system, while a device request may involve a driver. The service returns a result or error code, allowing the application to continue execution or handle the failure.
Using File and Communication Services in One Application
Consider an application that reads a 4 KiB configuration file and sends its contents through a network connection. The file service retrieves the required data, while communication services transfer it through the networking subsystem. The operating system coordinates both operations, manages buffers, and checks access rights without requiring the application to control the storage and network hardware directly.
Resource Allocation, Reliability, and Service Performance
Operating system services improve resource utilisation, simplify application development, and establish consistent protection boundaries. Error detection helps identify hardware and software failures, while accounting records resource consumption. However, service requests introduce kernel-transition and processing overhead. Resource contention, inefficient I/O, and excessive communication can also increase latency, particularly in heavily loaded multiuser servers and real-time environments.
Misconceptions About Kernel Services and Application Facilities
'Every operating system service executes in kernel mode' is incorrect because many supporting utilities execute in user space. 'File manipulation means controlling physical disk sectors directly' is incorrect because applications normally use file-system interfaces. 'Resource allocation always guarantees equal sharing' is incorrect because scheduling and allocation policies may prioritise workloads differently.
Exam Focus: Identifying and Classifying Operating System Services
Be able to distinguish program execution, I/O, file manipulation, communication, error detection, resource allocation, accounting, and protection. Given an application operation, identify the relevant operating system service and its interaction with kernel components. Examination questions may also compare services with system calls and distinguish user-facing facilities from the privileged mechanisms that implement them.
Key Terms of Operating System Services
- Program execution - Loading and running programs.
- I/O operation - Requesting input or output.
- Communication - Exchanging data between processes.
- Accounting - Recording resource consumption.
- Protection - Controlling authorised resource access.
- Error detection - Identifying system faults.
📝 All Operating System Services MCQs
Q1. A systems administrator enters a command to list files, and the operating system interprets the command and starts the requested utility. Which service directly provides this interaction?
📖 Explanation: The command interpreter accepts commands and requests the appropriate system actions. Program execution runs the selected utility afterward; accounting records usage, while error detection handles faults rather than interpreting commands.
Q2. A web server creates a child process with fork(), then replaces the child's program image with a worker executable. Which statement describes the sequence correctly?
📖 Explanation: fork() duplicates the calling process to create a child, and exec() loads a new program image into that process. The tempting reversal in option B assigns each call the other's role.
Q3. A user application requests data from a hardware device. Which design best preserves protection while still providing the I/O service?
📖 Explanation: A system call transfers control to trusted kernel code, which validates the request and accesses the device. Direct controller instructions from user mode bypass protection; rebooting is unnecessary for ordinary I/O.
Q4. A storage driver reports a failed write, while a memory manager detects an invalid access. Which operating-system service is responsible for noticing and responding to such conditions?
📖 Explanation: Error detection monitors failures in CPU, memory, I/O devices, and programs, then initiates suitable handling. Accounting measures resource use, while file naming and command interpretation serve unrelated user-facing purposes after identifying the source.
Q5. A document editor asks the operating system to create a file, write data, rename it, and change its permissions. Which service family handles these requests?
📖 Explanation: File-system manipulation includes creating, deleting, reading, writing, renaming, and changing file attributes or permissions properly. CPU dispatching selects a process to run; it does not perform directory or file operations.
Q6. Two processes on one computer exchange large data blocks repeatedly. Which communication method can reduce repeated kernel-mediated message copying when both processes are trusted to coordinate access?
📖 Explanation: Shared memory lets processes access a common mapped region, avoiding repeated message copies after setup. The tempting disk-file approach adds storage I/O, while synchronization is still required to prevent conflicting updates.
Q7. A shared server stores user files with owner, group, and other access permissions. Which operating-system mechanism most directly decides whether a process may read a particular file?
📖 Explanation: Access-control checking compares the requesting process's identity and requested operation with the file's permissions. Scheduling determines CPU or disk service order, but it does not authorize access to protected data.
Q8. An administrator wants a report showing how much CPU time and storage each account consumed during the month. Which operating-system service supplies the measurements needed for this report?
📖 Explanation: Resource accounting records usage such as CPU time, memory, storage, and I/O activity for monitoring or billing. Error recovery handles faults, while program loading and message passing provide different services.
Q9. A device transfers a large block directly between its controller and main memory. The CPU is notified when the transfer finishes. Which mechanism is being used?
📖 Explanation: DMA allows a controller to transfer a block between a device and memory with limited CPU intervention, usually interrupting on completion. Polling every byte wastes CPU time and is not the described transfer.
Q10. A batch system runs P1 with arrival 0 and burst 5, then P2 with arrival 2 and burst 3, using non-preemptive FCFS. What are P2's waiting time and turnaround time?
📖 Explanation: P1 occupies the CPU from 0 to 5, so P2 starts at 5 and completes at 8. Its waiting time is , and turnaround is ; option D omits the queued interval.
Q11. A print server uses Round Robin with quantum 2. P1 arrives at 0 with burst 5; P2 arrives at 1 with burst 2. The queue initially contains P1. Which completion time results for P1?
📖 Explanation: The schedule is P1 0–2, P2 2–4, P1 4–6, then P1 6–7. P1 completes at 7; option B forgets that the remaining P1 burst must be requeued after its second quantum.
Q12. A bounded buffer has capacity 8. Producers and consumers coordinate using counting semaphores named empty and full, plus a mutex. Which initial values are correct?
📖 Explanation: Initially all eight slots are empty and no items are available, so empty is 8 and full is 0. Mutex starts at 1 for exclusive access; option A reverses the buffer counts.
Q13. A machine uses 32-bit logical addresses, 4 KiB pages, and 4-byte page-table entries. A student says the table has entries because the offset is 12 bits. What is the correct assessment?
📖 Explanation: The 12-bit offset leaves 20 page-number bits, so there are entries. At 4 bytes each, the table is 4 MiB; the student's error is using offset bits as the entry count.
Q14. A demand-paged application has memory access time 100 ns, page-fault probability , and average page-fault service time 8 ms, including restart. What is its approximate effective access time?
📖 Explanation: Using , the result is ns, approximately 8,100 ns. Option D ignores the ordinary access on nonfaulting references. The tempting alternative, 8,000,000 ns, forgets probability weighting and successful accesses.
Q15. A file system uses indexed allocation with one index block containing 1,024 four-byte pointers. Data blocks are 4 KiB. Ignoring metadata overhead, what is the maximum file size addressable by that index block?
📖 Explanation: The index block holds 1,024 pointers, each selecting one 4 KiB data block. Thus the maximum is KiB = 4 MiB; option A incorrectly treats the pointer count as bytes.
Q16. A service uses a strict-priority scheduler. A low-priority maintenance process remains ready while high-priority requests arrive continuously. What is the principal risk, and what common remedy addresses it?
📖 Explanation: Strict priority can indefinitely postpone a low-priority process when higher-priority work keeps arriving. Aging gradually raises the waiting process's priority over time; disabling interrupts does not provide fair CPU allocation.
Q17. A resource-allocation graph contains a directed cycle, and every resource type in that cycle has exactly one instance. What follows from this condition?
📖 Explanation: With one instance of each resource type, a directed cycle is sufficient to establish deadlock. Option D is tempting because it fits some multi-instance cases, but it is incorrect here.
Q18. A system's CPU utilization is measured at different degrees of multiprogramming: (1,35%), (2,58%), (3,76%), (4,84%), (5,81%), (6,70%). At which degree is utilization highest?
📖 Explanation: The listed utilization rises to 84% at degree 4, then falls to 81% and 70%. Therefore degree 4 is the peak; option C selects a later point after utilization has already declined.
Q19. A page-replacement test records frames and page faults as follows: (1,14), (2,11), (3,8), (4,8), (5,6). How many fewer faults occur with four frames than with two?
📖 Explanation: The table gives 11 faults with two frames and 8 with four, so the reduction is . Option B subtracts the five-frame result instead of the requested four-frame result; it uses the wrong comparison.
Q20. A disk request stream is served by C-LOOK. The head starts at 40, moves upward, and the sorted requests are 10, 25, 45, 60, and 90. After reaching 90, it jumps to 10 and continues upward. What is total head movement?
📖 Explanation: Movement is cylinders: 40 to 45 to 60 to 90, jump from 90 to 10, then 25. Option C undercounts the circular jump from the highest request back to the lowest.
Q21. A student claims a process that enters the kernel for a system call must always incur a context switch because the CPU changes privilege modes. Which correction is most accurate?
📖 Explanation: A system call can enter kernel mode and return to the same process without scheduling another process. Option A confuses a privilege transition with a process change, which is the defining feature of a context switch.
Q22. A system has Allocation P0=(1,0,1), P1=(1,1,0), P2=(1,0,1); Max P0=(2,1,1), P1=(1,2,1), P2=(3,0,2); Available=(1,1,0). A student tests P1 using Max instead of Need. What is the correct Need for P1?
📖 Explanation: Need is calculated as Max minus Allocation. For P1, . Option A repeats Max without subtracting the resources already allocated; Need measures only the additional resources still required in this process.
Q23. A database process switches from P1 to P2. The CPU has a virtually indexed cache, and the TLB is tagged with address-space identifiers. Which statement about address translation is correct?
📖 Explanation: With address-space identifiers, TLB entries can remain distinguishable by process, so a switch need not flush all translations. Option A describes a conservative design without tags, not this tagged-TLB system.
Q24. A process holds a printer lock while waiting for a scanner, and another process holds the scanner while waiting for the printer. CPU scheduling alternates between them. Which statement best explains the situation?
📖 Explanation: The processes form a circular wait while each retains a resource, so CPU fairness cannot release the locks. Option D changes scheduling intervals, not the resource dependency that sustains deadlock.
Q25. A process uses a three-level page table. A logical address is split into fields of 8, 7, 5, and 12 bits, from most significant to least significant. What is the page offset size?
📖 Explanation: The least significant 12 bits identify the byte within a page, so the offset is 12 bits and the page size is bytes. Option C confuses the first index field with the offset.
Q26. A scheduler gives a process a 4 ms quantum, but the process blocks for disk I/O after 1 ms. The disk completes the request while another process runs. Which event makes the blocked process eligible for CPU scheduling again?
📖 Explanation: When the I/O completes, the kernel records the event and moves the process from waiting to ready. The unused quantum does not determine readiness; CPU dispatch occurs later when the scheduler selects it.
Q27. Resource R1 has two instances and R2 has one. P0 holds one R1 and requests R2; P1 holds R2 and requests one R1. The second R1 instance is unallocated, and the resource-allocation graph contains a cycle. What follows?
📖 Explanation: With multiple instances, a cycle is not sufficient to prove deadlock. P1 can receive the unallocated R1, finish, and release R2; option A incorrectly applies the single-instance rule for all resource types.
Q28. A file service uses an inode-style structure and must locate a file's data blocks without storing the file name in the inode. Which design is consistent with this approach?
📖 Explanation: An inode stores metadata and pointers to data blocks, while a directory maps a name to an inode number. Option A confuses directory naming with inode metadata and cannot locate data blocks.
Q29. A process requests a page that is absent from RAM. The operating system finds the page on disk, selects a victim frame, writes the victim if dirty, loads the needed page, and restarts the instruction. What event triggered this service sequence?
📖 Explanation: A reference to a nonresident page raises a page fault, causing the kernel to fetch it and possibly replace a frame. A TLB miss alone may be resolved from the page table without disk I/O.
Q30. Available=(1,1,1); Need P0=(1,0,1), P1=(0,1,0), P2=(1,1,2); Allocation P1=(1,0,1). After P1 completes, a student still uses the original Available vector and concludes only P0 can run. What is the correct conclusion?
📖 Explanation: When P1 finishes, its allocation returns to the pool: Available becomes . Both P0 and P2 meet their Need; option A wrongly keeps the old vector. Each can now proceed.