-
A car's airbag controller must react within a fixed few milliseconds; a late response counts as a failure. Which kind of operating system suits this?
- Batch operating system
- Time-sharing operating system
- Distributed operating system
- Hard real-time operating system
Show answer
Answer: D · Hard real-time operating system
In a hard real-time system a missed deadline is a failure, so the OS must guarantee response times. Batch and time-sharing systems make no such guarantee.
-
When the OS switches the CPU away from a running process, what does it save in that process's PCB?
- A complete copy of the hard disk
- The program counter, CPU registers and other state needed to resume the process later
- Only the output files that the process has written
- Nothing, because the process restarts from the beginning when it next runs
Show answer
Answer: B · The program counter, CPU registers and other state needed to resume the process later
The saved program counter and registers let the process continue exactly where it stopped. Without them, every context switch would destroy the process's progress.
-
A Linux file shows the permissions -rwxr-x---. What can members of the file's group do?
- Read and execute it, but not change it
- Read, write and execute it
- Only read it
- Nothing at all
Show answer
Answer: A · Read and execute it, but not change it
The nine characters after the first dash are owner (rwx), group (r-x) and others (---). The group therefore has read and execute permission but no write permission.
-
Non-preemptive SJF: A arrives at 0 with burst 5, B at 1 with burst 4, C at 2 with burst 1, D at 3 with burst 2. What is the average waiting time?
- 2.50
- 3.25
- 4.50
- 6.25
Show answer
Answer: B · 3.25
A runs from 0 to 5. Then the waiting jobs run shortest first: C (5 to 6), D (6 to 8), B (8 to 12). Waiting times are A 0, B 7, C 3, D 3, so the average is 13 ÷ 4 = 3.25.
-
Preemptive priority scheduling (a smaller number means a higher priority): P1 arrives at 0 with burst 4 and priority 3; P2 at 1 with burst 2 and priority 1; P3 at 2 with burst 3 and priority 2. What is the average waiting time?
- 0.33
- 1.00
- 2.00
- 2.33
Show answer
Answer: C · 2.00
P1 runs 0 to 1, P2 pre-empts it and runs 1 to 3, P3 runs 3 to 6, then P1 finishes from 6 to 9. Waiting times are P1 5, P2 0, P3 1, so the average is 6 ÷ 3 = 2.00.
-
A binary semaphore S is initialised to 1 and protects a critical section. Process A has executed wait(S) and is inside the critical section. What happens when process B now executes wait(S)?
- B is blocked until A executes signal(S)
- B enters the critical section at the same time as A
- B is terminated with an error
- A is blocked so that B can go first
Show answer
Answer: A · B is blocked until A executes signal(S)
After A's wait(S) the value is 0, so B cannot decrement it and is put to sleep. When A executes signal(S) the value rises to 1 and B is woken. This gives mutual exclusion.
-
Memory access takes 200 ns, servicing a page fault takes 8 ms, and one memory access in 2,000 causes a page fault. What is the effective access time?
- 203.9 ns
- 4,000 ns
- 4,199.9 ns
- 8,000,200 ns
Show answer
Answer: C · 4,199.9 ns
EAT = (1 − p) × 200 + p × 8,000,000 ns with p = 1/2000 = 0.0005. That is 0.9995 × 200 + 0.0005 × 8,000,000 = 199.9 + 4,000 = 4,199.9 ns. Page faults dominate the result.
-
A file system uses 1 KB blocks and 4-byte block pointers. Each inode has 10 direct pointers and one single-indirect pointer. What is the largest file it can hold?
- 10 KB
- 256 KB
- 266 KB
- 1,034 KB
Show answer
Answer: C · 266 KB
A 1 KB block holds 1024 ÷ 4 = 256 pointers. The direct pointers cover 10 × 1 KB = 10 KB and the indirect block covers 256 × 1 KB = 256 KB, so the maximum is 266 KB.
-
A process references pages 1, 2, 3, 2, 4, 2, 6, 1, 2, 5, 1, 6 with 4 initially empty frames. How many page faults does the Optimal algorithm cause?
- 5
- 6
- 7
- 8
Show answer
Answer: B · 6
There are six different pages, so at least six faults are unavoidable, and Optimal achieves exactly that by evicting a page that is not needed soon (for example page 3, which is never used again, when 6 arrives). LRU causes 7 faults and FIFO causes 8.
-
A system has 10 units of a resource. P1, P2 and P3 hold 3, 2 and 2 units and may need at most 9, 4 and 7, so 3 units are free and the state is safe. P1 now requests 2 more units. What should the Banker's algorithm do?
- Grant it, because 2 units are fewer than the 3 available
- Grant it, because the request is within the maximum that P1 declared
- Terminate P1, because the request would cause a deadlock
- Make P1 wait, because granting it would leave no process able to finish
Show answer
Answer: D · Make P1 wait, because granting it would leave no process able to finish
The request is legal: 2 is at most the 6 units P1 may still need and at most the 3 free. But granting it leaves 1 unit free while P1, P2 and P3 still need 4, 2 and 5. None can finish, so the new state is unsafe and P1 must wait.
Want to test yourself? Take the same questions as a timed practice test and see your score. Start the practice test