2017 question paper
COMPUTER ORGANIZATION & ARCHITECTURE
16 questions
Q1a. Write the range of decimal integer that can be represented by n-bit 2’s complement representation.20172m
Module 1: Functional Block of computer and Data representaion
View this question on its own page →Write the range of decimal integer that can be represented by n-bit 2’s complement representation.
Worked SolutionAnswer: Range to
Explanation (n-bit 2's complement):
- Most negative number: =
- Most positive number: =
- Total distinct values:
- Single representation of zero (unlike 1's complement / sign-magnitude).
- e.g., for n=8: to ; for n=4: to .
This is the range used in ALU and modern processors for signed integers.
Q1b. Justify the statement “Stack computer consists of an operation code only with no address field”.20172m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →Justify the statement “Stack computer consists of an operation code only with no address field”.
Worked SolutionJustification: Stack computer is zero-address machine; operands implicitly on top of stack (TOS). Instruction needs only opcode because addresses of operands are implied: e.g., ADD pops two top elements, adds, pushes result. No fields to specify registers/memory. Useful for expression evaluation (postfix). Trade-off: needs stack manipulation instructions.
Q1c. What do you mean by Arithmetic shift left operation?20172m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →What do you mean by Arithmetic shift left operation?
Worked SolutionArithmetic Shift Left:
Arithmetic shift left shifts bits left by one position, LSB filled with
0, MSB (sign bit) preserved to maintain sign in 2's complement. Effectively multiplies signed number by 2.Example:
0101 (5) -> 1010 (10),1101 (-3) -> 1010 (-6)[MSB kept as sign].If sign changes after shift (overflow), result is invalid and overflow flag V=1. Same operation as logical shift left except sign handling.
Q1d. What do you mean by locality of reference?20172m
Module 4: Memory Organization
View this question on its own page →What do you mean by locality of reference?
Worked SolutionLocality of Reference:
Principle that memory accesses are clustered, not random — basis for caches and virtual memory.
- Temporal Locality: Recently accessed locations tend to be accessed again soon (e.g., loops, stack variables). → Keep them in cache.
- Spatial Locality: If a location is accessed, nearby locations will be accessed soon (e.g., sequential instructions, arrays). → Fetch blocks/lines.
Due to locality, a small fast cache can achieve hit rate ~90-95% and make average access time close to cache speed despite large, slow main memory.
Q1e. What are the properties of an ideal instruction set computer?20172m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →What are the properties of an ideal instruction set computer?
Worked SolutionProperties of an Ideal ISA (Instruction Set Architecture):
Completeness – All essential operations (data transfer, arithmetic/logic, control, I/O) are provided so any computable function can be implemented.
Orthogonality – No special cases; any addressing mode can be used with any operation and any register. Instructions are independent and uniformly available.
Regularity / Symmetry – Uniform instruction format, consistent opcode field, operand interpretation. Simplifies decoding.
Efficiency – High code density, good performance, optimal use of registers/memory and support for high-level language constructs.
Expandability / Extensibility – Opcode space reserved for future instructions/extensions without redesign.
Compatibility & General Purpose – Balanced between hardware simplicity and software convenience; often includes support for interrupts, virtual memory and protection.
An ideal ISA thus simplifies compiler design, hardware decoding and pipelining while remaining complete and efficient.
Q1f. Define the term hardware polling.20172m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →Define the term hardware polling.
Worked SolutionHardware Polling:
A method to identify the interrupting device among multiple I/O devices using hardware logic instead of software.
A dedicated polling unit / hardware poller sequentially interrogates (polls) each device's interrupt flag via a common bus. It checks status bits one-by-one in priority order using combinational/sequential polling logic.
- Faster than software polling (which uses program loop to test each device).
- Flexibility intermediate between daisy-chain and vectored interrupt.
- On finding the requesting device, its address/vector is placed on bus and ISR is executed.
Contrast: Software polling – CPU executes a program to poll each device; Hardware polling – special hardware does it automatically.
Q1g. What do you mean by data hazards in pipelining?20172m
Module 3: Pipelining
View this question on its own page →What do you mean by data hazards in pipelining?
Worked SolutionData Hazards (RAW) Definition (2 Marks)
In a pipelined processor, a data hazard occurs when an instruction depends on result of a previous instruction still in pipeline and data is not yet available.
RAW (Read After Write) - True dependence: Most common type.
I1: ADD R1, R2, R3 // R1 ← R2+R3 I2: SUB R4, R1, R5 // needs R1I2 reads R1 before I1 writes it. If I2 enters ID/EX while I1 still in EX/MEM, it reads stale value — incorrect execution.
Handling: Data forwarding/bypassing from MEM/WB to ALU input, pipeline stalling (bubble/NOP), compiler reordering.
Other types WAW and WAR cause hazards only in out-of-order pipelines.
Q1h. Explain indirect address mode, and how the effective address is calculated in this case.20172m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →Explain indirect address mode, and how the effective address is calculated in this case.
Worked SolutionIndirect Address Mode — EA = (Address Field) (2 Marks)
Effective Address in indirect mode is not the operand itself but the memory location where the operand address is stored.
- Definition:
EA = M[A]orEA = (A)whereA= address field of instruction. Instruction holds pointer to the operand address. - Example:
LOAD R1, @1000whereM[1000] = 5000→EA = 5000→R1 ← M[5000] - Operation: Two memory accesses — 1st fetches address pointer
M[A], 2nd fetches actual operandM[EA]. - ** advantage:** Allows large address space with short field, supports pointers/indirect arrays, but slower due to extra access — indicated by
*or@or( )notation.
- Definition:
Q2. Why is read and write control lines in a DMA controller bidirectional? Under what condition and for what purpose are they used as inputs?201714m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →Why is read and write control lines in a DMA controller bidirectional? Under what condition and for what purpose are they used as inputs?
Worked SolutionWhy Read (/) and Write (/) Lines in DMA Controller are Bidirectional [14 Marks]
1. Background - 8237 / Generic DMAC and Bus Master Concept
System bus has control lines , , , (or unified , ). Normally CPU is bus master and drives these lines as outputs to command memory/I/O.
During DMA, DMAC becomes bus master after Bus Request (/) → Bus Grant (/) handshake. The direction of / reverses depending on who is master.
Hence DMAC pins are bidirectional (open-drain with direction control): sometimes input, sometimes output.
2. When DMAC is Bus Slave - Lines are INPUTS
Condition: CPU is bus master, DMAC is not performing DMA (Idle or Programming mode). CPU addresses DMAC as an I/O device via its chip select () and register addresses (A0-A3).
Purpose as Inputs: CPU programs DMAC's internal registers:
- DMA Address Register (starting address)
- Terminal Count / Word Count Register
- Mode Register, Command Register, Mask Register, Request Register
Operations:
- CPU performs I/O Write to DMAC: (= ) = 0 as input to DMAC + =0 → data D0-D7 latched into DMAC register. Example:
OUT 0BH, ALto write Mask Register. - CPU performs I/O Read from DMAC: (= ) = 0 as input → DMAC drives data bus with status / remaining count register contents for CPU to read. Example:
IN AL, 08Hto read Status Register.
Without input mode, CPU could not initialize DMA channel (source, destination, count, transfer type) before starting.
3. When DMAC is Bus Master - Lines are OUTPUTS
Condition: DMAC has acquired bus ( , , CPU tristates its buses). Now DMAC drives address bus and control lines to perform data transfer between Memory and I/O without CPU.
Purpose as Outputs - Two Types of DMA Transfer:
- DMA Read (Memory → Peripheral): DMAC asserts (or as output, low) to read memory and to write to I/O device in same bus cycle (or two cycles in flyby vs. two-cycle DMA). Data flows memory → DMAC → I/O.
- DMA Write (Peripheral → Memory): DMAC asserts to read peripheral and to write to memory. Data flows I/O → memory.
- Memory-to-Memory (in 8237): and sequentially asserted.
Thus as outputs, they act exactly as CPU's control signals would, commanding the memory and I/O participants.
4. Summary Diagram (Conceptual)
CPU (Master) -------- IOR/IOW / MEMR/MEMW --------> DMAC (Slave) : INPUT mode (Program) | DMAC (Master) -------- MEMR/MEMW , IOR/IOW --------> Memory & I/O : OUTPUT mode (Transfer) (controls bus)Internal direction control via Bus Master Enable logic: when & active → buffers set to output; otherwise inputs. Shared pins save package pins and reflect that bus control is mutually exclusive - only one master drives at a time.
Key Advantage: Single set of control lines serves dual role → reduces interconnect and allows seamless hand-shaking: CPU configures DMAC as peripheral, then DMAC uses same lines as master to orchestrate high-speed block transfers (≈ 1.6 MB/s in 8237), freeing CPU.
Exam Tip: Always mention both modes with concrete instruction example (OUT/IN) for input, and Flyby transfer example for output.
Q3. Explain the concept of virtual memory with the help of a diagram. Explain how virtual address is mapped to actual physical address.201714m
Module 4: Memory Organization
View this question on its own page →Explain the concept of virtual memory with the help of a diagram. Explain how virtual address is mapped to actual physical address.
Worked SolutionVirtual Memory Concept
Virtual memory is a memory management technique that gives program illusion of large contiguous main memory (e.g. GB) while physically only part resides in RAM; remainder kept on secondary storage (disk). Address generated by CPU (virtual/logical) is translated to physical via MMU.
CPU generates MMU + Page Table + TLB Main Memory / Disk Virtual Address -----> Translation -----> Physical Address ---> RAM (if present) 32-bit VPN -> PFN 32-bit else Page Fault -> Disk- Virtual address space Physical address space (e.g. virtual vs physical).
- Transparent to programmer, allows multiprogramming, protection, demand paging.
- Uses locality – only active pages kept in RAM.
Diagram: Paged Virtual Memory Mapping
Virtual Address (32b) +----------------------+------------------+ | Virtual Page Number | Page Offset | | VPN (20b) | OFFSET (12b) | -> 4KB pages +-----------+----------+-----+------------+ | | v | +--------------+ | | Page Table | TLB | | (in RAM) | cache | | VPN -> PFN | | +------+-------+ | | | v v Physical Address (32b) +----------------------+------------------+ | Physical Frame Number| Offset | | PFN (20b) | (12b same) | +----------------------+------------------+ RAM: [Frame 0][Frame 1]...[Frame N] Disk: swap space with all pagesVirtual to Physical Mapping Steps (Paging)
Assume page size KB B offset bits, VPN bits for -bit virtual.
- CPU generates virtual address .
- MMU looks up TLB (Translation Lookaside Buffer) – cache of page table.
- TLB hit: get PFN immediately.
- TLB miss: access page table in RAM (pointed by Page Table Base Register - PTBR). May be multi-level (e.g. 2-level for 32-bit).
- Page Table Entry (PTE) contains: PFN, valid bit, dirty, protection (R/W/X), referenced.
- If valid=1: (concatenation).
- If valid=0: Page Fault → trap to OS. OS loads required page from disk to free frame (using replacement e.g. LRU), updates PTE, restarts instruction.
- Physical address sent to cache/memory.
Example: , page KB VPN=, offset=; page table maps VPN .
Segmentation + Paging: Sometimes VA = segment + offset; segment table → page table. But pure paging described above is most common (x86, ARM).
Advantages: Large logical space, protection/isolation, sharing, efficient multiprogramming, demand loading.
Overhead: Translation time (mitigated by TLB hit), page fault handling, fragmentation (internal).
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q4. What is meant by Addressing Mode? Explain at least five different addressing modes with an example.201714m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →What is meant by Addressing Mode? Explain at least five different addressing modes with an example.
Worked SolutionAddressing Mode
Definition: The method by which the CPU interprets the address field of an instruction to obtain the effective address () of the operand or the data itself. It determines where operand is and how to compute . Choice affects instruction length, cycles, and programming ease.
General flow: , operand or .
5+ Addressing Modes with Examples (8085/8086/Mano style)
1. Implied / Implicit Mode
Operand is implicit in opcode, no address field.
EA = implied register
Example:CLA(Clear AC),CLC(clear carry),HLT.STCon 8086 implies .2. Immediate Mode
Operand itself is in address field / next byte. No memory fetch beyond instruction.
Example:MVI A, 05H-> ;ADD #10-> ;LDA #100loads value 100, not . Useful for constants. Fast.3. Direct / Absolute Mode
Address field = . , operand .
Example:LDA 1000H-> ;STA 2050Hstores AC at 2050H.[8086: MOV AX, [5000H]]. Simple but instruction must hold full address.4. Indirect Mode
Address field = address of address. .
Example (Mano):LDA I 200where -> .
Often denotedLDA @200orMOV AX, [BX]indirect via register. Allows addressability beyond field size but extra memory access.5. Register Mode
Operand in register, field specifies register.
Example:MOV A, B-> ;ADD R1-> ;INC AX. Fastest, no memory.6. Register Indirect Mode
Field specifies register holding . .
Example:MOV A, Mwhere H-L holds address (8085:MOV A, Mwith => ); 8086:MOV AX, [BX]where => .LDA (R1)etc.7. Indexed / Auto-increment Mode (bonus)
; useful for arrays.
Example:LOAD X(R1)where =index, -> .
Auto-increment:MOV (R1)+, R2-> operand at then for sequential access.
8086:MOV AX, [SI+1000H].8. Relative / PC-relative Mode
(offset in field). For branching.
Example:BNE -5-> if condition; 8086JZ 08His .9. Base Register Mode
. For relocatable code/structures.
Example:LDA 20(Rbase).Mode Cycles When used Immediate 1 fetch Constants Direct 1 mem Global variable Indirect 2 mem Pointers Register 0 mem Temporaries Indexed 1 mem+add Arrays/loops Effective programming uses mixture; RISC favors register+immediate, CISC supports all.
Q5. What are the different conflicts that will arise in pipeline (elaborate)? How do you remove the conflicts?201714m
Module 3: Pipelining
View this question on its own page →What are the different conflicts that will arise in pipeline (elaborate)? How do you remove the conflicts?
Worked SolutionPipeline Conflicts (Hazards) and Remedies
Pipeline ideally gives 1 instruction per cycle, but dependencies cause hazards that stall/flush pipeline.
1. Structural Hazards (Resource Conflicts)
- Cause: Two stages need same hardware same cycle. e.g., single memory for IF and MEM stage; single ALU; register file with one write port but two instructions need write.
- Example: 4-stage pipeline with IF and MEM sharing memory -> IF of I4 conflicts with MEM of I1.
- Solutions:
- Separate Instruction and Data caches (Harvard) / L1 split - simultaneous IF+MEM.
- Multiple functional units, pipelined units, extra ports on register file.
- Stall (bubble) - hardware interlock delays one instruction.
2. Data Hazards (Data Dependency)
- RAW - Read After Write (True):
ADD R1,R2,R3 ; SUB R4,R1,R5- second needs R1 before first writes. Classic.- Sub-types: distance 1,2 hazards in pipeline.
- WAR - Write After Read and WAW - Write After Write (false dependencies) - occur in OOO / superscalar pipelines due to register reuse.
- Effects: Wrong operand value if pipeline forwards unupdated register.
- Solutions:
- Data Forwarding / Bypassing: Directly route ALU output to next instruction's ALU input via forwarding path (EX->EX, MEM->EX) - avoids stall for most RAW.
- Stall / Pipeline Interlock + NOP injection: Compiler/hardware inserts bubble when forwarding insufficient (e.g., Load-Use hazard:
LW R1,0(R2) ; ADD R3,R1,R4- needs one stall because data available after MEM). - Register Renaming: Remove WAR/WAW by mapping to physical registers (Tomasulo).
- Compiler Scheduling: Reorder independent instructions between dependent pair:
LW R1; ... independent ... ; USE R1 - Out-of-Order Execution + Scoreboarding: Execute independent instructions while dependent waits in reservation station.
3. Control Hazards (Branch Hazards)
- Cause: Pipeline doesn't know next PC after Branch/Jump until decode/execute stage. Fetches wrong path.
- Example:
BEQ R1,R2, Label- 2-3 instructions after branch already fetched before condition resolved. - Penalties: Flush 1-3 cycles (branch penalty) ~10-20% performance loss if ~15% branches.
- Solutions:
- Stall + Flush: On branch detection, freeze IF/ID, flush wrong path once target known (simple, slow).
- Branch Prediction: Predict taken/not-taken.
- Static: Predict not-taken or compiler hint.
- Dynamic: 1-bit / 2-bit saturating counter, Correlated (Gshare), BTB (Branch Target Buffer) to store target. Accuracy 90-95% -> penalty only on mispredict.
- Delayed Branch (Branch Delay Slot): Architecturally fill slot after branch with useful independent instruction - used in MIPS.
- Predicated Execution: Convert branch to conditional move
CMOV-> no flush. - Speculative Execution: Execute predicted path speculatively with ROB, rollback on mispredict.
- Loop Buffer / Branch Target Cache: Cache branch targets.
Summary Table
Hazard Cause Detection Remedy Cost Structural Resource sharing Scheduler Duplicate resources, split cache Hardware cost Data RAW Register dependency Comparator on RD vs RS Forwarding + stall if load-use 1 bubble if not forwarded Control PC change Branch logic Predict, delayed branch, flush 1-3 cycles mispredict penalty Overall techniques to keep pipeline busy: Forwarding (data), Prediction + Speculation (control), Superscalar OOO + Renaming.
Ideal CPI =1, actual CPI =1 + stall cycles per instruction. With forwarding+prediction CPI ~1.1-1.3 instead of ~1.6 without.
Q6. Explain Von Neumann Architecture. What are its drawbacks?201714m
Module 1: Functional Block of computer and Data representaion
View this question on its own page →Explain Von Neumann Architecture. What are its drawbacks?
Worked SolutionVon Neumann Architecture
Proposed by John von Neumann (1945, EDVAC report). Also called Stored-Program Concept and Princeton Architecture. Dominant architecture for general-purpose computers.
1. Principle
Program (sequence of instructions) and data are stored together in the same read-write memory and treated alike. CPU fetches instructions sequentially from memory, decodes and executes them, modifying data in same memory.
2. Block Diagram
+----------------------------------+ | Central Processing Unit | | +------------------+ +------+ | | | Control Unit (CU)| | ALU | | Input Device -->| | - PC |<-+ | | (Keyboard, | | - IR | | | | Disk) | | - Decodes inst. |->+ | | | +------------------+ +------+ | | ^ | ^ | | | v | | +------------+---+----+-------------+ | | | +----+---v----+----+ | Memory | | (Single Address | | Space for | | Program + Data) | +---------+---------+ ^ | +-----------------+ +--v---------------+ | Output Device |<-----| I/O Interface | | (Display, etc) | +---------------+ +---------------+ Simplified bus view: +----------------+ Address Bus | CPU |<---------------->+----------------+ | CU + ALU + | Data Bus | Memory | | Registers |<---------------->| (Instructions | +----------------+ Control Bus | + Data) | ^ +----------------+ | | +------> I/O Module ---------> DevicesCore components:
- Memory (M): Single linear address space, stores both instructions and data. Each location has unique address.
- Control Unit (CU): Fetches instruction at
M[PC], increments PC, decodes opcode, generates control signals, coordinates fetch-decode-execute cycle. - ALU: Performs arithmetic/logic on data from registers/memory.
- Registers: PC, IR, MAR, MBR, Accumulator/GPRs inside CPU.
- I/O: Input/Output mechanism via same bus.
Operation Cycle (Fetch-Decode-Execute):
1. Fetch: MAR <- PC; MBR <- M[MAR]; IR <- MBR; PC <- PC+1 2. Decode: CU decodes IR 3. Execute: ALU or memory operation as per opcode; repeat3. Characteristics
- Single memory bus for instructions and data (sequential access).
- Instruction execution is sequential unless branch modifies PC.
- Hardware simple - one memory, one bus.
4. Drawbacks / Limitations
Von Neumann Bottleneck: Single bus between CPU and memory can only transfer one word at a time - cannot fetch instruction and access data simultaneously. CPU stalls waiting for memory (memory wall). Limits throughput even if CPU is fast.
Sequential execution: No inherent parallelism; instruction-level parallelism must be extracted via pipelining/cache which complicates control.
Memory is limiting factor: CPU speed >> memory speed, bottleneck dominates performance.
Shared bus contention: I/O and CPU compete for same memory bus.
Not suitable for real-time DSP: Harvard architecture (separate instruction and data memories/buses) used in DSP/microcontrollers for simultaneous fetch to overcome this - Von Neumann lacks that.
Virus/security issue: Since code and data share same memory, erroneous data can be executed as code (buffer overflow attacks).
Improvement: Modern computers keep Von Neumann logically but implement Harvard-like cache (split L1 I-cache/D-cache), pipeline, out-of-order execution, and hierarchy to hide bottleneck while retaining stored-program simplicity.
Q7. What is a page fault? What does a page fault signify? Explain the different page replacement algorithms which determine the page to be removed in case of full memory.201714m
Module 4: Memory Organization
View this question on its own page →What is a page fault? What does a page fault signify? Explain the different page replacement algorithms which determine the page to be removed in case of full memory.
Worked SolutionSolution - Page Fault and Page Replacement Algorithms (14M)
What is a Page Fault?
In virtual memory with demand paging, pages are loaded from secondary storage (disk) to main memory only when needed. A page fault is an exception (trap) that occurs when a running process tries to access a page that is currently not present in main memory (valid bit = 0 in Page Table or TLB miss). The MMU detects this via page table entry's present/absent bit and raises interrupt #14 (x86).What does it signify?
- Indicates miss in main memory hierarchy; required page (or segment of program/data) is still on disk (swap space).
- Triggers OS fault handler: OS must block the process, allocate a free frame, read the page from disk into frame (I/O), update page table (frame number, valid=1), and restart the faulting instruction.
- High frequency = thrashing if insufficient frames (working set > memory).
- Counted as overhead: interrupt + context switch + disk I/O (
ms) >> memory access (ns).
Page fault handling steps:
- Trap to OS, save registers.
- Check if reference was legal (segmentation violation vs valid page on disk).
- Find free frame (or victim via replacement algorithm if none free).
- If victim dirty, write back to disk.
- Read required page from disk into frame (DMA).
- Update page table, TLB invalidated.
- Restart process at faulting instruction.
Page Replacement Algorithms - when memory is full (no free frame), which victim page to evict:
1. FIFO (First-In First-Out):
- Replaces page that has been in memory longest (queue). Simple via FIFO queue.
- Belady's Anomaly: More frames can increase faults! Not stack algorithm.
- Example: Reference string 1,2,3,4,1,2,5,1,2,3,4,5 with 3 frames -> 9 faults.
2. Optimal (OPT / MIN) - Theoretical:
- Replaces page that will not be used for longest period in future (furthest next use). Gives minimum faults, used as benchmark.
- Impossible to implement perfectly (requires future knowledge), but approximated.
- Example: Same string -> 7 faults (optimal).
3. LRU (Least Recently Used):
- Replaces page that has not been used for longest time in past. Exploits locality.
- Implementation: counter/timestamp or stack, or approximation via reference bits.
- Good performance, close to Optimal. Stack algorithm (more frames never hurts).
- Example: With same string -> 10 faults.
4. Approx. LRU variants:
- NRU / Clock (Second Chance): Circular queue with reference bit R. Give second chance if R=1 then clear and rotate; if R=0 replace. Efficient.
- Aging / LFU / MFU: Least Frequently Used (count accesses) / Most Frequently Used - but LFU suffers cache pollution.
5. LIFO / Random:
- LIFO replaces last loaded; Random picks random victim - simple, avoids Belady but unpredictable.
Comparison Table:
Algorithm Needs future? Overhead Anomaly Performance FIFO No Low Yes Poor Optimal Yes - No Best (ideal) LRU No High (stack) No Good Clock No Low No Good approx. LFU No Medium No Depends Selection criteria: Fault rate, implementation cost, hardware support (R and M bits in page table entry help Clock/LRU approximation). Modern OS uses Clock (enhanced second chance with Dirty bit) or LRU approximation with aging.
Dirty bit: If victim page modified (M=1), must write back before replacement - double I/O cost, so some algorithms prefer clean victims (NRU class 0: R=0 M=0).
Q8. Why does I/O interrupt make more efficient use of the CPU? Explain the sequence of operations that take place in an interrupt-driven I/O transfer.201714m
Module 2: x86 Architecture, CPU Control, I/O, Memory System Design
View this question on its own page →Why does I/O interrupt make more efficient use of the CPU? Explain the sequence of operations that take place in an interrupt-driven I/O transfer.
Worked SolutionWhy Interrupt-Driven I/O is More Efficient
Programmed I/O (Polling): CPU continuously checks (polls) device status flag
Ready/Busyin a loop until device is ready. During polling CPU is blocked, wastes thousands of cycles, cannot do useful work.Interrupt-Driven I/O: CPU initiates I/O, then continues executing current program. I/O device signals readiness by asserting an interrupt request (INTR/IRQ). CPU is interrupted only when needed, so no busy-wait. Efficiency is high especially for slow devices (keyboard, disk) where waiting time >> transfer time.
Advantages: CPU not wasted in polling loops, allows concurrent computation and I/O (overlap), enables handling of asynchronous events, supports priority handling.
Sequence of Operations in Interrupt-Driven Transfer
Assume CPU → enables interrupts, issues I/O command to Interface.
- Device prepares data: Interface sets
Readyor fills buffer. - Interrupt Request: Interface asserts
INTRline to CPU. - Interrupt Acknowledgement: After completing current instruction, CPU checks INTR if
Interrupt Enable (IE)=1and no higher priority interrupt. - Save context: CPU pushes
Program Counter (PC)andProcessor Status Word (PSW)onto stack, disables further interrupts (clears IE), branches to interrupt vector address. - Vectoring: CPU fetches ISR address from Interrupt Vector Table using interrupt vector number supplied by device (or via daisy chain/priority encoder).
- Interrupt Service Routine (ISR):
a. Save registers (if not done by HW).
b. Poll device status / identify source if multiple devices share line.
c. Transfer data: For input - read data register → memory/accumulator; For output - write data. If block transfer, loop or initiate next byte.
d. Clear interrupt flag in device interface.
e. Restore registers. - Return from Interrupt: Execute
IRET / RTI→ restores PC and PSW (re-enables interrupts). - Resume: CPU resumes interrupted program from next instruction.
For vectored priority interrupt the device identifies itself; for non-vectored, CPU polls devices branch.
Timing: CPU overhead is only saving/restoring + ISR execution, versus continuous polling. DMA further improves efficiency by transferring block without per-word ISR.
- Device prepares data: Interface sets
Q9. How many ROM chips are required to produce a memory capacity of 4096 bytes? How many address lines are required to access the 4096 bytes? How many of these addresses will be common to all these chips?201714m
Module 4: Memory Organization
View this question on its own page →How many ROM chips are required to produce a memory capacity of 4096 bytes? How many address lines are required to access the 4096 bytes? How many of these addresses will be common to all these chips?
Worked SolutionROM Chip Calculation for 4096 Bytes (14 Marks)
Given: Required memory capacity = 4096 bytes = bits.
Let ROM chip capacity be bytes/chip. Standard chips often , , etc. General formulae below; numerical example for most common exam assumption follows.General Formulae:
- Number of chips
- Number of address lines to access 4096 bytes: lines (-)
- Common addresses: Address lines are split into chip-select (higher) + intra-chip (lower). Lower lines where go to all chips in parallel (common), upper lines go to decoder to generate chip selects.
Worked Example – Assume typical exam chip bit (512 nibbles = 256 bytes? often quoted as 1024×4):
Most textbooks assume bit ROM (128 bytes? actually bits =512 bytes) or (512 bytes).
Case A: If chip = (1024 bytes = 1 KB) – commonest for 4096:
- chips
- Address lines =12
- Per chip needs lines (-) common to all 4 chips (connected in parallel)
- Remaining lines () decoded via 2:4 decoder for chip select. So 10 common address lines, 2 chip-select lines.
Case B: If chip = bit = 256 bytes? Many colleges treat chip as bytes ():
- chips
- Per chip needs 9 lines () common to all 8 chips
- Remaining 3 lines decoded via 3:8 decoder. So 9 common lines.
Case C: If chip = bit = 2048 bits =256 bytes and need byte organized memory: Need 2 chips per byte location (pair to make 8 bits), so chips. Per chip 9 lines common? Actually 9 lines for 512 locations, 4 lines common? Detailed: chips arranged as 8 rows ×2 columns, - (9 lines) common to all, - (3 lines) to 3:8 decoder.
Answer in generic terms:
- Chips required = (e.g., for 1K×8, for 512×8, for 512×4)
- Address lines =12
- Common lines = to all chips (e.g., 10 lines for 1K chips, 9 for 512-byte chips), remaining lines are chip-select decoded.
Without loss, exam expects: 8 chips of 512 bytes, 12 address lines, 9 common (if 512-byte assumed) or 4 chips, 10 common (if 1K assumed). State assumption explicitly.
PYQDeck for Android
Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.