Chapter 1.2: Computer Hardware
Introduction
Learning Outcomes
Explain what each basic hardware component does.
Distinguish RAM, ROM, HDD and SSD within the memory hierarchy.
Choose input and output devices for a given purpose.
Assess whether components fit together in connections, power and size.
Introduction
What Is Hardware?
Hardware is all the physical parts of a computer system. Software tells those parts what to do.
- Input devices bring data into the system.
- The CPU executes instructions.
- RAM holds the running program and its data.
- Storage keeps data permanently.
- Output devices present the result.
Introduction
Hardware Categories
CPU, motherboard, RAM, GPU, power supply and case.
Keyboard, mouse, microphone, camera and sensors.
Monitor, printer, speakers and projector.
HDD, SSD, USB drive, memory card and optical media.
Network card, switch, router and access point.
USB, HDMI, DisplayPort, audio and network ports.
System Components
The Central Processing Unit (CPU)
- It fetches, decodes and executes program instructions.
- The ALU performs arithmetic and logical operations.
- The control unit manages the data flow and sequencing.
- Core count, clock speed (GHz), cache and architecture together determine performance.
System Components
Processor Ecosystems
The dominant architecture in desktops, laptops and servers.
The dominant architecture in mobile and energy-efficient systems.
x86-64 processors for consumers and servers.
Different designs and product families built on ARM.
System Components
SoC, Mobile Processors and NPUs
- SoC (system on a chip): the CPU, GPU, memory controller and other units sit on one chip, saving space and power in phones and thin laptops.
- NPU (neural processing unit): speeds up AI workloads (speech recognition, photo enhancement, translation) at low power.
- In most SoCs, RAM is a separate chip placed very close to the SoC; details vary by manufacturer.
System Components
Clock Speed and Core Count
- Clock speed: 3 GHz = 3 billion cycles per second; each cycle advances one step.
- Core: a unit that runs its own instruction stream; more cores help only if the work can be split.
- A single-threaded program uses one core even on an 8-core CPU, so “8 cores = 8× speed” is false.
System Components
Motherboard
The motherboard ties the components together physically and electrically and lets them talk over buses.
- CPU socket: determines which processor family is supported.
- DIMM slots: hold the RAM modules.
- PCIe: graphics and expansion cards.
- M.2 / SATA: storage devices.
- Chipset: manages traffic between ports and slots.
- 24-pin / 8-pin: motherboard and CPU power.
System Components
RAM (Random Access Memory)
- Volatile: contents are lost when power goes off.
- Fast access: the CPU can reach any address directly.
- Capacity: affects how many applications run comfortably at once.
- Compatibility: DDR generation, speed and motherboard support must match.
System Components
ROM and Firmware
Memory that keeps its contents without power. Today firmware usually lives in rewritable flash memory.
Low-level software that controls the basic behavior of the hardware.
Initializes the hardware at power-on and starts loading the operating system.
Fix compatibility or security issues; never interrupt one midway.
System Components
The Memory Hierarchy
Values are approximate. The CPU keeps frequently used data in the upper levels to avoid slow trips down; RAM is volatile, SSD/HDD are persistent.
System Components · Step by step
Access Time Across the Levels
Registers are inside the processor; access takes less than one clock cycle (< 1 ns). Capacity: hundreds of bytes.
L1 cache is the smallest and fastest cache. L1–L3 range from 1 to 10 ns; L1 is at the low end.
L2 cache is larger but a bit slower (upper part of the range). The scale is logarithmic: gridlines are 1000× apart (1 ns, 1 µs, 1 ms).
RAM 50–100 ns: tens of times slower than L1. The processor caches data to avoid waiting on RAM.
SSD ≈ 0.1 ms = 100,000 ns: about 1000–2000× slower than RAM, but persistent.
HDD 5–10 ms: 50–100× slower than an SSD and 50,000–200,000× slower than RAM; it needs mechanical movement (seek + rotation).
System Components
How Does a Cache Work? (Hits and Misses)
The CPU requests address 1003 (first access). It checks the cache first.
Miss: 1003 is not in the cache → fetched from RAM (~80 ns) and copied into the cache together with its neighbor (1002–1003).
The CPU requests address 1003 (again). It checks the cache first.
Hit: 1003 is in the cache → the value 108 reaches the CPU in about 1 ns.
The CPU requests address 1004 (neighboring address). It checks the cache first.
Miss: 1004 is not in the cache → fetched from RAM (~80 ns) and copied into the cache together with its neighbor (1004–1005).
System Components · Step by step
Caching an Array Sum: Counting Hits and Misses
Array a is in RAM; the cache is empty. Assume a 4-byte int and a 16-byte cache line (block), i.e. 4 elements; hit ≈ 1 ns, miss ≈ 80 ns.
a[0] requested: not in cache → miss. RAM sends the whole block (a[0]…a[3]), not just a[0]: 80 ns.
a[1] requested: block 0 is cached → hit, 1 ns. It came along with the previous miss.
a[2] requested: block 0 is cached → hit, 1 ns. It came along with the previous miss.
a[3] requested: block 0 is cached → hit, 1 ns. It came along with the previous miss.
a[4] requested: not in cache → miss. RAM sends the whole block (a[4]…a[7]), not just a[4]: 80 ns.
a[5] requested: block 1 is cached → hit, 1 ns. It came along with the previous miss.
a[6] requested: block 1 is cached → hit, 1 ns. It came along with the previous miss.
a[7] requested: block 1 is cached → hit, 1 ns. It came along with the previous miss.
Done: sum = 31. 6 of the 8 accesses hit; time 2 × 80 + 6 × 1 = 166 ns. Without a cache it would be 8 × 80 = 640 ns. That is why sequential access is fast: spatial locality. Striding through the array (a[0], a[4], …) would miss every time.
sum = 0 for i = 0, 1, …, 7 do sum = sum + a[i] // 4-byte int, 16-byte line
System Components · Step by step
Multi-Level Cache Reads, Step by Step
The CPU will read addresses A, A, D in turn. Initially L1 holds B, L2 holds C, L3 holds B, C, D; A is only in RAM. Times are approximate.
A requested. Start with the fastest, smallest level: not in L1 (1 ns spent).
Not in L2 either: +3 ns.
Not in L3 either: +10 ns.
Fetched from RAM: +80 ns, total ≈ 94 ns. On the way, the data is copied into every level so the next request is fast.
A requested again: in L1 → hit, ≈ 1 ns. Reusing the same data soon after is fast: temporal locality.
D requested: not in L1 (1 ns).
Not in L2 (+3 ns).
Found in L3: +10 ns, total ≈ 14 ns; copied to L2 and L1. About 7× faster than going to RAM.
Three reads: 94 + 1 + 14 = 109 ns. Reading all from RAM would take 3 × 80 = 240 ns. Real caches evict the least recently used line when full; this example ignores space limits.
In L1? Yes → read, done In L2? Yes → copy to L1, read In L3? Yes → copy to L2 and L1, read Fetch from RAM → copy to L3, L2, L1, read
System Components
The Graphics Processing Unit (GPU)
A GPU is designed to run huge numbers of similar operations (e.g. the colors of millions of pixels) in parallel.
In the same package as the processor; shares system memory.
A separate card with its own processor and video memory (VRAM).
Gaming, video processing, scientific computing, AI.
Workload, VRAM, power draw, cooling, software support.
System Components
Display Connections
| Connector | Signal | Common use |
|---|---|---|
| HDMI | Digital video and audio | Monitors, TVs, projectors |
| DisplayPort | Digital video and audio | Computer monitors |
| USB-C | Video, data and power, depending on model | Laptops and mobile devices |
| VGA | Analog video | Older displays and projectors |
System Components
USB and Other Ports
| USB version | Max speed | Note |
|---|---|---|
| USB 2.0 | 480 Mbit/s | keyboard, mouse |
| USB 3.2 Gen 1 (formerly USB 3.0) | 5 Gbit/s | external drive |
| USB 3.2 Gen 2 | 10 Gbit/s | fast SSD |
| USB4 | 20 or 40 Gbit/s | USB-C; displays, docks |
| Thunderbolt 4 | 40 Gbit/s | USB-C; displays, docks |
Connector shape (A, C) and version (speed) are separate things: not every USB-C port supports 40 Gbit/s or video.
System Components
Sound Card
The microphone signal is measured thousands of times per second and turned into numbers (e.g. 44,100 samples/s).
The numbers are turned back into an electrical signal that drives the speaker.
Most motherboards include audio good enough for everyday use.
For recording quality, more inputs or professional use.
System Components
Case and Cooling
- Protection: shields components from physical damage.
- Airflow: cool air enters at the front, hot air leaves at the back/top.
- Form factor: determines which motherboard and power supply fit.
- Cable management: helps airflow and maintenance.
System Components
The Power Supply (PSU)
Converts alternating current (AC) from the mains into the direct current (DC) voltages the components use.
- Capacity (W): must cover total demand with a safety margin.
- Efficiency: higher means less waste heat.
- Connectors: motherboard, CPU, GPU and storage cables must match.
- Protection: safeguards against overcurrent and voltage surges.
Input Devices
Input Devices
Text, numbers and commands.
Pointing, selecting and moving.
Audio input.
Image and document input.
Axis, button and motion data.
Measures temperature, position, light or motion.
Input Devices
Keyboard
- Letter and number keys enter data.
- Function keys perform application-specific tasks.
- Ctrl, Alt and Shift combine with other keys to form shortcuts.
- Enter confirms; Backspace deletes the character left of the cursor, Delete the one to the right (or the selection).
Ctrl + C Copy Ctrl + V Paste Ctrl + Z Undo Alt + Tab Switch apps
Input Devices
Mice and Pointing Devices
Steps reported per inch of movement; higher is not always better.
How many times per second the position is sent (e.g. 1000 Hz = every 1 ms).
Selecting, context menus, scrolling and app commands.
Touchpad, stylus, trackball and touchscreen.
Output Devices
Output Devices
Displays text, images and video.
Puts a digital document on paper.
Deliver audio to the user.
Projects an image onto a large surface.
Produces output through vibration or force.
Can combine input and output in one device.
Output Devices
Classifying Input and Output Devices
The test is the direction of data flow: toward the computer is input, toward the user is output. Storage and network devices both read and write.
Output Devices
Monitors: Resolution and Size
The number of pixels horizontally and vertically.
1920 × 1080The diagonal, measured in inches.
24 inchesAt the same resolution, a smaller screen packs pixels more tightly.
The ratio of screen width to height.
16:9Output Devices
The Pixel Grid and Pixel Density
A screen is a grid of tiny square dots (pixels). PPI (pixels per inch):
diagonal pixels = √(1920² + 1080²)
≈ 2203
24 in → 2203 / 24 ≈ 91.8 PPI
15.6 in → 2203 / 15.6 ≈ 141.2 PPIThe same resolution looks denser and sharper on a smaller screen.
Output Devices
Monitors: Motion and Image
| Property | What it means |
|---|---|
| Refresh rate | How many times per second the screen redraws; measured in Hz. |
| Response time | How long a pixel takes to change from one state to another. |
| Brightness | Light output of the screen (cd/m²). |
| Color accuracy | How close displayed colors are to their target values. |
| Viewing angle | How well the image holds up when viewed from the side. |
Output Devices
Panel Technologies
Wide viewing angles and balanced colors.
High contrast and deep blacks.
Fast response; viewing angles and colors can be more limited.
Each pixel emits its own light; very high contrast.
Output Devices
How Do LCD and OLED Make Light?
IPS, VA and TN are all LCD types; they differ in how the liquid crystals are arranged. OLED has no backlight, so black is truly black.
Output Devices
Printers, Audio and Projectors
Common for color documents and photos.
Can be fast and economical for high-volume text printing.
Provide audio output over an analog or digital connection.
Chosen by brightness, resolution and throw distance.
Storage
Storage Devices
Storage devices keep data when the power is off. When you open and save a document, the data travels like this:
1. The user double-clicks report.docx; the mouse sends this event to the computer (input).
2. The operating system finds the program and document files in persistent storage (SSD).
3. The program and document are copied from the SSD into RAM: the CPU runs from RAM, not directly from the SSD.
4. The CPU fetches instructions from RAM into the cache and registers and executes them (fetch–decode–execute).
5. The result goes through the graphics card to the monitor; the user sees and edits the document (output).
6. On “Save”, the changes are written from RAM to the SSD. Unsaved changes are lost if the power fails.
Storage
HDD and SSD
| Property | HDD | SSD |
|---|---|---|
| Technology | Spinning magnetic platters | Flash memory |
| Speed | Lower | Higher |
| Shock resistance | More fragile because of moving parts | No moving parts |
| Cost per capacity | Usually lower | Usually higher |
| Common use | Archives and high capacity | Operating system and applications |
Storage
Inside an HDD and an SSD
- HDD: the head must move to the right track and the sector must rotate under it → access takes milliseconds.
- SSD: the controller reads from several flash chips in parallel → access takes microseconds.
Storage
NVMe vs. SATA SSDs
| Property | SATA SSD | NVMe SSD |
|---|---|---|
| Interface | SATA (the old hard-disk interface) | NVMe protocol over PCIe |
| Typical sequential read | about 550 MB/s (the SATA III limit) | several GB/s (depends on PCIe version and lane count) |
| Parallelism | A single command queue | Many parallel queues; low latency |
| Form factor | 2.5-inch case or M.2 | Mostly M.2 (U.2 in some servers) |
Storage · Step by step
How an HDD Reads a Sector
The platter spins thousands of times a minute (e.g. 7200 rpm). The sector to read (orange) and the head start in different places; access time has three parts.
1) Seek time: the arm moves the head to the track holding the target sector. It is mechanical, so it takes a few milliseconds (5 ms here).
2) Rotational latency: the head is on the right track, but the sector is not under it yet; we wait for the platter to turn. At 7200 rpm a full turn takes 8.3 ms, so the average wait (half a turn) is ≈ 4.2 ms.
3) Transfer: data is read as the sector passes under the head. 4 KB ÷ 150 MB/s ≈ 0.03 ms: the actual read is tiny compared with the waiting.
Total access ≈ 5 + 4.2 + 0.03 ≈ 9.2 ms. Almost all of it is mechanical waiting, which is why many small files are slow on an HDD (an SSD has no such wait).
Storage
Worked Example: How Long Does a 10 GB Copy Take?
- These are typical sequential read speeds; with many small files an HDD slows down far more (head movement).
- Copying means reading and writing: the time depends on the slower of the source and target devices and on the link between them (USB, network).
Storage
Portable and Archival Storage
Easy to carry; easy to lose or damage.
Common in cameras and mobile devices.
Used for distribution and some archiving.
Can offer high capacity for backups and moving data.
Gives several users central access to files.
Sync and sharing over the Internet.
System Design
Component Compatibility
Case, motherboard and card sizes must fit each other.
The power supply must have enough capacity and the right connectors.
The CPU socket, memory generation and chipset must be supported.
Ports, cables and protocol versions must be compatible.
The cooling system must handle the CPU and GPU load.
The operating system and drivers must support the hardware.
System Design
DDR5 and Current Standards
| Standard | What changed? | Watch out |
|---|---|---|
| DDR4 → DDR5 | Higher typical bandwidth and speed range (DDR5 modules start at higher speeds); on-module power management and two independent subchannels. | Physically different: a DDR4 module won't fit a DDR5 slot (or vice versa). |
| PCIe 3 → 4 → 5 | Bandwidth per lane roughly doubles with each generation. | Slots are backward compatible; the speed is set by the slower of the slot and the device. |
| USB 3.2 → USB4 | USB-C connector, 20/40 Gbit/s and Thunderbolt compatibility; USB4 Version 2.0 defines even higher speeds. | Not every USB-C port supports these speeds; check the port's specifications. |
| Wi-Fi 6 → 7 | 6 GHz band (with 6E), channels up to 320 MHz wide, multi-link operation (MLO). | Both the router and the device must support it. |
Speeds vary by generation, product and configuration; compare motherboard and device specifications before buying.
System Design
Choosing by Use Case
| Use | Priority components |
|---|---|
| Office and school | Balanced CPU, enough RAM, SSD, ergonomic display |
| Gaming | GPU, CPU, cooling, high-refresh-rate display |
| Content creation | Multi-core CPU, GPU, RAM, color accuracy, fast storage |
| Data analysis | RAM capacity, CPU/GPU and fast storage |
| Mobile use | Battery, weight, display, ports and energy efficiency |
Summary
Chapter Summary
- The CPU executes instructions; the motherboard connects the components.
- RAM is temporary working space; SSDs and HDDs provide persistent storage.
- The GPU handles parallel graphics and compute workloads.
- Input devices bring data into the system; output devices present results to the user.
- When choosing hardware, compatibility, power, cooling and purpose matter as much as performance.
Summary
Review Questions
- What is the key difference between RAM and an SSD?
- What kinds of compatibility does the motherboard determine?
- When would you choose an integrated GPU, and when a discrete one?
- Do refresh rate and response time measure the same thing?
- What should you look at when choosing a power supply?
- How do the priorities of an office PC and a gaming PC differ?
Summary
Exercises
- Compute the PPI of a 27-inch, 2560 × 1440 monitor.
- How many seconds does it take to copy an 8 GB video to an SSD at 500 MB/s?
- How many ms does each frame stay on screen at 144 Hz? Compare with 60 Hz.
- CPU 125 W, GPU 220 W, everything else 75 W. With a 30% margin, what power supply do you choose?
- Touchscreen, scanner, projector, headset with mic, SSD: input, output or both?
- In what order does data move between the SSD, RAM, cache and CPU when a document is opened and saved?
Answers
- √(2560² + 1440²) ≈ 2937; ÷ 27 ≈ 108.8 PPI.
- 8000 MB ÷ 500 MB/s = 16 s.
- 1000 ÷ 144 ≈ 6.9 ms; at 60 Hz ≈ 16.7 ms.
- 420 W × 1.3 ≈ 546 W → 550 W.
- Input: scanner; output: projector; both: touchscreen, headset with mic, SSD.
- SSD → RAM → cache → CPU; save: RAM → SSD.
Summary
References
- Patterson and Hennessy, Computer Organization and Design.
- Stallings, Computer Organization and Architecture.
- PCI-SIG, USB-IF, VESA and JEDEC technical standards.