Back to Study Material GATE Exam

Computer Organization and Architecture

Computer Organization and Architecture is the study of how the internal hardware components of a computer are structured, interconnected, and controlled to...

Computer Organization and Architecture

What Is Computer Organization and Architecture

Computer Organization and Architecture is the study of how the internal hardware components of a computer are structured, interconnected, and controlled to execute programs efficiently. It bridges the gap between digital logic and operating system concerns, making it a foundational pillar for any serious Computer Science student.

At the organizational level, you study how hardware units such as the ALU, control unit, memory, and input/output subsystems are physically arranged and how signals flow between them during instruction execution. At the architectural level, you study the programmer-visible aspects of a machine — the instruction set, data types, addressing modes, and registers that software relies on.

The fetch-decode-execute cycle is the heartbeat of every processor. During the fetch stage, the program counter points to the next instruction in memory, which is loaded into the instruction register. The control unit then decodes the opcode to determine the operation, and finally the ALU or other hardware carries out the execution. Understanding this pipeline at each stage is critical for answering GATE questions on CPI (Cycles Per Instruction) and throughput.

Pipelining improves throughput by overlapping stages of successive instructions. A five-stage pipeline — IF, ID, EX, MEM, WB — can theoretically keep all five stages busy simultaneously. However, hazards disrupt this flow. Data hazards arise when an instruction depends on the result of a preceding instruction that has not yet completed. Control hazards occur after branch instructions because the next instruction to fetch is unknown. Structural hazards happen when two instructions need the same hardware resource simultaneously.

GATE frequently tests the effective CPI of a pipelined processor given hazard stall frequencies. For example, if 20 percent of instructions cause a two-cycle data stall and 10 percent cause a three-cycle control stall, the effective CPI becomes 1 + 0.2 times 2 + 0.1 times 3 = 1.7. Practice deriving such formulas from first principles so you can adapt them to any variant GATE may present.

Memory Hierarchy and Cache Design

Memory hierarchy exists because fast memory is expensive and slow memory is cheap. By layering registers, cache, main memory, and secondary storage, computer architects exploit the principle of locality to deliver near-register speed at near-disk cost. GATE consistently allocates marks to cache organization questions.

Spatial locality means that if one memory address is accessed, nearby addresses are likely to be accessed soon. Temporal locality means that a recently accessed address is likely to be accessed again. Cache design exploits both: blocks (cache lines) transfer multiple consecutive bytes to leverage spatial locality, and recently used lines remain in cache to exploit temporal locality.

Cache mapping determines how a main-memory block maps to a cache line. Direct-mapped caches assign each block to exactly one line, giving O(1) lookup but causing conflict misses when two frequently used blocks map to the same line. Fully associative caches allow any block to occupy any line, eliminating conflict misses but requiring expensive parallel search. Set-associative caches offer a middle ground: a k-way set-associative cache divides lines into sets, and a block can occupy any of k lines within its assigned set.

To calculate cache parameters, you must decompose a physical address into tag, index, and offset bits. For a 32-bit address, a direct-mapped cache with 256 sets and 64-byte lines uses 6 bits for offset (log2 64), 8 bits for index (log2 256), and the remaining 18 bits as tag. GATE often provides total cache size and block size and asks you to derive these field widths.

Write policies determine what happens on a cache write hit. Write-through immediately updates both cache and main memory, simplifying coherence but increasing bus traffic. Write-back defers main memory updates until the dirty line is evicted, reducing traffic but requiring a dirty bit per line. Always verify which policy a question assumes before computing memory traffic.

Input/Output and Interrupt Mechanisms

Input/output organization defines how the processor communicates with peripheral devices. Three major I/O techniques appear in GATE: programmed I/O, interrupt-driven I/O, and Direct Memory Access (DMA). Each has distinct performance characteristics that GATE tests through time-calculation and design questions.

In programmed I/O (also called polling), the CPU continuously checks a status register to see whether the device is ready. This is simple to implement but wastes CPU cycles on a tight polling loop, reducing effective throughput. If a device requires service every millisecond and each poll takes 10 microseconds, the CPU spends up to one percent of its time just polling — acceptable for fast devices, catastrophic for slow ones.

Interrupt-driven I/O frees the CPU from polling. The device signals the processor through an interrupt request line when it is ready. The processor saves its context, jumps to the interrupt service routine (ISR), handles the device, restores context, and resumes the interrupted program. GATE questions often compute the overhead introduced by context-save and ISR execution time relative to data transfer bandwidth.

DMA removes the CPU entirely from data transfer. A DMA controller takes ownership of the bus, moves data directly between device and memory, and raises an interrupt only when the entire transfer is complete. This is ideal for bulk transfers such as disk reads. Two modes matter: burst mode, where the DMA controller holds the bus until the entire transfer finishes, and cycle-stealing mode, where it takes the bus one cycle at a time, interleaving with CPU accesses.

A worked GATE-style example: a disk transfers data at 4 MB/s. An interrupt-driven approach with 1 microsecond ISR overhead per byte would consume 4 million microseconds of CPU time per second — the CPU is fully saturated just handling interrupts. Switching to DMA with one interrupt per 4 KB block reduces ISR overhead to 1000 interrupts per second times 1 microsecond equals 0.1 percent CPU usage. This contrast illustrates exactly why DMA is preferred for high-bandwidth devices.