Bachelors Program in Computer Science Engineering
Introduction to Computer Science
•
Post Graduate
Computer Organization and Architecture
Introduction and Context
Computer organization and computer architecture are related but distinct fields. Computer architecture describes the programmer-visible structure and behavior of a computer system: its instruction set, data types, addressing modes, memory model, and input/output model. Computer organization describes how that architecture is implemented using processors, registers, buses, memory technologies, control logic, and interconnection mechanisms.
The distinction is useful because two machines may implement the same architecture while differing substantially in organization. For example, several processors may execute the same instruction-set architecture (ISA) but differ in pipeline depth, cache capacity, branch prediction, power consumption, and manufacturing technology. This separation supports software compatibility while allowing hardware innovation.
At postgraduate level, computer organization should be studied as a layered system. Programs are represented as algorithms, compiled into instructions, encoded as binary data, transferred through memory hierarchies, and executed by coordinated hardware components. Performance is therefore not determined by clock frequency alone; it depends on instruction count, instruction latency, parallelism, memory behavior, and workload characteristics.
Learning Objectives
After completing this chapter, a learner should be able to:
Distinguish computer architecture from computer organization.
Explain the roles of the processor, memory, buses, and input/output subsystems.
Describe instruction execution, control flow, pipelining, and hazards.
Analyze cache and memory-hierarchy behavior quantitatively.
Apply performance equations such as CPU-time and speedup relationships.
Compare RISC, CISC, multicore, SIMD, GPU, and accelerator-based designs.
Evaluate architectural trade-offs involving performance, power, cost, reliability, and security.
Analyze a practical system-design scenario using suitable architectural principles.
1. A Layered View of a Computer System
A modern computer can be understood through several abstraction layers:
Layer
Main concern
Typical artifact
Application
User problem and behavior
Web service, scientific program
Algorithm and language
Computation and data structures
Program source code
Compiler and runtime
Translation and execution support
Machine code, libraries
ISA
Instructions visible to software
ARM, RISC-V, x86-64
Microarchitecture
Internal implementation
Pipeline, cache, predictor
Digital logic
Boolean and sequential circuits
ALU, registers, control unit
Device technology
Physical realization
Transistors, wires, memory cells
An ISA specifies operations such as addition, loading from memory, branching, and storing data. It also specifies registers, instruction encoding, privilege levels, exceptions, and memory-access rules. Microarchitecture determines how these operations are actually performed. A superscalar processor may issue several instructions per cycle, whereas a simpler implementation may issue only one, even when both support the same ISA.
Fundamental Components
A general-purpose computer contains:
Central processing unit (CPU): Executes instructions and coordinates operations.
Arithmetic and logic unit (ALU): Performs arithmetic, logical, and shift operations.
Control unit: Generates control signals and sequences instruction execution.
Registers: Small, fast storage locations directly used by the CPU.
Main memory: Stores instructions and data currently in use.
Input/output subsystem: Connects the computer to external devices and networks.
Interconnect: Transfers addresses, data, and control information.
Simplified computer organization showing processor, memory, input output and interconnect
Figure: A simplified organization of a computer system.
2. Data Representation and Instruction Execution
Computers represent all information as bits, each having value 0 or 1. A group of eight bits is a byte. For an unsigned binary number with bits bn-1...b1b0, the represented value is:
V = ∑i=0n−1 bi 2i
Here, bi is either 0 or 1, and n is the number of bits. The range is 0 through 2n − 1. Signed integers are commonly represented using two’s complement. For an n-bit two’s-complement value, the range is −2n−1 through 2n−1−1. Two’s complement permits ordinary binary addition to handle both positive and negative operands, but overflow remains possible when the mathematical result lies outside this range.
Floating-point representation approximates real numbers using a sign, significand, and exponent. The approximation introduces rounding error, so equality tests and numerical stability must be considered in software and hardware design.
The Instruction Cycle
A conventional instruction cycle consists of:
Fetch: The program counter (PC) supplies the address of the next instruction.
Decode: The control unit interprets the opcode and identifies operands.
Operand access: Registers or memory provide input values.
Execute: The ALU, branch unit, or other functional unit performs the operation.
Memory access: Load and store instructions access the memory hierarchy.
Write-back: Results are written to a register or architectural destination.
PC update: The next sequential or branch-target address is selected.
This sequence is conceptual. A pipelined processor overlaps these stages for different instructions. Exceptions and interrupts temporarily redirect control to privileged software, which saves relevant state and handles events such as page faults, illegal instructions, or device requests.
3. Processor Organization
Registers and Datapaths
Registers provide low-latency storage. Typical registers include general-purpose registers, the PC, an instruction register, a stack pointer, a status register, and control registers. The datapath consists of registers, multiplexers, ALUs, and connections through which values move. The control unit selects datapath actions according to the current instruction and processor state.
A processor may be organized as a single-cycle, multicycle, or pipelined design. A single-cycle design completes each instruction in one long clock period. A multicycle design reuses hardware across several shorter cycles. A pipeline increases instruction throughput by overlapping stages, although the latency of an individual instruction need not decrease.
Pipelining and Hazards
If a pipeline has stages with delays t1, t2, ..., tk, the clock period must accommodate the slowest stage plus register overhead:
Tclock ≥ max(t1, t2, ..., tk) + treg
The formula assumes synchronous stage boundaries and ignores additional effects such as clock skew unless they are included in treg.
Pipeline hazards are conditions that prevent the next instruction from executing in its ideal cycle:
Structural hazard: Two operations require the same hardware resource.
Data hazard: An instruction depends on a result not yet available. Read-after-write (RAW) is the most common true dependency.
Control hazard: A branch or jump makes the next instruction uncertain.
Forwarding can reduce data-hazard stalls by sending a result directly from a functional unit to a dependent operation. Branch prediction reduces control-hazard penalties, but incorrect predictions require recovery and wasted work. Out-of-order execution allows independent instructions to proceed while another instruction waits, provided the processor preserves the required architectural behavior.
Superscalar and Speculative Execution
A superscalar processor can issue multiple instructions per cycle. Its performance depends on available instruction-level parallelism, functional-unit capacity, dependencies, and memory latency. Speculative execution predicts future control flow or data availability. It improves average performance but creates security concerns when microarchitectural side effects reveal information across protection boundaries. Correctness, isolation, and secure speculation are therefore architectural as well as software concerns.
4. Memory Hierarchy and Virtual Memory
Memory technologies exhibit a trade-off among capacity, latency, bandwidth, cost, and persistence. The hierarchy usually includes registers, multiple cache levels, main memory, and secondary storage. Frequently used data are kept closer to the CPU by exploiting:
Temporal locality: Recently accessed data are likely to be accessed again.
Spatial locality: Nearby addresses are likely to be accessed soon.
A cache hit supplies data from the cache; a miss requires access to a lower level. For a one-level cache, an approximate average memory access time is:
AMAT = Thit + (1 − h)Tmiss-penalty
Here, Thit is hit time, h is the hit rate, and Tmiss-penalty is the additional time caused by a miss. The equation assumes a single cache level and defines miss penalty as extra time beyond hit time. For multiple levels, the equation must be expanded recursively.
Worked example. Suppose hit time is 1 ns, hit rate is 95%, and miss penalty is 40 ns. Then:
AMAT = 1 + (1 − 0.95) × 40 = 3 ns.
The result is an average, not a guarantee for every access. Workloads with poor locality may experience substantially higher effective latency.
Cache organization involves mapping and replacement decisions. In a direct-mapped cache, each memory block has one possible location. In a set-associative cache, a block maps to one set but may occupy one of several ways. Fully associative caches permit placement anywhere but require more comparison hardware. Write-through caches update lower memory on each write; write-back caches update it when a modified block is evicted. Each policy affects bandwidth, consistency, and recovery behavior.
Virtual Memory
Virtual memory provides each process with an address space that is translated into physical memory. Pages are fixed-size virtual blocks, and page tables record mappings and protection attributes. A translation lookaside buffer (TLB) caches recent virtual-to-physical translations. A page fault occurs when a referenced page is not currently resident and must be obtained from secondary storage or another backing source.
Virtual memory supports isolation, sharing, relocation, and demand paging. Its costs include translation overhead, page-table memory, and potentially very high page-fault latency. Secure systems must protect page-table metadata and avoid unintended information leakage through shared caches or translation structures.
5. Input/Output and Interconnection
I/O devices differ greatly in speed, data format, timing, and control requirements. Common mechanisms include:
Programmed I/O: The CPU repeatedly checks device status and transfers data.
Interrupt-driven I/O: The device notifies the CPU when service is needed.
Direct memory access (DMA): A controller transfers blocks between a device and memory with limited CPU involvement.
DMA improves efficiency for high-volume transfers, but the system must handle buffer ownership, address translation, cache coherence, and authorization. Device drivers provide a controlled software interface to hardware and must validate inputs, manage errors, and prevent unauthorized access.
Interconnects may be buses, point-to-point links, switched fabrics, or networks-on-chip. Important properties include bandwidth, latency, arbitration, ordering, reliability, and scalability. A shared bus is relatively simple but can become a bottleneck as the number of devices increases.
6. Performance Analysis
Performance must be measured against a defined workload and metric. CPU execution time is commonly modeled as:
CPU time = IC × CPI × Tcycle
where IC is instruction count, CPI is average cycles per instruction, and Tcycle is clock-cycle time. Since clock frequency f = 1/Tcycle, an equivalent form is:
CPU time = (IC × CPI) / f
These equations describe CPU execution time and exclude or separately model I/O wait, operating-system overhead, and other elapsed-time components. A lower CPI is not automatically better if it requires a much larger instruction count or lower clock frequency.
Worked example. A program executes 2 × 10⁹ instructions with an average CPI of 1.5 on a 3 GHz processor:
A useful optimization should identify which term dominates. Reducing instruction count may be more valuable than increasing frequency, particularly when memory stalls dominate.
Amdahl’s law estimates the limit of improving one part of a system:
Speedup = 1 / ((1 − p) + p/s)
Here, p is the fraction of original execution time affected by the improvement, and s is the speedup of that fraction. The formula assumes the unaffected portion remains unchanged and that the fractions refer to execution time, not merely instruction counts.
Example. If 60% of execution time can be accelerated by a factor of 4, overall speedup is 1/(0.4 + 0.6/4) ≈ 1.82. Thus, a substantial local improvement yields a smaller system-wide improvement.
Other important metrics include throughput, latency, energy per operation, performance per watt, availability, and tail latency. Benchmark results should disclose input data, compiler options, system configuration, warm-up conditions, and statistical variability.
Task-level parallelism: Running independent tasks on different processors or systems.
Multicore systems improve throughput but introduce synchronization, communication, scheduling, and memory-consistency challenges. A data race occurs when conflicting accesses are insufficiently ordered, at least one is a write, and the result depends on timing. Locks, atomic operations, barriers, and message passing can establish required ordering, but excessive synchronization reduces scalability.
GPUs and other accelerators provide many processing elements optimized for regular parallel workloads. They can deliver high throughput but may perform poorly on branch-heavy or irregular tasks. Heterogeneous systems therefore require careful partitioning, data movement management, and performance modeling.
8. RISC, CISC, and Design Trade-offs
Reduced instruction-set computer (RISC) approaches generally emphasize regular instruction formats, load/store operation, and a relatively simple decoding model. Complex instruction-set computer (CISC) approaches may provide richer instructions and addressing modes. The distinction is historical rather than absolute: contemporary processors often translate complex instructions into internal micro-operations, while modern RISC processors may include sophisticated features.
Architectural decisions involve trade-offs:
Design choice
Benefit
Cost or risk
Larger cache
Fewer capacity misses
Area, power, longer access time
Deeper pipeline
Higher possible frequency
Larger branch penalty and complexity
Wider issue
More instruction throughput
Dependence on parallelism and energy
More cores
Higher parallel throughput
Synchronization and programming difficulty
Speculation
Better average performance
Recovery cost and security exposure
ECC memory
Detection or correction of faults
Storage and access overhead
No architecture is optimal for every workload. Scientific computing, real-time control, cloud services, mobile applications, and embedded systems impose different constraints.
9. Case Study: Selecting an Architecture for an Autonomous Inspection Drone
This is an illustrative case.
Background
A company is designing a battery-powered drone that captures images, avoids obstacles, and transmits selected data to a control station. The system must respond to safety-critical sensor events while maintaining acceptable flight time.
Problem
A high-performance general-purpose processor offers strong vision software support but consumes significant power. A low-power microcontroller is efficient but cannot execute the required neural-network inference quickly. Wireless transmission is intermittent, and sensor data must not be lost during short communication failures.
Analysis
The workload contains different computational patterns. Flight stabilization requires predictable low-latency control. Image preprocessing contains data-parallel operations. Neural-network inference benefits from a specialized accelerator. Storage must buffer sensor data locally. The architecture must also isolate safety-critical control from less trusted communication software.
A useful performance model begins with CPU time IC × CPI/f, but this is insufficient for the accelerator because data-transfer and synchronization costs matter. The engineering team therefore measures end-to-end latency, energy per inference, memory bandwidth, and worst-case control response rather than relying only on peak operations per second.
Approach and Solution
The proposed design uses:
A real-time microcontroller core for stabilization and emergency response.
A multicore application processor for operating-system services and image management.
A neural-network accelerator for inference.
DMA channels for sensor and camera transfers.
Local non-volatile storage for buffering.
Memory protection and separate privilege domains for control, vision, and networking.
Watchdog timers, error detection, signed firmware, and secure boot.
Sensor buffers are sized according to sampling rate and acceptable communication outage. If a stream produces r bytes per second and must tolerate t seconds of outage, the minimum payload capacity is B = rt, before adding metadata, filesystem overhead, and safety margin. Units must be consistent: bytes per second multiplied by seconds gives bytes.
Outcome
The heterogeneous design reduces energy per inference and preserves deterministic control behavior. Its principal costs are software complexity, verification effort, and more difficult debugging. The case demonstrates that architectural quality is multidimensional: throughput alone cannot establish suitability.
Learning Points
Match processing resources to workload characteristics.
Separate real-time requirements from best-effort computation.
Include data movement and memory behavior in performance analysis.
Treat security, reliability, and update mechanisms as design requirements.
Validate with representative workloads and worst-case conditions.
10. Contemporary Issues and Best Practices
Modern architecture is shaped by cloud-scale systems, chiplet integration, three-dimensional packaging, open ISAs, domain-specific accelerators, confidential computing, and energy constraints. AI workloads have increased demand for matrix-oriented computation and high-bandwidth memory. At the same time, the end of easy frequency scaling has made parallelism and specialization increasingly important.
Best practices include:
Define measurable requirements before selecting hardware.
Use workload-representative benchmarks rather than peak specifications.
Report latency, throughput, energy, and variability separately.
Design for observability through counters, tracing, and diagnostics.
Apply least privilege to firmware, drivers, devices, and accelerators.
Use error-correcting techniques where faults can affect safety or data integrity.
Consider lifecycle cost, repairability, software compatibility, and supply-chain risk.
Verify timing, concurrency, and security assumptions experimentally.
Ethically, architects should consider unequal access to computing, environmental cost, privacy risks from hardware telemetry, and the consequences of insecure or unreliable systems. Regulatory obligations may apply to safety-critical, medical, financial, or personal-data-processing systems. Architecture cannot eliminate all risks, but it can provide isolation, auditing, fail-safe behavior, and enforceable control boundaries.
Chapter Summary
Computer architecture specifies the programmer-visible behavior of a computer, while organization explains its implementation. A system contains processors, datapaths, control logic, registers, memory, I/O, and interconnects. Instruction execution proceeds through fetch, decode, execution, memory access, and write-back, often with pipeline overlap. Hazards limit ideal parallelism and are managed through forwarding, stalling, prediction, and scheduling.
The memory hierarchy exploits temporal and spatial locality. Cache performance can be analyzed with AMAT, while CPU performance depends on instruction count, CPI, and cycle time. Amdahl’s law demonstrates why improving only a portion of a workload has a bounded overall effect. Multicore, SIMD, GPU, and accelerator architectures exploit different forms of parallelism, but introduce communication, synchronization, power, and security challenges. Effective architectural design balances performance with energy, reliability, safety, cost, maintainability, and ethical responsibility.
Key Terms
Architecture: Programmer-visible specification of a computer system.
Organization: Hardware implementation of an architectural specification.
Instruction-set architecture (ISA): Interface defining instructions, registers, data types, and memory behavior.
Microarchitecture: Internal processor implementation of an ISA.
Datapath: Hardware through which data move and are transformed.
Control unit: Logic that sequences operations and generates control signals.
Pipeline: Overlapped sequence of instruction-processing stages.
Pipeline hazard: Condition that prevents ideal pipeline progress.
Cache: Small, fast memory holding recently or frequently accessed data.
Locality: Property that accesses cluster temporally or spatially.
AMAT: Average memory access time including hit and miss effects.
Virtual memory: Abstraction mapping process addresses to physical memory.
TLB: Cache of recent virtual-to-physical address translations.
DMA: Direct memory access transfer managed by a controller.
CPI: Average processor cycles required per instruction.
Amdahl’s law: Relationship limiting overall speedup from partial improvement.
Speculative execution: Performing predicted work before certainty is available.
Memory consistency: Rules governing the visibility and ordering of memory operations.
ECC: Error-correcting code used to detect or correct specified faults.
Review Questions
Short Answer Questions
Distinguish computer architecture from computer organization.
What are temporal and spatial locality?
Identify three types of pipeline hazards.
What role does a TLB perform?
Why is CPU frequency alone an inadequate performance metric?
Long Answer Questions
Explain the instruction cycle and relate each stage to processor components.
Describe cache mapping, replacement, and write policies, including their trade-offs.
Explain virtual memory, page faults, and the function of page tables and TLBs.
Compare RISC and CISC approaches and discuss why the distinction is not absolute in modern processors.
Discuss how multicore and heterogeneous architectures affect performance, programming, power, and reliability.
Analytical / Application Questions
A processor executes 1.2 × 10⁹ instructions with CPI 2.0 at 2.4 GHz. Calculate CPU time and explain which architectural changes could reduce it.
A cache has a 2 ns hit time, a 90% hit rate, and a 60 ns miss penalty. Calculate AMAT under the single-level-cache model and interpret the result.
For a workload in which 75% of execution time can be accelerated by a factor of 8, calculate overall speedup using Amdahl’s law and explain why the result is not 8.
Multiple Choice Questions with Answers
Question 1
Which statement best distinguishes computer architecture from computer organization?
A. Architecture concerns physical transistors only, while organization concerns software algorithms.
B. Architecture specifies programmer-visible behavior, while organization describes its hardware implementation.
C. Architecture is concerned only with input/output, while organization is concerned only with memory.
D. There is no meaningful distinction between the two terms.
Correct Answer: B. Architecture specifies programmer-visible behavior, while organization describes its hardware implementation.
Question 2
A processor executes 2 × 10⁹ instructions with an average CPI of 1.5 at 3 GHz. What is the CPU execution time?
A. 0.5 s
B. 1.0 s
C. 1.5 s
D. 3.0 s
Correct Answer: B. 1.0 s
Question 3
Which hazard occurs when a branch makes the next instruction address uncertain?
A. Structural hazard
B. Data hazard
C. Control hazard
D. Capacity hazard
Correct Answer: C. Control hazard
Question 4
A cache has a 1 ns hit time, a 95% hit rate, and a 40 ns miss penalty. What is the approximate AMAT?
A. 1 ns
B. 2 ns
C. 3 ns
D. 40 ns
Correct Answer: C. 3 ns
Question 5
Which mechanism translates recently used virtual addresses into physical addresses quickly?
A. ALU
B. TLB
C. DMA controller
D. Branch predictor
Correct Answer: B. TLB
Question 6
Which form of parallelism applies one instruction to multiple data elements?
A. Task-level parallelism
B. Data-level parallelism
C. Process isolation
D. Sequential execution
Correct Answer: B. Data-level parallelism
Question 7
Under Amdahl’s law, if 60% of execution time is improved by a factor of 4, the overall speedup is approximately:
A. 1.25
B. 1.82
C. 2.50
D. 4.00
Correct Answer: B. 1.82
Question 8
What is the principal purpose of DMA?
A. To decode complex instructions
B. To predict conditional branches
C. To transfer blocks between devices and memory with limited CPU involvement
D. To increase the number of processor registers
Correct Answer: C. To transfer blocks between devices and memory with limited CPU involvement
Question 9
Which property describes recently accessed data being likely to be accessed again?
A. Spatial locality
B. Temporal locality
C. Instruction speculation
D. Memory consistency
Correct Answer: B. Temporal locality
Question 10
Why might a heterogeneous architecture be selected for an autonomous drone?
A. It guarantees that all workloads have identical timing.
B. It combines resources suited to real-time control, general computation, and specialized inference.
C. It eliminates the need for operating-system software.
D. It always costs less than a single-core design.
Correct Answer: B. It combines resources suited to real-time control, general computation, and specialized inference.