Skip to content

MCA · MCA C1001

The computer system: components, software, and execution

Explore CPU and memory organisation, operating-system boundaries, program execution, processes, threads, interrupts, and DMA.

By Dev Kant KumarUpdated 13 Oct 2026

On this page

This chapter develops the machinery introduced in Introduction to computers. It teaches the essential system model here; later units examine architecture, memory technologies, and operating systems in more detail.

What you will learn

Identify processor, memory, storage, and input/output roles; trace a stored program; distinguish software, firmware, processes, and threads; explain locality, interrupts, and DMA.

1. The computer system and its components

Functional components and the questions they answer
ComponentMain roleExample question
ProcessorExecutes instructions and coordinates operationsWhich operation should run next?
Main memoryHolds working instructions and dataWhat values are needed during this execution?
Persistent storageRetains files and other durable dataWhat should remain after the application closes?
Input/output subsystemTransfers data between the system and its environmentHow does a key press reach the application?
Interconnects and controllersCarry transfers and coordinate access to devicesHow does the processor communicate with memory and devices?

Inside the processor

The arithmetic and logic unit (ALU) performs operations such as addition and comparisons. Control logic interprets instructions and coordinates their execution. Registers retain small amounts of state close to the execution units, including operands and control information. Modern processors also contain caches and specialised execution units.

This functional description is deliberately simplified. Not every arithmetic operation uses one identical ALU, and actual processors may pipeline operations, predict branches, or execute instructions out of order while preserving the required architectural behaviour.

Memory is not the same as storage

Ordinary DRAM used as main memory is volatile: it normally needs power to retain contents. SSDs and hard drives retain data without continuous power. Registers, caches, main memory, and persistent storage have different capacities, costs, and access characteristics.

When an application loads a document, it may read the file from storage into memory. Editing the in-memory copy does not guarantee that changes have been saved. Closing an application before saving can lose those changes; a correctly designed autosave system changes this behaviour.

Addresses, values, and the memory model

An address identifies a location in an address space; the contents are the value stored there. The number on a locker identifies the locker, not what it contains. Similarly, changing a memory value does not necessarily change its address. A variable is a program-level name; the implementation decides how its value is represented and where it lives.

In a simple byte-addressed model, consecutive addresses identify consecutive bytes. A multi-byte value occupies more than one byte, so the implementation must know its size and byte order. Do not assume every abstract instruction or hardware device uses exactly the same addressable unit.

Toy byte-addressed memory: addresses and contents are distinct
AddressContentsPossible interpretation
100001000001ASCII A, or unsigned integer 65
100100000101Unsigned integer 5
100200000000Integer zero, or a terminator under a chosen convention

A real application normally uses virtual addresses managed through the OS and processor’s memory mechanisms. A virtual address need not equal a physical memory location. Virtual memory provides an abstraction; it does not create unlimited RAM. Detailed address translation belongs to later operating-system study.

Why memory is a hierarchy

Fast storage close to execution units is expensive in capacity and implementation resources. Large storage has different access costs. Systems combine levels to obtain useful capacity and speed at an acceptable cost. Registers serve immediate instruction needs; caches retain likely reusable data; main memory supports working state; persistent storage holds durable files.

Temporal locality means recently used data or instructions are likely to be used again. A loop repeatedly accessing a counter is an example. Spatial locality means nearby locations are likely to be used together. Sequentially reading an array is an example. A cache exploits these patterns, but it cannot guarantee a hit for every access.

Consider reading ten consecutive array elements versus following ten pointers to widely separated locations. Both perform ten logical reads; their memory-system behaviour can differ. This explains why counting operations alone may not predict execution time.

Capacity, access latency, and bandwidth

Capacity asks how much can be stored. Access latency asks how long a particular access takes. Bandwidth asks how much data can be transferred per unit time under stated conditions. These are different measurements. A larger drive does not automatically have lower access latency; a high transfer rate does not eliminate the time needed to begin an operation.

State whether a capacity uses decimal or binary units when it matters. One kilobyte is 1000 bytes; one kibibyte is 1024 bytes. Bits and bytes also differ: 80 megabits per second is 10 megabytes per second before overhead and other limitations, because one byte has eight bits.

2. Hardware, software, and the operating system

Hardware consists of physical components. Software consists of programs and associated material used to specify behaviour. Neither a device's appearance nor its price tells you whether a particular workload will run well.

An application performs a user task. The operating system manages resources and provides services and abstractions such as processes and files. It helps applications use hardware without each application implementing every device-specific detail.

A process is an executing program together with its execution state and resources. With time sharing, the OS can give multiple processes opportunities to run on a processor. Protection mechanisms help isolate processes, although isolation is not an unconditional guarantee against all faults or attacks.

Firmware is software closely associated with a device and commonly stored in non-volatile memory. “Firmware is hardware” is inaccurate: the storage chip is hardware; the instructions stored on it are software.

The operating system as manager and boundary

Applications share finite resources. The OS schedules execution, manages memory, provides device access, and applies access-control decisions. A running program should not obtain unrestricted access to another program’s memory merely because both use the same machine.

Applications request services through defined interfaces. A library function may invoke an OS service, perform user-space work, or do both. A system call is a controlled entry into an OS service. “Every function call is a system call” is false.

For example, opening a file requires finding the file, checking access conditions, and establishing a usable handle or descriptor. Reading then requests bytes. A read can fail or return fewer bytes than requested. Robust software checks what actually happened rather than assuming the requested outcome occurred.

Source, compiler, executable, and runtime

Source code is a human-oriented program representation. A compiler translates one program representation into another; machine code is one possible target. A linker combines required code and resolves references in a conventional compiled build. A loader helps prepare an executable for running. A runtime supplies execution support required by a language or environment.

An interpreter performs a program’s behaviour through another executing program. A just-in-time compiler translates some code during execution. These are implementation strategies, not rigid categories attached forever to a programming language. What matters is the actual environment and its execution model.

Program, process, and thread

A saved program is not itself a running process. Two processes can execute the same program while maintaining different state. A process may have multiple threads that share some resources and retain separate execution state.

Concurrency is organising overlapping activities. A single core can interleave them. Parallelism is simultaneous execution of some work. Extra cores help only when the program and workload expose usable parallel work and other resource limits permit it.

3. What happens when a program runs?

A source file is not always directly executable by the processor. A compiled program may be translated into machine instructions; other programs run through an interpreter or a runtime. Some environments combine interpretation and compilation. In all cases, execution eventually depends on machine-level operations.

  1. The system prepares the program's execution environment. Required code and data become accessible in memory; they need not all be read from storage at once.
  2. At a conceptual level, the processor fetches an instruction using an instruction address.
  3. It decodes the instruction to determine the operation and operands.
  4. It performs the required action, such as computing a value, accessing memory, or changing control flow.
  5. It updates architectural state and proceeds to the next instruction determined by the program's control flow.

This fetch–decode–execute model explains instruction processing. It is not a timing diagram of a modern CPU: several instructions can be in different pipeline stages simultaneously.

Stored-program principle

Instructions are represented in a form that can be stored and retrieved by a machine. Changing the program changes the computation without rebuilding the underlying processor. Do not turn this principle into the claim that every computer has one physically unified instruction-and-data memory: systems may separate instruction and data paths or caches.

Pseudocode
marks = [72, 81, 67]
total = 0
for each mark in marks:
    total = total + mark
percentage = (total / 300) * 100
display percentage

Here the list is data; the loop and expressions describe instructions. The total evolves from 0 to 72 to 153 to 220. The percentage is approximately 73.33%. That interpretation assumes three subjects, each out of 100. If maxima differ, calculate using their actual sum rather than hard-coding 300.

A complete execution trace using a toy machine

Use a simple machine with an accumulator register ACC, a program counter PC, and two memory values: address 200 contains 7; address 201 contains 5. Its invented instruction set contains LOAD, ADD, STORE, and HALT. This is a teaching model, not a particular commercial processor.

Toy assembly
0: LOAD  200
1: ADD   201
2: STORE 202
3: HALT
Trace of a four-instruction program
Before instructionActionState after completion
PC = 0Copy memory[200] into ACCACC = 7; next PC = 1
PC = 1Add memory[201] to ACCACC = 12; next PC = 2
PC = 2Copy ACC into memory[202]memory[202] = 12; next PC = 3
PC = 3Stop this toy executionResult remains 12 in address 202

LOAD copies a value; it does not erase the source location. STORE writes a value; it does not turn an address into the value itself. The PC and ACC hold different kinds of state. If the program forgot STORE, the computed answer could remain in ACC without being written to the intended result location.

Actual instruction sets include defined operand forms, registers, instruction encodings, and exception behaviour. A processor’s instruction set architecture (ISA) defines the software-visible execution contract. Its microarchitecture is an implementation of that contract. Different implementations can run compatible instructions while having different performance.

Control flow: sequence, selection, and repetition

Sequence follows successive operations. Selection chooses a path based on a condition. Repetition performs a set of operations multiple times. An instruction that changes where execution continues is often called a branch or jump, depending on the instruction set.

In the marks example, iteration reads each mark and updates a total. If the loop skips one entry, correctly implemented addition cannot repair the missing work. Tracing control flow is therefore as important as checking arithmetic.

Input/output: the CPU is not doing everything itself

Device controllers coordinate device operations. Polling checks whether an operation is ready or complete. An interrupt can notify the processor of an event through a handler. Neither mechanism is always best; checking and notification both have costs.

Some controllers use direct memory access to transfer data without making the CPU copy every unit using ordinary instructions. The CPU still sets up work and deals with results or errors. An I/O request has a lifecycle; issuing it is not the same as completing it.

Questions and answers

Easy: explain the idea. Medium: apply or compare it. Hard: analyse assumptions and trade-offs. Tags describe the question’s purpose; interview questions are original practice, not claims about a specific employer.

Revision checkpoints

Explain the main mechanisms in your own words, reproduce the worked examples without looking, and answer the tagged questions before expanding their solutions. When an answer depends on assumptions, state them explicitly.

References and further reading

The supplied MCA syllabus defines the topic placement (Fundamentals of Computers, PDF page 9). The chapter explains its prerequisites and worked examples directly; the references support verification and optional further study. The explanations, examples, diagrams, and practice questions here are original teaching material.

Spot an error? Report it to Study Shelf with this page link.