Operating systems questions reward precise reasoning: identify the rule being tested, apply it to the given state or values, and distinguish the answer from a nearby but incorrect concept. This set covers process scheduling, process states, synchronisation, deadlock, address translation, TLBs, page replacement, page faults, file links, and disk scheduling.
These are general computer science practice questions, not a claim about any particular institution’s exam format. For an assessed course, check your syllabus and past papers to confirm the topics and terminology it uses. Each question below is followed immediately by its answer and explanation.
Scheduling and processes
The first question checks whether you can calculate waiting time rather than confuse it with turnaround time. All processes arrive together, so the scheduling order is determined by their burst lengths.
Three processes arrive at time 0 with CPU burst times P1 = 6 ms, P2 = 2 ms, and P3 = 4 ms. Under non-preemptive shortest-job-first scheduling, what is the average waiting time?
The order is P2, P3, P1. Their waiting times are 0, 2, and 6 ms, so the average is 8/3 = 2.67 ms. The 6.67 ms distractor is the average turnaround time: it includes each process's own burst, which waiting time does not.
The useful habit here is to write down the execution order and calculate each waiting time separately. If arrival times differ, shortest-job-first does not simply mean sorting every process by burst length; only processes that have arrived can be selected.
The next question tests how a process state changes when an I/O operation finishes. Keep the blocked or waiting state distinct from the ready state: a process waiting for an event cannot use the CPU yet.
A process is blocked while waiting for a disk read. The read completes, but the CPU is running another process. Which state does the waiting process normally enter next?
On I/O completion, the process becomes ready to run and joins the ready queue. It does not become running immediately because the CPU is occupied. The running option confuses eligibility to run with actually being selected by the scheduler.
A state diagram is often a quick way to check an answer: the completion of the event that caused a block normally moves the process from blocked to ready. A later scheduling decision moves it from ready to running.
Synchronisation and deadlock
This question asks for the essential semaphore pattern around a critical section. The operation that acquires access must happen before entering; releasing access happens after leaving.
A binary semaphore `mutex` is initialised to 1. Which pattern prevents two processes from entering the same critical section at the same time?
A successful wait decrements the semaphore before entry, so another process must wait while the first is inside. Signal releases it after the critical section. The first option reverses acquisition and release, so it does not protect the section as intended.
In a longer answer, state what happens if a process must wait: it cannot enter until the semaphore is available. Also be careful not to omit the signal; failing to release a semaphore can leave other processes waiting indefinitely.
Deadlock prevention can be tested by asking which condition a proposed policy breaks. Here, a global lock-acquisition order prevents a cycle in the resource-allocation graph.
Two processes can deadlock because each holds one lock and waits for the other. Which policy directly prevents this form of deadlock by eliminating circular wait?
A fixed global order prevents a cycle of processes waiting for locks in opposing orders, eliminating circular wait. The strongest distractor, eventual release, is not a sufficient rule: processes may each wait while holding a lock, with neither able to make progress.
When explaining deadlock, distinguish prevention from avoidance and detection. A lock order is a prevention strategy; merely hoping that a process eventually releases its locks does not establish a safe acquisition order.
Address translation and virtual memory
This item tests the split between a page number and an offset. With a 4 KiB page, the offset occupies 12 bits, or the final three hexadecimal digits of an address.
A system uses 4 KiB pages. Virtual address 0x12345 maps to frame 0x2A. What physical address results?
A 4 KiB page has a 0xFFF offset mask. The virtual page number is 0x12 and the offset is 0x345. Replacing the page number with frame 0x2A gives physical address 0x2A345. The 0x2A123 distractor moves the wrong digits into the offset.
Check the page size before translating: the page size determines how many low-order bits remain unchanged. A translation changes the frame number, not the offset within the page.
The TLB question requires counting memory accesses on a hit and a miss. Assume the stated single-level page table and no page faults; a miss needs one page-table memory access before the data access.
A TLB lookup takes 10 ns, a memory access takes 100 ns, and the TLB hit rate is 90%. On a hit, the lookup is followed by one memory access; on a miss, it is followed by a page-table memory access and then a data access. What is the effective access time?
A hit costs 10 + 100 = 110 ns. A miss costs 10 + 100 + 100 = 210 ns. The weighted mean is 0.9(110) + 0.1(210) = 120 ns. The 110 ns distractor gives only the hit time and ignores the 10% of accesses that miss.
Write the hit and miss costs before applying the hit rate. This makes the assumptions visible and prevents the common error of averaging only the memory access times.
Replacement, files, and disks
Here, the replacement rule is least recently used. Track the last use of each resident page; do not replace the page that has been resident longest unless it is also the least recently used.
Three frames are empty. Pages are referenced in this order: 1, 2, 3, 1, 4. Under LRU replacement, which page is evicted when page 4 is referenced?
Before page 4 arrives, the frames contain 1, 2, and 3. Page 1 was referenced most recently; page 3 was used after page 2. Page 2 is therefore least recently used and is evicted. Page 3 is a plausible distractor if the sequence is mistakenly treated as FIFO.
For LRU, the earlier reference to page 1 matters: it makes page 1 more recently used than pages 2 and 3. FIFO would ignore that access and select the page that entered memory first.
A page fault occurs when a process references a page that is not currently in its address space’s resident set. This question checks the usual handling sequence, rather than asking you to identify a particular replacement algorithm.
A process references a valid virtual page that is not currently in memory. Which sequence best describes the operating system's response to a page fault?
For a valid page that is absent, the operating system locates it on backing storage, obtains a frame (using replacement if needed), loads the page, updates the relevant mapping, and restarts the faulting instruction. Immediate termination is the strongest distractor, but is not the normal response to a valid demand-paged reference.
The word “valid” matters: a reference to an invalid address may lead to an error or process termination, whereas a valid but non-resident page can be brought into memory.
The next question distinguishes a hard link from a symbolic link. Focus on what each directory entry refers to, not just whether both names can open a file.
Which statement best describes a symbolic link compared with a hard link on a typical Unix-like file system?
A symbolic link stores a path to its target and may become dangling if that path no longer resolves. A hard link names the same inode through another directory entry. The second option reverses these definitions, making it the strongest distractor.
These are typical Unix-like filesystem concepts; details and restrictions can vary by operating system and filesystem. In an exam answer, state the distinction clearly before adding any platform-specific caveat.
Finally, shortest-seek-time-first (SSTF) selects the pending request nearest to the current head position. Do not apply an assumed scan direction unless the question names a directional scan policy.
A disk head is at cylinder 50. The pending requests are for cylinders 10, 55, 58, and 90. Under SSTF, which request is served next?
The distances from cylinder 50 are 40, 5, 8, and 40. SSTF selects cylinder 55, the nearest request. Choosing 10 would fit a downward SCAN direction, but SSTF does not impose a scan direction.
SSTF is a local choice: it selects the nearest request now, not necessarily the route with the shortest total movement across the whole queue. It can also leave distant requests waiting if closer requests keep arriving.
Review what you missed
After attempting the set, sort errors by the reason behind them. A calculation mistake calls for a worked example; a concept mix-up calls for a concise contrast, such as LRU versus FIFO or a hard link versus a symbolic link. Revisit a question after a delay rather than relying on recognition immediately after reading its explanation.
A weak-area view can direct the next revision session towards repeat errors rather than topics that already feel familiar.
If the same missing detail costs marks twice, turn it into a short retrieval prompt. For example, ask yourself how LRU differs from FIFO and require the answer to mention the most recent reference, not merely the page’s arrival time.
You lost this mark twice: with a 4 KiB page, which 12 bits of a virtual address form the offset, and what happens to that offset during translation?
How MySummaries helps
Build a revision board from your operating-systems notes, then use it to generate questions and flashcards from the material you are studying. Review errors by topic and practise recalling the distinction or calculation that caused each lost mark. Start at MySummaries.