Modules 1–5 · Final Examination · Comprehensive
Final Examination
This is the comprehensive final examination for COMP 3150. It covers all thirteen units of the course, with emphasis on Modules 4 and 5 — file systems, I/O and storage management, security and protection, and virtualization and cloud operating systems. It is a three-hour, closed-book examination. The paper consists of four parts: a cumulative multiple-choice section, a short-answer section, a problem-solving section, and a design-and-analysis section. A complete instructor answer key with model answers and a marking guide is provided after the examination paper.
01 Examination details
| Course | COMP 3150 / CMIS 3150 — Operating Systems |
|---|---|
| Weight | Comprehensive final; weight determined by the assessment plan variant (see note in § 01.1) |
| Coverage | All units (1–13), with emphasis on Modules 4–5 (Units 10–13) |
| Duration | 3 hours (180 minutes) |
| Total marks | 100 marks |
| Format | Closed book. One A4 formula sheet (handwritten or printed, both sides) is permitted. Non-programmable calculator permitted. |
| Sections | Part A — Multiple choice (20 marks) Part B — Short answer (24 marks) Part C — Problems (36 marks) Part D — Design and analysis (20 marks) |
| CLOs assessed | CLO1, CLO2, CLO3, CLO4, CLO5, CLO6, CLO7, CLO8 |
1.1 Note on weight
The course development plan specifies a Midterm Examination (15%) and a Final Project (20%) but no separate final examination. This paper is provided for use in assessment-plan variants that include a comprehensive final examination, or as a study and review resource for the final project. When used as a final examination, it is typically weighted between 25% and 40% of the final grade, with a corresponding adjustment to the Final Project weight. The instructor should confirm the weighting in the course syllabus.
02 Instructions to candidates
- Write your name and student number on every answer sheet.
- Answer all questions. There is no choice within any part.
- The marks for each question are shown in brackets. Use the marks as a guide to the length and depth of your answer.
- For multiple-choice questions, write the letter of the best answer (A, B, C, or D) in the answer box. Only one answer per question. No marks are deducted for incorrect answers.
- For calculation questions, show all working. Answers without working receive at most half the marks even if the final answer is correct.
- For design and analysis questions, write in clear prose. Bullet points are acceptable for enumerations but the analysis must be in sentences.
- Time management: approximately 25 minutes for Part A, 35 minutes for Part B, 55 minutes for Part C, and 35 minutes for Part D, leaving 30 minutes for review.
- The examination is closed book. Any attempt to use unauthorised materials will be handled according to the university's academic integrity policy.
03 Formula sheet (permitted reference)
The following formulas may be reproduced on your one-page formula sheet. They are provided here for reference during practice.
Maximum file size (inode with d direct, s single-indirect,
t double-indirect, q triple-indirect pointers)
= (d + s·P + t·P² + q·P³) × block_size
where P = block_size / pointer_size
Disk head movement (a sequence of requests r1 … rn from
initial head position h)
= |h − r1| + |r1 − r2| + … + |r(n−1) − rn|
RAID usable capacity (N disks of size S each)
RAID 0: N·S RAID 1: (N/2)·S
RAID 5: (N − 1)·S RAID 6: (N − 2)·S
RAID small-write I/O count (one logical block write)
RAID 5: 4 I/Os (read data, read parity, write data, write parity)
RAID 6: 6 I/Os (read data, read P, read Q, write data, write P, write Q)
Effective access time = (1 − p) × memory_access_time
+ p × page_fault_service_time
Page-fault rate p = page_faults / total_references
Virtual address split (n-bit address, page size 2^o)
offset = o bits; page number = n − o bits
Two-level page table (page number = 2·k bits, offset = o bits)
PDE index = top k bits; PTE index = next k bits
04 Examination paper
Begin your answers now. Do not turn to the instructor answer key (Part 09) until you have completed the paper or the time has expired.
05 Part A — Multiple choice (20 marks)
Each question is worth 1 mark. Choose the best answer. Questions A1–A8 are a cumulative review of Units 1–9; questions A9–A20 cover Units 10–13.
A1
Which of the following executes in kernel mode?
A2
Which of the following causes a Running → Blocked process state transition?
A3
Which of the following is shared between all threads of the same process?
A4
Which of the following scheduling algorithms is non-preemptive?
A5
In the semaphore-based bounded buffer, what is the correct sequence for a consumer removing one item?
A6
Which of the following is not one of the four necessary conditions for deadlock?
A7
Which contiguous memory-allocation algorithm selects the smallest hole that is large enough for the request?
A8
Which page-replacement algorithm can exhibit Belady's anomaly?
A9
Which of the following is not stored in an inode?
A10
An inode has 12 direct pointers, one single-indirect pointer, one double-indirect pointer, and one triple-indirect pointer. With 4 KB blocks and 4-byte block pointers, what is the maximum file size?
A11
Which ext4 journaling mode provides the strongest consistency guarantee after a crash?
A12
What is the primary advantage of a copy-on-write file system (Btrfs, ZFS) over a journaling file system (ext4, XFS)?
A13
Which I/O technique allows a device to transfer data to or from memory without per-byte CPU involvement?
A14
Which disk-scheduling algorithm serves requests strictly in the order they arrive?
A15
A RAID 5 array is built from 6 disks of 2 TB each. What is the usable capacity?
A16
Why is the small-write penalty higher for RAID 6 than for RAID 5?
A17
Which access-control model allows the owner of a resource to decide who may access it?
A18
What distinguishes a Linux capability from a setuid root binary?
A19
Which of the following is shared between a container and its host?
A20
What does the Kubernetes reconciliation loop do?
06 Part B — Short answer (24 marks)
Each question is worth 3 marks. Answer in 3–5 sentences.
B1
What is an inode, and what does it contain? Why is the file name not stored in the inode?
B2
What is journaling, and what problem does it solve? Describe the three data modes of ext4 in one sentence each.
B3
Explain the RAID 5 small-write penalty. Why does a single small random write require four I/O operations, and why is this a problem for write-intensive workloads?
B4
Explain the role of the flash translation layer (FTL) in an SSD. Define garbage collection and wear levelling, and explain why both are necessary.
B5
Compare discretionary access control (DAC), mandatory access control (MAC), and role-based access control (RBAC). Give one example of each in Linux.
B6
What is a setuid binary, and why is it dangerous? Explain how Linux capabilities mitigate the risk that setuid root introduces.
B7
Compare virtual machines and containers on four dimensions: isolation, density, startup time, and performance. For each dimension, state which is better and why.
B8
Describe the components of the Kubernetes control plane (API server, etcd, scheduler, controller manager) and explain the role of each. What is the reconciliation loop?
07 Part C — Problems (36 marks)
C1
Inode capacity and indirect blocks (8 marks). A file system uses 4 KB blocks and 4-byte block pointers. Each inode contains 12 direct pointers, one single-indirect pointer, one double-indirect pointer, and one triple-indirect pointer.
- Compute the maximum file size. (3 marks)
- A file of exactly 10 MB is created. Compute the number of data blocks and the number of indirect blocks that the file system allocates to hold it. (5 marks)
C2
Disk scheduling (8 marks). A hard disk has 200 cylinders (0–199). The head is currently at cylinder 50 and is moving towards higher-numbered cylinders. The pending request queue is:
82, 170, 43, 140, 24, 16, 190
For each of the following algorithms, list the order in which requests are served and compute the total head movement in cylinders.
- FCFS (2 marks)
- SSTF (3 marks)
- SCAN, moving initially towards higher-numbered cylinders (3 marks)
C3
RAID analysis (6 marks). A storage server has eight 3 TB disks. For each of the following RAID levels, give the usable capacity and the number of disk failures the array can tolerate:
- RAID 0 (1 mark)
- RAID 1 (1 mark)
- RAID 5 (1 mark)
- RAID 6 (1 mark)
- How many physical I/O operations does a single 4 KB random write require under RAID 5? Under RAID 6? Explain the difference. (2 marks)
C4
Address translation with a two-level page table (6 marks). A system uses 32-bit virtual addresses, a 4 KB page size, and a two-level page table with a 10-bit PDE index, a 10-bit PTE index, and a 12-bit offset. The current process has:
- Page directory: PDE[0] points to a page table at frame 5; all other PDE entries are not present.
- Page table at frame 5: PTE[160] → frame 20; PTE[161] → frame 21; PTE[162] → frame 22; PTE[163] → frame 23; PTE[164] → frame 24; all other PTE entries are not present.
Translate the following virtual addresses to physical addresses. If a page fault occurs, state so.
0x0000A3C8(2 marks)0x0000A004(2 marks)0x0004B000(2 marks)
C5
Page replacement and Belady's anomaly (8 marks). A system uses demand paging. The reference string is:
1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
- Compute the number of page faults under FIFO with 3 frames. Show the frame contents after each reference. (2 marks)
- Compute the number of page faults under FIFO with 4 frames. Show the frame contents after each reference. (2 marks)
- Compute the number of page faults under LRU with 3 frames. (2 marks)
- What do parts (a) and (b) demonstrate? Name the phenomenon and explain in one or two sentences why it occurs. (2 marks)
08 Part D — Design and analysis (20 marks)
D1
Defence-in-depth security architecture (10 marks). A company is deploying a public-facing web application. The application runs on a Linux server, accepts HTTP and HTTPS requests from the internet, and communicates with a backend database on a separate host. The company has asked you to design the security architecture of the Linux server using the principle of defence in depth.
Your answer must address each of the following layers, and for each layer you must (i) state the mechanism you would use, (ii) state what threat it mitigates, and (iii) state one limitation of the mechanism.
- Authentication of administrators. (2 marks)
- Authorization of the web application process, using both DAC and MAC. (3 marks)
- Sandboxing the web application so that a compromise does not give the attacker full control of the host. Name at least two mechanisms. (3 marks)
- Auditing and detection. (2 marks)
D2
Choosing an isolation technology (10 marks). A startup is building a cloud platform and must deploy three distinct workloads:
- Workload A — Legacy Windows application. A proprietary application that requires a specific version of the Windows kernel and cannot be recompiled.
- Workload B — Stateless HTTP API. A stateless service written in Go that must respond to thousands of requests per second, scale elastically with demand, and have a cold-start time of less than 100 ms.
- Workload C — Multi-tenant SaaS platform. A platform that runs untrusted customer code in the same cluster. Tenants are mutually distrusting and must not be able to affect each other's workloads or data, even in the event of a kernel vulnerability.
For each workload, recommend one of the following isolation technologies and justify your choice with reference to isolation, density, startup time, and performance:
- Virtual machine (with a conventional hypervisor).
- Container (Linux namespaces, cgroups, seccomp).
- MicroVM (Firecracker or Kata Containers).
You may recommend the same technology for more than one workload if the trade-offs justify it. Your answer should be approximately 200–300 words per workload. (3 marks + 3 marks + 4 marks)
End of examination paper
If you are attempting this paper under exam conditions, stop here. The instructor answer key follows in § 09.
09 Instructor answer key
The following material is for instructors and for students who have completed the paper. Each model answer is accompanied by a marking guide showing the allocation of marks.
Part A — Multiple choice (20 marks, 1 mark each)
A1
Show answer
A2
Show answer
exit() causes Running → Terminated; a higher-priority process becoming ready causes Running → Ready.
A3
Show answer
A4
Show answer
A5
Show answer
wait(full), wait(mutex), remove item, post(mutex), post(empty). The consumer waits on full to claim a filled slot, then on mutex to enter the critical section; after removing the item it releases mutex and signals empty. Option B would deadlock if the buffer is empty (the consumer holds mutex while waiting for full).
A6
Show answer
A7
Show answer
A8
Show answer
A9
Show answer
A10
Show answer
A11
Show answer
data=journal. Both metadata and data are written to the journal before being applied. This is the strongest guarantee and the slowest mode. data=ordered journals metadata and orders data writes before metadata; data=writeback journals only metadata and may lose data after a crash.
A12
Show answer
A13
Show answer
A14
Show answer
A15
Show answer
A16
Show answer
A17
Show answer
A18
Show answer
CAP_NET_BIND_SERVICE to bind a low port).
A19
Show answer
A20
Show answer
Part B — Short answer (24 marks, 3 marks each)
B1
Show answer
The file name is not stored in the inode because names are a property of the directory, not of the file. Storing the name in the inode would (a) make hard links impossible, because two directory entries pointing at the same inode would need to be reconciled with a single name field; (b) require a variable-length field inside the fixed-size inode structure; and (c) break the abstraction that separates the file (an inode plus its data blocks) from the namespace (directories). Names live in directory entries, which map names to inode numbers.
Marking: 1 mark for the definition; 1 mark for the correct contents (at least three fields); 1 mark for the reason the name is not in the inode (hard links or the separation of namespace from file).
B2
Show answer
fsck pass over the entire volume.
The three ext4 data modes are:
data=journal: both metadata and data are written to the journal before being applied to the file system. The strongest consistency guarantee; the slowest, because data is written twice.data=ordered(default): only metadata is journaled, but data blocks are written to disk before the metadata that references them. The file system and the data remain consistent; performance is close to writeback.data=writeback: only metadata is journaled; data may be written at any time. The fastest, but after a crash the metadata may reference data blocks that were never written, so a file may contain stale or garbage data.
B3
Show answer
This is a problem for write-intensive workloads because a workload that issues many small random writes (for example, a database performing row-level updates) pays a fourfold I/O amplification. The effective write throughput of the array is roughly one quarter of what the raw disks could deliver. It is also a problem during rebuild: if a disk fails, the array is in a degraded state and every read must reconstruct the missing data from parity. RAID 6 has an even worse small-write penalty (six I/Os) because it maintains two parity blocks. This is why RAID 5 is a poor choice for write-intensive workloads and why RAID 10 (striping of mirrors) is preferred for those workloads.
Marking: 1 mark for the definition of the penalty; 1 mark for the four-I/O explanation; 1 mark for the impact on write-intensive workloads (amplification, throughput, or rebuild).
B4
Show answer
Garbage collection (GC) is the process by which the FTL reclaims space from erase blocks that contain many invalid pages. The FTL selects a block, copies its remaining valid pages to a fresh block, and erases the original, returning it to the free pool. Without GC, the drive would run out of free pages. GC is also the cause of the write cliff: once the free-page pool is nearly exhausted, every new write triggers GC, and write throughput collapses.
Wear levelling is the technique of distributing writes evenly across all erase blocks. Flash cells have a limited number of program-erase cycles (typically 1,000–100,000 depending on the cell type). Without wear levelling, a block that is written more often than others will fail first, and the drive's usable capacity will shrink over time. Wear levelling is implemented by the FTL, which tracks each block's erase count and prefers blocks with low counts. Both GC and wear levelling are necessary for the drive to function correctly over its lifetime.
Marking: 1 mark for the FTL; 1 mark for GC; 1 mark for wear levelling (with a note on why each is necessary).
B5
Show answer
- Discretionary access control (DAC): the owner of a resource decides who may access it. The decision is discretionary because the owner can grant or revoke access at will. Linux example: file mode bits (
rwxr-x---) and POSIX ACLs (setfacl,getfacl). - Mandatory access control (MAC): the system enforces a global policy that even the owner cannot override. Each process and object has a label, and the policy defines which labels may interact. Linux example: SELinux and AppArmor. A process labelled
httpd_tcannot read a file labelledshadow_teven if the file's DAC permissions allow it. - Role-based access control (RBAC): permissions are assigned to roles, and users are assigned to roles. Linux example:
sudo. The/etc/sudoersfile defines which users or groups may run which commands as which other users; a user in thewebadmingroup may be allowed to restartnginxbut nothing else.
Marking: 1 mark for each model correctly defined, with a Linux example. Award partial marks for a correct definition without an example, or an example without a clear definition.
B6
Show answer
passwd is setuid root so that a user can change their own password, which requires writing to /etc/shadow.
Setuid is dangerous because any bug in the binary — a buffer overflow, a command injection, a race condition (TOCTOU), a failure to sanitise the environment or the input — can be exploited by an unprivileged caller to gain the binary's privileges. A setuid root program that invokes
system() or execlp() with caller-controlled input gives the caller a root shell. The attack surface is large because the binary runs with full root privileges even if it only needs one privileged operation.
Capabilities mitigate the risk by granting only the specific privileges the binary needs. For example, instead of setuid root, a program that needs to bind a low-numbered port can be granted
CAP_NET_BIND_SERVICE with setcap. The binary runs with that one capability and no other root privileges; a compromise of the binary exposes only the capability it holds. Linux also supports a capability bounding set and ambient capabilities, which further restrict what a process can acquire. Capabilities are a direct application of the principle of least privilege.
Marking: 1 mark for the definition of setuid; 1 mark for the danger (attack surface, example exploit); 1 mark for the capability mitigation.
B7
Show answer
- Isolation. Virtual machines are better. A VM runs its own kernel inside a hypervisor, so a bug in one VM's kernel cannot affect another VM or the host. Containers share the host kernel and rely on namespaces, cgroups, and LSM policies; a kernel vulnerability can allow a container escape. VMs therefore provide a stronger security boundary and are preferred in multi-tenant environments.
- Density. Containers are better. A container does not need its own kernel, so it consumes far less memory and CPU for the same workload. Many more containers than VMs can run on the same host. Containers also share the host's page cache, so multiple containers running the same base image consume the image only once.
- Startup time. Containers are better. A container starts in milliseconds because it is just a process with its own namespaces; there is no kernel to boot, no device initialisation, and no full user-space start-up. A VM must boot a guest operating system, which takes seconds to tens of seconds. This is why containers are preferred for elastic workloads and serverless platforms.
- Performance. Containers are better. A container's processes execute directly on the host CPU with no hypervisor in the data path. A VM incurs the cost of every privileged instruction trapping to the hypervisor and every memory access going through the nested page tables. The overhead is modest for CPU-bound workloads (a few percent) but can be larger for I/O unless virtio or device passthrough is used.
Marking: 0.75 marks per dimension (3 marks total): 0.25 for the correct winner and 0.5 for the justification. Award partial marks for correct winners with weak justifications.
B8
Show answer
- API server (
kube-apiserver): the front end of the cluster. All communication — fromkubectl, from the nodes, and from the controllers — goes through it. It validates requests, persists them to etcd, and serves watch events to controllers and nodes. - etcd: a distributed, consistent key-value store that holds the entire cluster's desired and observed state. It is the single source of truth; if etcd is lost, the cluster's configuration is lost.
- Scheduler (
kube-scheduler): watches for newly created Pods with no assigned node and selects a node for each, based on resource requests, node affinity, taints and tolerations, and other constraints. - Controller manager (
kube-controller-manager): runs the reconciliation loops that implement Kubernetes's declarative model. For example, the Deployment controller ensures that the desired number of replicas is running; the Node controller detects and responds to node failures.
Marking: 2 marks for the four control-plane components with their roles (0.5 each); 1 mark for the reconciliation loop and its role in the declarative model.
Part C — Problems (36 marks)
C1
Show answer
Direct: 12 × 4 KB = 48 KB
Single-indirect: 1024 × 4 KB = 4 MB
Double-indirect: 1024² × 4 KB = 4 GB
Triple-indirect: 1024³ × 4 KB = 4 TB
Total = 48 KB + 4 MB + 4 GB + 4 TB ≈ 4.004 TB
Marking: 1 mark for computing P = 1024; 1 mark for the direct + single-indirect + double-indirect calculation; 1 mark for the triple-indirect and the total.
(b) Data and indirect blocks for a 10 MB file (5 marks). 10 MB = 10 × 1,048,576 = 10,485,760 bytes. With 4096-byte blocks:
Data blocks = ceil(10,485,760 / 4096) = 2560 blocks
How are these addressed?
Direct: 12 blocks (blocks 0–11)
Single-indirect: 1024 blocks (blocks 12–1035)
Subtotal: 1036 blocks
Remaining: 2560 − 1036 = 1524 blocks
The remaining 1524 blocks are addressed through the double-indirect pointer. The double-indirect block points to single-indirect blocks, each holding 1024 data-block addresses. 1524 data blocks require:
ceil(1524 / 1024) = 2 single-indirect blocks
First single-indirect block: 1024 data blocks
Second single-indirect block: 500 data blocks
The total indirect blocks allocated are:
1 single-indirect block (from the inode's single-indirect pointer)
1 double-indirect block
2 single-indirect blocks (under the double-indirect pointer)
= 4 indirect blocks
Total blocks used = 2560 data + 4 indirect = 2564 blocks = 2564 × 4 KB = 10,502,144 bytes ≈ 10.02 MB.
Marking: 1 mark for the data block count (2560); 1 mark for the direct + single-indirect subtotal (1036); 1 mark for the remaining 1524 blocks; 1 mark for correctly attributing the remaining blocks to the double-indirect path with 2 single-indirect blocks; 1 mark for the final indirect-block count (4) and total.
C2
Show answer
(a) FCFS (2 marks). Served in arrival order:
50 → 82 → 170 → 43 → 140 → 24 → 16 → 190
Movements: 32 + 88 + 127 + 97 + 116 + 8 + 174
Total head movement = 642 cylinders
Marking: 1 mark for the correct service order; 1 mark for the correct total (642).
(b) SSTF (3 marks). Always serve the closest request:
50 → 43 (7) closest to 50
43 → 24 (19) closest to 43
24 → 16 (8) closest to 24
16 → 82 (66) closest remaining to 16
82 → 140 (58) closest to 82
140 → 170 (30) closest to 140
170 → 190 (20) closest to 170
Total head movement = 7 + 19 + 8 + 66 + 58 + 30 + 20 = 208 cylinders
Marking: 2 marks for the correct service order; 1 mark for the correct total (208). Award partial marks for a single ordering error if the method is correct.
(c) SCAN (3 marks). The head moves up from 50, serves all higher requests in increasing order, reaches the end of the disk (199), then reverses and serves the lower requests in decreasing order:
Up: 50 → 82 → 140 → 170 → 190 → 199
Movements: 32 + 58 + 30 + 20 + 9 = 149
Down: 199 → 43 → 24 → 16
Movements: 156 + 19 + 8 = 183
Total head movement = 149 + 183 = 332 cylinders
Note: if the algorithm reverses at the last pending request rather than at the physical end of the disk, it is LOOK, not SCAN, and the total is:
Up: 50 → 82 → 140 → 170 → 190 = 140
Down: 190 → 43 → 24 → 16 = 174
Total = 314 cylinders
Accept either 332 (SCAN) or 314 (LOOK) if the reasoning is consistent with the definition used. The standard textbook SCAN goes to the end of the disk, so 332 is the expected answer.
Marking: 2 marks for the correct upward service order and movement (149); 1 mark for the downward movement and the total (183 → 332). Deduct 1 mark if the candidate uses LOOK without saying so.
C3
Show answer
(a) RAID 0 (1 mark): N × S = 8 × 3 = 24 TB. Failures tolerated: 0.
(b) RAID 1 (1 mark): (N / 2) × S = 4 × 3 = 12 TB. Failures tolerated: 4 (one per mirror pair). A second failure within the same pair would lose that pair's data, but each pair can tolerate one failure independently.
(c) RAID 5 (1 mark): (N − 1) × S = 7 × 3 = 21 TB. Failures tolerated: 1.
(d) RAID 6 (1 mark): (N − 2) × S = 6 × 3 = 18 TB. Failures tolerated: 2.
(e) Small-write I/O count (2 marks): A single 4 KB random write under RAID 5 requires 4 physical I/Os: read the old data block, read the old parity block, write the new data block, write the new parity block. Under RAID 6 the same write requires 6 physical I/Os: read the old data, read the old P parity, read the old Q parity, write the new data, write the new P parity, write the new Q parity. The difference is that RAID 6 maintains two independent parity blocks (P and Q) to tolerate two disk failures, so both parities must be updated on every write. The extra read and extra write give RAID 6 a 50% higher small-write penalty than RAID 5.
Marking: 1 mark per part (a)–(d); 1 mark for the RAID 5 count (4) and 1 mark for the RAID 6 count (6) with the explanation.
C4
Show answer
(a) 0x0000A3C8 (2 marks).
0x0000A3C8 = 0000 0000 0000 0000 1010 0011 1100 1000
offset = 0x3C8 = 968
page number = 0x000A3 = 163
PDE index = top 10 bits of 163 = 0
PTE index = bottom 10 bits of 163 = 163
PDE[0] → page table at frame 5
PTE[163] in that table → frame 23
Physical address = (23 << 12) | 0x3C8 = 0x17000 + 0x3C8 = 0x173C8
(b) 0x0000A004 (2 marks).
0x0000A004 = 0000 0000 0000 0000 1010 0000 0000 0100
offset = 0x004
page number = 0x000A0 = 160
PDE index = 0
PTE index = 160
PDE[0] → page table at frame 5
PTE[160] → frame 20
Physical address = (20 << 12) | 0x004 = 0x14000 + 0x004 = 0x14004
(c) 0x0004B000 (2 marks).
0x0004B000 = 0000 0000 0000 0100 1011 0000 0000 0000
offset = 0x000
page number = 0x4B0 = 1200
PDE index = top 10 bits of 1200 = 1
PTE index = bottom 10 bits of 1200 = 176
PDE[1] is not present → page fault
The page directory entry for index 1 is not present, so the address translation cannot proceed. The kernel's page-fault handler is invoked. If the address is not part of the process's valid address space, the process receives SIGSEGV and is terminated.
Marking: For each part, 1 mark for the correct PDE and PTE indices; 1 mark for the correct physical address (or the correct identification of a page fault). Award partial marks for correct decomposition with an arithmetic error.
C5
Show answer
(a) FIFO with 3 frames (2 marks):
Ref Frames (oldest → newest) Fault?
1 [1] F
2 [1 2] F
3 [1 2 3] F
4 [2 3 4] (evict 1) F
1 [3 4 1] (evict 2) F
2 [4 1 2] (evict 3) F
5 [1 2 5] (evict 4) F
1 [1 2 5] H
2 [1 2 5] H
3 [2 5 3] (evict 1) F
4 [5 3 4] (evict 2) F
5 [5 3 4] H
Total faults = 9
Marking: 1 mark for the correct frame contents; 1 mark for the correct total (9).
(b) FIFO with 4 frames (2 marks):
Ref Frames Fault?
1 [1] F
2 [1 2] F
3 [1 2 3] F
4 [1 2 3 4] F
1 [1 2 3 4] H
2 [1 2 3 4] H
5 [2 3 4 5] (evict 1) F
1 [3 4 5 1] (evict 2) F
2 [4 5 1 2] (evict 3) F
3 [5 1 2 3] (evict 4) F
4 [1 2 3 4] (evict 5) F
5 [2 3 4 5] (evict 1) F
Total faults = 10
Marking: 1 mark for the correct frame contents; 1 mark for the correct total (10).
(c) LRU with 3 frames (2 marks):
Ref Frames (LRU → MRU) Fault?
1 [1] F
2 [1 2] F
3 [1 2 3] F
4 [2 3 4] (evict 1) F
1 [3 4 1] (evict 2) F
2 [4 1 2] (evict 3) F
5 [1 2 5] (evict 4) F
1 [2 5 1] H
2 [5 1 2] H
3 [1 2 3] (evict 5) F
4 [2 3 4] (evict 1) F
5 [3 4 5] (evict 2) F
Total faults = 9
(The exact set of frames may differ depending on tie-breaking, but LRU always produces 9 faults on this string with 3 frames.)
Marking: 1 mark for the correct frame contents on at least the first six references; 1 mark for the correct total (9).
(d) Belady's anomaly (2 marks): Parts (a) and (b) demonstrate Belady's anomaly: increasing the number of frames from 3 to 4 increases the number of page faults, from 9 to 10. The anomaly occurs because FIFO does not satisfy the stack property: the set of pages retained with n+1 frames is not always a superset of the set retained with n frames, so the extra frame can lead to a worse sequence of evictions. LRU and Optimal do satisfy the stack property and are not subject to this anomaly.
Marking: 1 mark for naming Belady's anomaly; 1 mark for the explanation (non-stack property or the specific effect).
Part D — Design and analysis (20 marks)
D1
Show answer
(b) Authorization of the web application (3 marks). DAC: The web application runs as a dedicated, unprivileged user (for example,
www-data) with no login shell. Its files are owned by that user with restrictive permissions (640 for configuration, 750 for directories). The application cannot read or write files outside its own directories.
MAC: An LSM policy (SELinux or AppArmor) confines the web server process to a specific domain. The domain is allowed to read its own content directory and bind to the HTTP port; it is denied access to /etc/shadow, /root, and other system files, even if the DAC permissions would allow it.
Threat mitigated: A compromise of the web application cannot be used to read arbitrary files or modify the system, because the MAC policy denies access regardless of DAC permissions.
Limitation: MAC policies are complex to write and maintain; a misconfigured policy can either block legitimate access (a denial of service) or fail to block an attack if the policy is too permissive. The policy itself is only as strong as the kernel's enforcement, which depends on the correctness of the LSM implementation.
(c) Sandboxing the web application (3 marks). Mechanisms: Two or more of:
- Namespaces: run the application in its own mount, PID, network, and IPC namespaces, so it cannot see or signal other processes on the host. This contains the blast radius of an exploit.
- seccomp: a filter that allows only the system calls the application actually needs (for example,
read,write,openat,accept) and denies the rest. A compromised process cannot invokeexecve,ptrace, or other dangerous calls. - Capability bounding: drop all capabilities except
CAP_NET_BIND_SERVICEif the application binds to port 80 or 443. The application cannot useCAP_SYS_ADMIN,CAP_SYS_PTRACE, or any other privileged operation. - Read-only root file system: mount the container's file system read-only and provide a small writable tmpfs for temporary files. An attacker cannot persist a modified binary or a script on disk.
(d) Auditing and detection (2 marks). Mechanism:
auditd is enabled with rules that log writes to sensitive files (/etc/passwd, /etc/shadow), the execution of privileged binaries, the loading of kernel modules, and changes to the firewall. Logs are forwarded to a central log server (so that an attacker who compromises the host cannot erase them). An IDS/IPS (for example, Suricata or Zeek) monitors network traffic for known attack patterns.
Threat mitigated: An attacker who compromises the host is detected by the anomalous audit events (for example, an unexpected write to /etc/passwd or a suspicious outbound connection), and the incident can be investigated using the centralised logs.
Limitation: Auditing is reactive — it detects events after they occur. It also produces a large volume of data that requires tuning and analysis; an unattended audit log provides no protection. An attacker who is aware of the audit rules may try to disable them or to blend in with normal traffic.
Marking: (a) 2 marks — 1 for the mechanism, 1 for the threat and limitation combined. (b) 3 marks — 1 for DAC, 1 for MAC, 1 for the threat/limitation. (c) 3 marks — 1 for each of two mechanisms, 1 for the threat/limitation. (d) 2 marks — 1 for the mechanism, 1 for the threat/limitation.
D2
Show answer
Workload B — Stateless HTTP API (3 marks). Recommendation: Container (Linux namespaces, cgroups, seccomp), with a possible transition to a microVM if multi-tenancy becomes a requirement. Justification: The workload is a stateless Go service that must scale elastically with demand and have a cold-start time of less than 100 ms. Containers start in milliseconds, so the cold-start requirement is met with room to spare. Containers are dense (many replicas can run on one host), which is essential for elastic scaling at thousands of requests per second. Containers have near-native performance, so the API's throughput and latency are not degraded by the isolation layer. The application is trusted (written in-house), so the weaker isolation of a container relative to a VM is acceptable. If the platform later needs to run untrusted customer code in the same cluster, the API can be moved to a microVM (Kata Containers) with minimal change, because the container image is the same. Trade-offs: Isolation is weaker than a VM (shared kernel), which is acceptable for a trusted in-house service. Density is excellent. Startup time is excellent (milliseconds). Performance is near-native. The container is the correct choice.
Workload C — Multi-tenant SaaS platform (4 marks). Recommendation: MicroVM (Firecracker or Kata Containers), with a fallback to a conventional VM if the microVM's performance is insufficient for the workload. Justification: The workload runs untrusted customer code in the same cluster, and tenants are mutually distrusting. Strong isolation is the dominant requirement: a kernel vulnerability in one tenant's workload must not allow an escape to another tenant's workload or to the host. Containers share the host kernel, so a kernel vulnerability is an escape vector; a container-only design is therefore not acceptable for this workload. A conventional VM would provide the required isolation, but the density and startup time would be poor — a multi-tenant platform must launch many tenants' workloads quickly and pack them densely to be cost-effective. A microVM combines the strong isolation of a VM (its own kernel) with the density and startup time of a container (boot in tens of milliseconds, memory footprint of a few tens of MB per microVM). Firecracker and Kata Containers are the standard implementations. The microVM is the correct choice. Trade-offs: Isolation is strong (its own kernel, hypervisor-enforced). Density is good — significantly better than a conventional VM and closer to a container. Startup time is fast (tens of milliseconds), which is acceptable for the platform's scale-out requirements. Performance is close to native for CPU and memory; I/O is handled through virtio, so it is slightly slower than a container but much faster than a conventional VM. If the microVM's performance is insufficient for a specific workload, that workload can be deployed on a conventional VM while the rest of the platform uses microVMs.
Marking: (a) 3 marks — 1 for the recommendation, 2 for the justification with reference to the four dimensions. (b) 3 marks — same. (c) 4 marks — 1 for the recommendation, 3 for the justification, with emphasis on the multi-tenancy requirement and the microVM's combination of isolation, density, and speed. Award partial marks for correct recommendations with incomplete justifications, and for a defensible alternative (for example, a conventional VM for workload C) if the student argues the trade-off correctly.
10 Marking summary
| Part | Content | Questions | Marks each | Total | CLOs |
|---|---|---|---|---|---|
| A | Multiple choice (cumulative review and Units 10–13) | 20 | 1 | 20 | CLO1, CLO2, CLO3, CLO4, CLO5, CLO7 |
| B | Short answer (Units 10–13) | 8 | 3 | 24 | CLO5, CLO6, CLO7 |
| C | Problems (file systems, I/O, RAID, address translation, page replacement) | 5 | 6–8 | 36 | CLO3, CLO4, CLO5 |
| D | Design and analysis (security architecture; isolation technology choice) | 2 | 10 | 20 | CLO5, CLO6, CLO7, CLO8 |
| Total | 100 | ||||
| Unit | Marks | Where assessed |
|---|---|---|
| Unit 1 — Introduction | 1 | A1 |
| Unit 2 — Linux/UNIX | 1 | A1 (via the kernel/user mode distinction) — reviewed cumulatively |
| Unit 3 — Processes | 1 | A2 |
| Unit 4 — Threads | 1 | A3 |
| Unit 5 — CPU Scheduling | 1 | A4 |
| Unit 6 — Synchronization | 1 | A5 |
| Unit 7 — Deadlocks | 1 | A6 |
| Unit 8 — Main Memory | 1 | A7 |
| Unit 9 — Virtual Memory | 1 | A8 |
| Unit 10 — File Systems | ~24 | A9–A12, B1, B2, C1 |
| Unit 11 — I/O and Storage | ~24 | A13–A16, B3, B4, C2, C3 |
| Unit 12 — Security | ~6 | A17, A18, B5, B6, D1 |
| Unit 13 — Virtualization | ~18 | A19, A20, B7, B8, D2 |
| Cross-unit (Units 4–5, 9) | — | C4, C5 (address translation and page replacement are also relevant to Units 8–9 but are assessed here for cumulative review) |
| Band | Marks | Descriptor |
|---|---|---|
| A | 90–100 | Comprehensive understanding of all topics; quantitative answers are correct and well-justified; design and analysis are insightful and reference the correct trade-offs. |
| B | 80–89 | Solid understanding; most answers correct; design and analysis are sound but not exhaustive. |
| C | 70–79 | Adequate understanding; some answers incomplete or with minor errors; design and analysis are present but shallow. |
| D | 60–69 | Limited understanding; several answers incorrect or missing; design and analysis are superficial. |
| F | <60 | Does not demonstrate the required understanding; most answers incorrect or missing. |
11 Academic integrity
This examination is closed-book and individual. You may bring one A4 formula sheet (handwritten or printed, both sides) and a non-programmable calculator. You must not communicate with any other person during the examination, and you must not access any electronic resource (phone, laptop, tablet, smartwatch, or any other device) unless it is the device on which the examination is being delivered and no other application is open.
Suspected violations are handled according to the university's academic integrity policy. The penalty for a first offence is a grade of zero on the examination; a second offence results in a grade of F in the course.
12 Preparation resources
- All course quizzes (Units 1–13) — the self-check quizzes cover the same material as the multiple-choice and short-answer sections.
- Labs 9–12 — the calculation and design questions in Parts C and D are similar to the exercises in the file-system, storage, security, and virtualization labs.
- Midterm examination — the cumulative review questions in Part A cover the same material as the midterm; the midterm's answer key is a useful study aid.
- Textbook chapters: Silberschatz et al., Chapters 11–18; Arpaci-Dusseau, Chapters 36–43; Tanenbaum & Bos, Chapters 4–7.
- The formula sheet in § 03 — practise reproducing it from memory, and work through each formula on a sample problem.
- Office hours — bring your worked solutions to the sample problems and ask for feedback.