Skip to main content
CBE Nexus · Undergraduate Computer Science

Chapter 4: Computer Architecture and Organization

Understand digital logic, binary arithmetic, data representation, CPU datapaths, instruction execution, assembly concepts, memory hierarchy, cache, input/output, buses and performance.

Back to Computer Science course guide

Chapter overview and learning outcomes

This chapter develops the conceptual and practical foundations of computer architecture and organization. It connects theory with implementation, evaluation and responsible computing practice.

1. Architecture and organization

Computer architecture describes programmer-visible attributes such as instruction sets, data types, registers and addressing modes. Computer organization describes how hardware components implement that architecture, including control signals, datapaths, buses and memory technologies. Different processors can implement similar instruction sets with different microarchitectures. Understanding the distinction helps explain compatibility and performance.

Worked application: Consider a realistic computing task, identify its assumptions and constraints, then trace the relevant process using a small example. Record intermediate states, expected results and possible failure cases. Compare at least one alternative approach and explain the trade-offs in correctness, performance, maintainability and security.

Study focus: Define the key terms, reproduce the concept diagram, explain the mechanism in sequence and solve a short problem without relying on memorised wording.

2. Boolean logic and logic gates

Digital circuits use logic gates to implement Boolean functions. AND produces 1 only when all inputs are 1; OR produces 1 when at least one input is 1; NOT inverts a bit. NAND, NOR, XOR and XNOR provide other useful operations. Truth tables define behaviour. Combinational circuits depend on current inputs, while sequential circuits also depend on stored state.

Worked application: Consider a realistic computing task, identify its assumptions and constraints, then trace the relevant process using a small example. Record intermediate states, expected results and possible failure cases. Compare at least one alternative approach and explain the trade-offs in correctness, performance, maintainability and security.

Study focus: Define the key terms, reproduce the concept diagram, explain the mechanism in sequence and solve a short problem without relying on memorised wording.

3. Number systems and signed representation

Binary uses base two and hexadecimal uses base sixteen. Convert a binary integer to decimal by summing each bit multiplied by its positional power of two. Fixed-width arithmetic has limits: unsigned n-bit values range from 0 to 2^n−1. Two's complement represents signed integers and supports addition and subtraction using common binary hardware. Overflow occurs when a result is outside the representable range.

Worked application: Consider a realistic computing task, identify its assumptions and constraints, then trace the relevant process using a small example. Record intermediate states, expected results and possible failure cases. Compare at least one alternative approach and explain the trade-offs in correctness, performance, maintainability and security.

Study focus: Define the key terms, reproduce the concept diagram, explain the mechanism in sequence and solve a short problem without relying on memorised wording.

4. Floating-point and character representation

Floating-point formats approximate real numbers using sign, exponent and significand fields. Many decimal fractions cannot be represented exactly in binary, causing rounding error. Numerical algorithms should account for precision and avoid unsafe equality comparisons. Character encoding maps symbols to numeric code points; Unicode supports a broad range of writing systems, while UTF-8 is a variable-length encoding widely used on the web.

Worked application: Consider a realistic computing task, identify its assumptions and constraints, then trace the relevant process using a small example. Record intermediate states, expected results and possible failure cases. Compare at least one alternative approach and explain the trade-offs in correctness, performance, maintainability and security.

Study focus: Define the key terms, reproduce the concept diagram, explain the mechanism in sequence and solve a short problem without relying on memorised wording.

5. CPU components and datapath

A processor contains registers, an arithmetic logic unit, control logic and interfaces to memory and input/output. The datapath moves operands and results among these components. Registers may hold general data, addresses, instruction information or status flags. The control unit coordinates operations by generating signals according to the instruction and processor state. Pipelined designs overlap stages to improve throughput.

Worked application: Consider a realistic computing task, identify its assumptions and constraints, then trace the relevant process using a small example. Record intermediate states, expected results and possible failure cases. Compare at least one alternative approach and explain the trade-offs in correctness, performance, maintainability and security.

Study focus: Define the key terms, reproduce the concept diagram, explain the mechanism in sequence and solve a short problem without relying on memorised wording.

6. Instruction set architecture and machine instructions

An instruction set architecture defines operations available to software, register models, data types, memory access and instruction encoding. Instructions may perform arithmetic, logical operations, data movement, branching and input/output. Assembly language gives human-readable names to machine instructions. Assemblers translate mnemonics and labels into encoded instructions and addresses.

Worked application: Consider a realistic computing task, identify its assumptions and constraints, then trace the relevant process using a small example. Record intermediate states, expected results and possible failure cases. Compare at least one alternative approach and explain the trade-offs in correctness, performance, maintainability and security.

Study focus: Define the key terms, reproduce the concept diagram, explain the mechanism in sequence and solve a short problem without relying on memorised wording.

7. The instruction cycle and interrupts

A simplified instruction cycle fetches an instruction from memory, decodes it, obtains operands, executes the operation and stores results. Real processors use pipelines, caches, speculative execution and other techniques. Interrupts allow hardware or software events to request processor attention. The processor saves enough state to handle the event and then resumes execution according to architecture rules.

Worked application: Consider a realistic computing task, identify its assumptions and constraints, then trace the relevant process using a small example. Record intermediate states, expected results and possible failure cases. Compare at least one alternative approach and explain the trade-offs in correctness, performance, maintainability and security.

Study focus: Define the key terms, reproduce the concept diagram, explain the mechanism in sequence and solve a short problem without relying on memorised wording.

8. Memory hierarchy and cache

The memory hierarchy places small fast storage close to the processor and larger slower storage farther away. Cache stores copies of recently or frequently used memory blocks. Temporal locality means recently accessed data may be accessed again; spatial locality means nearby addresses may be accessed. Cache hit rate, miss penalty, block size and associativity influence performance. Cache coherence matters in multiprocessor systems.

Worked application: Consider a realistic computing task, identify its assumptions and constraints, then trace the relevant process using a small example. Record intermediate states, expected results and possible failure cases. Compare at least one alternative approach and explain the trade-offs in correctness, performance, maintainability and security.

Study focus: Define the key terms, reproduce the concept diagram, explain the mechanism in sequence and solve a short problem without relying on memorised wording.

9. Main memory, virtual memory and storage

RAM provides working storage for active programs and is typically volatile. Read-only memory and flash technologies retain information without power. Virtual memory gives each process a logical address space and maps virtual pages to physical frames. Page tables and translation lookaside buffers support address translation. Storage devices provide persistent capacity with different latency, endurance and cost characteristics.

Worked application: Consider a realistic computing task, identify its assumptions and constraints, then trace the relevant process using a small example. Record intermediate states, expected results and possible failure cases. Compare at least one alternative approach and explain the trade-offs in correctness, performance, maintainability and security.

Study focus: Define the key terms, reproduce the concept diagram, explain the mechanism in sequence and solve a short problem without relying on memorised wording.

10. Input/output, buses and device management

Input/output connects the processor and memory system to external devices. Programmed I/O, interrupt-driven I/O and direct memory access represent different transfer approaches. Buses or interconnects carry data, addresses and control information. Device controllers manage device-specific behaviour, while drivers expose standard interfaces to the operating system. Bandwidth, latency and contention influence throughput.

Worked application: Consider a realistic computing task, identify its assumptions and constraints, then trace the relevant process using a small example. Record intermediate states, expected results and possible failure cases. Compare at least one alternative approach and explain the trade-offs in correctness, performance, maintainability and security.

Study focus: Define the key terms, reproduce the concept diagram, explain the mechanism in sequence and solve a short problem without relying on memorised wording.

11. Performance, parallelism and energy

CPU performance depends on instruction count, cycles per instruction and clock period, but memory stalls, branch behaviour and workload characteristics also matter. Amdahl's law shows that speedup is limited by the fraction of work that cannot be parallelised. Multicore processors improve throughput when tasks can run concurrently. Energy efficiency, heat, reliability and security are important design constraints.

Worked application: Consider a realistic computing task, identify its assumptions and constraints, then trace the relevant process using a small example. Record intermediate states, expected results and possible failure cases. Compare at least one alternative approach and explain the trade-offs in correctness, performance, maintainability and security.

Study focus: Define the key terms, reproduce the concept diagram, explain the mechanism in sequence and solve a short problem without relying on memorised wording.

Figure 1. CPU datapath
Registers hold operands→Control unit decodes instruction→ALU performs operation→Result written to register

Conceptual learning diagram; use alongside the explanations and practical work.

Figure 2. Instruction cycle
Fetch instruction→Decode operation→Execute operation→Store or commit result

Conceptual learning diagram; use alongside the explanations and practical work.

Figure 3. Memory hierarchy
Registers and cache→RAM→SSD or hard disk→Remote or archival storage

Conceptual learning diagram; use alongside the explanations and practical work.

Practical laboratory activity

  1. Write a short problem specification, listing inputs, outputs and constraints.
  2. Draw a diagram or write pseudocode before implementation.
  3. Implement a small example in an appropriate language or tool.
  4. Test normal, boundary and invalid cases; record actual and expected results.
  5. Explain the design trade-offs and suggest one improvement.

Use authorised software and test environments. Do not run experiments on systems or data without permission.

Worked reasoning and self-check

For every problem, state the assumptions first. Work through a small input manually, record each important state transition and compare the final result with the specification. If the result differs, isolate the smallest failing example and revise the reasoning before changing code. For performance questions, identify the input-size variable and count the dominant operation rather than guessing from execution time alone.

Examination and revision questions

Answer with definitions, explanations, diagrams, calculations or code traces as appropriate. Show working for numerical and algorithmic questions.

  1. Differentiate architecture and organization.

    Show answer guidance

    Architecture describes programmer-visible features; organization describes their hardware implementation.

  2. What does an ALU do?

    Show answer guidance

    It performs arithmetic and logical operations.

  3. What is a logic gate?

    Show answer guidance

    A digital circuit implementing a Boolean function.

  4. What is two's complement?

    Show answer guidance

    A common fixed-width representation of signed integers that supports arithmetic using binary addition.

  5. What is floating-point rounding error?

    Show answer guidance

    The difference caused when a real value cannot be represented exactly in a finite binary format.

  6. Describe the instruction cycle.

    Show answer guidance

    A simplified cycle fetches, decodes, executes and stores or commits an instruction's result.

  7. What is a register?

    Show answer guidance

    A small, fast storage location within the processor.

  8. Why is cache memory used?

    Show answer guidance

    To keep likely-needed data close to the CPU and reduce average memory access time.

  9. Define temporal locality.

    Show answer guidance

    Recently accessed data or instructions are likely to be accessed again.

  10. What is virtual memory?

    Show answer guidance

    An abstraction that gives processes virtual address spaces mapped to physical memory and possibly storage.

  11. What is an interrupt?

    Show answer guidance

    An event that causes the processor to pause normal execution and handle a request.

  12. What is DMA?

    Show answer guidance

    Direct memory access allows a device to transfer data to or from memory with limited CPU involvement.

  13. What is clock rate?

    Show answer guidance

    The frequency of a processor's clock signal.

  14. State one limitation of clock rate as a performance measure.

    Show answer guidance

    It ignores instruction count, cycles per instruction, memory stalls and workload differences.

  15. What does Amdahl's law explain?

    Show answer guidance

    The maximum speedup of a task is limited by the portion that cannot be parallelised.

Revision checklist

Further study and references

Consult current university textbooks, peer-reviewed computing research, official language and standards documentation, processor or operating-system manuals, and reputable open educational resources. Check edition, publication date and technical version. Programming language behaviour, security recommendations and software tools evolve; verify details against current official documentation.

Academic and responsible-use note: These notes support undergraduate learning. Verify course requirements with your university, cite sources in assessed work, respect software licences and data privacy, and test only systems for which you have authorisation.

Return to the full Computer Science course guide

Official Education References

Use these official organisations for curriculum guidance, examinations and further learning information.