Computer Systems A - Data Representation and Computer Structure
Data Representation and Computer Structure
All information inside computers is encoded as 0s and 1s (bits).
Bits are the basic building blocks, combined to represent text, numbers, images, and sound.
This is fundamental as computers manipulate digital signals (on/off, 1/0).
Key Ideas
A bit is the smallest unit of data.
Different data types are encoded into binary differently, requiring decoding based on type.
Boolean logic calculates results as True or False.
Buses connect components for data and signal transfer.
System buses play a crucial role in the machine cycle, ferrying addresses, data, and control signals.
How Data Is Represented in a Computer System
Data is represented as bit patterns using sequences of 0s and 1s.
A bit is the smallest unit of data, either 0 or 1 (Off/False or On/True).
8 contiguous bits = 1 byte.
Integer Representation
Decimal to Binary Conversion
Repeatedly divide the decimal number by 2, noting the remainders.
Write the remainders in reverse order to get the binary representation.
Binary to Decimal Conversion
- Use the positional notation system, where each digit represents a power of 2, starting from the rightmost digit.
Text Representation
Text characters have binary representations using ASCII and Unicode.
Standard ASCII uses a 7-bit code for 128 characters; Extended ASCII uses 8 bits.
Unicode uses 16 bits per character to represent more characters.
Image Representation
Images are represented using pixels, the smallest unit of a digital image.
Each pixel is assigned a binary code to represent its color.
A bitmap is an array/grid of binary data representing the color values of pixels.
Audio Representation
Digital audio records sound as a sequence of samples.
Each sample encodes the amplitude of the sound wave at a specific time.
Examples of bit depths:
- 8-bit audio: 256 values
- 16-bit audio: 65,536 values
- 24-bit audio: 16,777,216 values
Video Representation
Digital videos are represented as a series of images (frames).
Each frame is encoded using bit patterns to store the color of each pixel.
File Representation
Files are represented as collections of bits following specific file formats.
Examples: JPEG, DOC/DOCX, XLS/XLSX.
Data for Transmission
Data is broken into packets for transmission over networks.
Packets are reassembled at the destination.
Bit Patterns
Allow efficient data processing, storage, and transmission.
Foundation of modern computing systems.
Boolean Logic and Binary
Boolean logic is a type of algebra with results as true or false.
Used in digital devices like computers.
Logic Operations
AND: Output is 1 (true) if both inputs are 1 (true).
OR: Output is 1 (true) if either input is 1 (true).
NOT: Output is the opposite of the input value.
Computer Memory: Units of Memory
Measured in bytes.
- Bit (b): Smallest unit, 0 or 1.
- Byte (B): 8 bits.
- Kilobyte (KB): 1024 bytes.
- Megabyte (MB): 1024 KB or 1,048,576 bytes.
- Gigabyte (GB): 1024 MB or 1,073,741,824 bytes.
Structure of a Computer System
Comprises a processor/CPU, memory, input, output, and storage devices.
CPU is the calculating, sorting, searching, and decision-making part.
Main memory (RAM) stores data currently used by the CPU.
Secondary storage stores saved computer data.
Flip-flops are basic electronic circuits used for storing bits.
Types of Memory: RAM and ROM as Bit Storage
RAM (Random Access Memory): Primary storage for data the CPU is actively using.
- Volatile: Data is lost when power is off.
ROM (Read-Only Memory): Non-volatile, retains data when power is off.
- Used to store instructions for initializing hardware or loading the operating system.
Secondary Memory/Storage: Non-volatile, external storage.
- Examples: HDDs, SSDs, USBs, CDs.
Cache Memory: Small, high-speed memory for temporary data storage on or close to the CPU.
Registers: Fastest access, smallest capacity storage within the CPU.
Memory Hierarchy
Hierarchical arrangement of memory types by speed, capacity, and cost.
Registers (fastest, smallest) → Cache → RAM → Secondary Storage (slowest, largest).
Caching
Hardware or software component that stores data for faster future requests.
Browser cache: Temporary storage in RAM or on disk for recently downloaded web pages.
Central Processing Unit (CPU)
Manages all data processing.
Consists of the Control Unit (CU), Arithmetic and Logic Unit (ALU), and registers.
Components of a CPU
Control Unit (CU):
- Manages operations within the CPU.
- Fetches and decodes instructions.
- Manages data flow to ALU and registers.
Arithmetic and Logic Unit (ALU):
- Performs arithmetic and logical operations.
Registers:
- Fastest, smallest storage units within the CPU.
- MAR: Stores memory address being read/written.
- PC: Stores the address of the next instruction.
- MDR: Holds data being transferred to/from the processor.
Cache:
- Temporarily stores data and instructions for faster access.
Clock:
- Sends out regular pulses to synchronize CPU components.
- Clock speed measured in GHz.
System Bus:
- Connects processor to other components.
- Address bus, data bus, and control bus.
Computer Buses – Outside of the CPU
- Connect the CPU to other components and main memory.
Machine Cycle
Fetch, Decode, Execute, Store (FDES).
CPU repeats this cycle to run programs.
Stages
- Fetch: Retrieve instruction from memory.
- Decode: Interpret the instruction.
- Execute: Carry out the instruction.
- Store: Store the results in memory or registers.
CPU Instruction Set
Commands the CPU can understand and execute.
Defines operations, data types, and addressing modes.
Embedded Systems
Special-purpose computer system encapsulated by the device it controls.
Pre-defined tasks, not programmable by users.
Examples: fitness trackers, central heating systems.