IITP · Semester ISummaries · Quizzes · Assignments

ECS 5102 — Foundations of Computer Systems

Assignment 2 — Memory Hierarchy, ISA, Pipelining, System Calls

Source: IITP\Sem-1\ECS5102-FCS\assignments\assignment-2.md

Topic: storage hierarchy · context switching · I/O bottleneck · recompilation vs ISA · addressing modes · CPI vs clock · pipelining · system calls · fork/exec/wait Questions: 10 MCQ Source: class WhatsApp group (Chats/WhatsApp-Cheat-code/chat.md), "IIT Patna – ECS 5102: Foundations of Computer System, Assignment-2: Questions 1–10 with Correct Answers" (13 Oct 2026).

Fidelity note: the export gives only the correct option text, not the distractor options.

Verification: ✅ all 10 re-derived — all correct.


Quick answer key

Q Answer
1 C — storage/memory hierarchy: disk is much slower than RAM
2 B — scheduler + context switch
3 D — investigate the I/O path
4 A — recompile for the target architecture
5 A — confusing immediate with register-indirect addressing
6 B — performance depends on instruction count, CPI and clock
7 C — pipelining raises throughput, not single-instruction latency
8 B — use a system call; the kernel validates and performs it
9 D — wait()
10 C — fork() creates a child; exec() replaces the image

Q1. An application launches slowly under heavy memory pressure, with frequent transfers between RAM and persistent storage. Most appropriate explanation?

✅ C. The storage↔memory hierarchy is the issue: a miss in RAM means going to storage, which is orders of magnitude slower (and page thrash can multiply that). Related: this is virtual-memory paging, not a CPU problem — the giveaway is "frequent transfers between RAM and persistent storage".

Q2. A server experiences frequent transitions between processes. Which OS activity is involved?

✅ B. The scheduler picks a ready process; the context switch saves the current register/PC state and restores the next one's. Related: a context switch is pure overhead — it does no user work, which is why very small time quanta hurt throughput (contrast Q3 in FCS Assignment 3 / Q20 of the question bank).

Q3. A sensor-data application becomes slow as readings increase, although the CPU can handle the arithmetic. What to investigate first?

✅ D — the I/O path. If the CPU is not saturated, the bottleneck is upstream/downstream of it: sensor read latency, network, or storage write throughput. Related: the diagnostic principle is to find the component at 100 % utilisation and work backwards from it.

Q4. A compiled application cannot run natively on a processor with an incompatible ISA. Source is available. What should the team do?

✅ A — recompile with a compatible toolchain, subject to platform dependencies. Related: without source you would need emulation/translation (Rosetta, QEMU) — the ISA difference is exactly what makes the binary non-portable.

Q5. An assembly routine must load the value from the address held in R4, but the instruction treats R4 as the value itself. Conceptual error?

✅ A — confusing immediate with register-indirect addressing. MOV R1, R4 copies the register's contents; MOV R1, (R4) / LDR R1, [R4] uses R4 as an address. An immediate would embed the value in the instruction itself. Related: the three-way contrast is immediate (constant) vs direct/absolute (fixed address) vs register-indirect (address in a register).

Q6. Processor A has a higher clock, but B finishes faster. Correct conclusion?

✅ B. Time = instruction count × CPI × clock period. A higher clock can be beaten by fewer instructions or a lower CPI. Related: this is the standard "clock speed is not performance" trap (the same argument as RISC-vs-CISC in Assignment 4 Q1).

Q7. Expected effect of instruction pipelining?

✅ C. Multiple instructions in different stages overlap, so throughput rises; a single instruction's latency does not fall (it still passes through every stage). Related: the speed-up is limited by the longest stage and by hazards (data/control/structural) — ideal speed-up = number of stages.

Q8. A user-space application needs a protected hardware resource. Which approach follows the OS model?

✅ B — a system call. The mode switch transfers control to the kernel, which validates the request and performs the privileged operation. Related: the CPU has a user/kernel mode bit precisely so that user code cannot touch protected state directly (cf. FCS Assignment 3 Q9).

Q9. Parent must wait for its child to finish. Which system call?

✅ D — wait() (or waitpid()). Related: fork() duplicates, exec() replaces the image, exit() ends the process. wait() also reaps the child's termination status and prevents a zombie.

Q10. Correct distinction between fork() and exec() in Linux?

✅ C. fork() creates a new child process (a copy of the parent); exec() replaces the calling process's program image with a new program. Related: the usual pattern is fork() then exec() in the child, wait() in the parent — which is exactly how a shell runs a command.