Principles of Computation: Core Concepts
There’s an App for That
- Computers are embedded in many devices we use daily (phones, laptops, cameras, tablets, GPS, TVs, etc.).
- We rely on computation for many tasks: communication, navigation, entertainment, health monitoring, photography, and more.
- The idea of computation might seem magical, but it’s based on simple principles; the engineering is complex, but the underlying concepts are accessible.
- The theme: There’s an App for That – software enables the versatile functionality of hardware.
The Usual Suspects
- At the start of understanding a computer, there are key components (the “usual suspects") that work together:
- The Processor (the technical name for the device that does the actual computing):
- Also called: computer, microprocessor, central processor, CPU (central processing unit), or core.
- The processor does the work by following the program’s instructions.
- The Operating System (OS):
- The software that makes the computer useful.
- Performs common tasks across all apps: loading programs, sharing memory among multiple apps, locating files, etc.
- The Software (apps):
- The “magic” external to the hardware: programs for phones, laptops, tablets, and other devices.
- Hardware follows the instructions provided by software developers; the computer will do whatever those instructions specify.
- The Instructions:
- Computer instructions are very simple; not like tasks such as “Do today’s homework.”
- However, billions of such simple instructions per second yield significant capabilities (e.g., GPS positioning/an orientation on the Earth).
- This rapid execution is part of why speeds keep increasing.
- The Memory:
- Bits are the universal medium for information; memory stores billions of 0s and 1s.
- Programs and data are encoded as bits.
The Role of the Processor (CPU) and the OS
- The Processor (CPU) does the actual computing work by executing program instructions.
- The Operating System (OS) is software that enables usefulness:
- Loads programs
- Manages memory sharing among multiple apps
- Locates files
- Performs many other common tasks that support applications
- The Software (apps) are programs that run on top of the OS and hardware; they rely on the hardware to perform operations.
- The Hardware follows the program’s instructions; there is no inherent behavior beyond what the software specifies.
Instructions and Their Nature
- Computer instructions are simple operations (e.g., basic arithmetic, data movement, comparisons).
- The power of computing comes from executing billions of these simple operations per second, enabling complex tasks to emerge.
- Example cited: precisely calculating your position and orientation on the Earth’s surface using GPS.
- This illustrates how simple building blocks, when executed rapidly and repeatedly, achieve sophisticated outcomes.
The Fetch/Execute Cycle
- The Fetch/Execute Cycle refers to the process of executing an instruction.
- It is the mechanism by which the processor retrieves, interprets, and performs instructions.
- Historically, computers described instructions as “orders”; another term used is instruction “interpretation.”
- In practical terms, the cycle involves:
- Fetch: retrieving the instruction (and any necessary data) from memory.
- Decode/Interpret: understanding what the instruction is supposed to do.
- Execute: performing the operation and altering data as required.
- The cycle is continuous and repeats for each instruction in the program.
Memory and the Binary Basis
- Memory stores the billions of 0s and 1s that encode programs and data.
- In computing, bits are the basic unit of information and exist as two states: 0 and 1.
- A memory system holds data and instructions in these binary form so the processor can fetch and manipulate them.
- It is the memory that is accessed during the Fetch/Execute Cycle to retrieve instructions and to read/write data.
Timing and Scale (Concrete Illustrations)
- The start of an app’s execution happens in the first few nanoseconds.
- A nanosecond (ns) is a unit of time equal to one billionth of a second: 1 ext{ ns} = 10^{-9} ext{ s}
- Processors operate at gigahertz (GHz) clock speeds, enabling billions of instructions per second:
- Roughly 10^9 instructions per second is a common scale for basic CPUs (1 GHz).
- The combination of fast clock rates and simple instruction sets allows modern devices to perform complex tasks rapidly.
Putting It All Together: How Apps Make Devices Useful
- The hardware (processor and memory) executes the programs.
- The OS provides a common environment and services to manage resources and coordinate tasks across apps.
- Apps are written by software developers as instructions that the hardware ultimately executes.
- Any device that contains a processor, memory, and software can run applications; the same core principles apply across phones, laptops, tablets, and other devices.
Real-World Relevance and Implications
- The seamless experience of using devices in daily life relies on the interplay of hardware (CPU, memory) and software (OS, apps).
- The efficiency and effectiveness of computation depend on:
- How quickly instructions can be fetched, decoded, and executed (the Fetch/Execute Cycle).
- How memory is organized and accessed to minimize latency and maximize throughput.
- How operating systems allocate resources among multiple apps to ensure smooth performance.
- The GPS example highlights the tangible outcomes of simple operations executed at scale:
- Position determination and orientation rely on complex signal processing and arithmetic performed billions of times per second.
Glossary and Key Concepts
- Processor / CPU / Core: The hardware component that executes program instructions.
- Operating System (OS): System software that manages hardware resources and provides common services for apps.
- Software / Apps: Programs that run on the hardware, performing tasks for users.
- Instructions: The basic operations the processor performs; extremely simple individually but powerful in aggregate.
- Memory: Storage for programs and data; stores billions of bits.
- Bits: The binary digits 0 and 1; the universal medium for information in computing.
- Fetch/Execute Cycle: The process by which the processor retrieves, interprets, and performs instructions.
- Data Path and Memory Access: Movement of data between registers, memory, and the CPU during instruction execution.
- Time unit:
- 1\ \text{ns} = 10^{-9}\ \text{s}
- Instruction throughput (order-of-magnitude):
- \text{Instructions per second} \approx 10^9
- Binary data representation:
- Memory stores data and programs as bits; the total memory capacity is often discussed in terms of bits or bytes, but at its core it is a binary collection of 0s and 1s that the CPU can fetch and modify.
Summary
- Modern devices are built from a small set of core ideas:
- A processor that follows instructions to perform computations.
- An operating system that coordinates programs and resources.
- Software (apps) that provide functionality and rely on hardware for execution.
- Memory that stores programs and data as binary bits.
- A fetch/execute cycle that describes how instructions are retrieved, processed, and stored back.
- The perceived magic of computation is the result of assembling these simple components and processes at enormous speed and scale.