Unit 2: Memory and I/O Devices
Memory stores instructions and data as binary digits; I/O devices move information between the user and the machine. Every component in this unit is measured against a single organising idea, the memory hierarchy, which trades speed for cost and capacity.
- The bit basis: all storage reduces to the bit (binary digit, 0 or 1), the smallest unit a circuit can hold as two voltage states.
- The hierarchy: registers → cache → primary memory (RAM/ROM) → secondary storage → tertiary/archival. Speed and cost per byte fall as you descend; capacity rises.
- Volatility: volatile memory loses contents when power is removed (RAM); non-volatile memory retains them (ROM, HDD, SSD).
- Access: access is either random (any location in constant time, e.g. RAM) or sequential (read in order, e.g. tape).
- I/O direction: input devices feed data in (keyboard, mouse, scanner), output devices present results (LCD, printer, plotter); some are hybrid.
II. Memory: Foundations
What memory is and how its capacity is quantified.
A. Types
Memory is classified by role, volatility and proximity to the CPU.
- Primary (main) memory: directly addressable by the CPU, holds the running program and its data; RAM and ROM sit here.
- Secondary memory: non-volatile bulk storage not directly addressable by the CPU; data is copied to RAM before use — HDD, SSD, flash drives, optical disks.
- Cache memory: small, very fast SRAM between CPU and RAM, staged as L1, L2, L3, holding recently used data to cut access latency.
- Registers: the fastest storage, inside the CPU, holding operands during execution.
B. Units of memory
Capacity is counted in bits and bytes, scaled in powers of two.
- Bit and byte: 1 byte = 8 bits, enough to encode one character in ASCII.
- Nibble: 4 bits, half a byte.
- Standard multiples (binary):
1 KB (kilobyte) = 1024 bytes = 2^10 bytes
1 MB (megabyte) = 1024 KB = 2^20 bytes
1 GB (gigabyte) = 1024 MB = 2^30 bytes
1 TB (terabyte) = 1024 GB = 2^40 bytes
1 PB (petabyte) = 1024 TB = 2^50 bytes- Word: the natural unit the CPU processes at once, e.g. 32-bit or 64-bit, fixing register width and address range.
III. Primary Memory
The CPU's directly accessible working store, split into read/write and read-only halves.
A. RAM (Random Access Memory)
RAM is volatile primary memory that both stores and returns data at any address in equal time.
- DRAM (Dynamic RAM): stores each bit in a capacitor that leaks charge, so it needs periodic refreshing; cheaper and denser, used as main memory (DDR4, DDR5 modules).
- SRAM (Static RAM): stores each bit in a flip-flop of transistors, no refresh needed; faster and costlier, used for cache.
- Volatility: contents vanish on power loss, so RAM holds only the active session.
- Role: the OS, open applications and their data live here while running; more RAM allows more programs open without swapping to disk.
B. ROM (Read Only Memory)
ROM is non-volatile primary memory holding firmware that is written once and normally only read.
- Purpose: stores the bootstrap/BIOS that starts the machine and hardware startup routines.
- PROM: Programmable ROM, blank at manufacture, written once by the user with a device that burns fuses.
- EPROM: Erasable PROM, cleared by ultraviolet light through a quartz window, then rewritten.
- EEPROM: Electrically Erasable PROM, erased and rewritten byte by byte with electrical signals; the principle behind flash memory.
IV. Secondary Storage Devices
Non-volatile bulk storage for programs and files kept between sessions.
A. HDD (Hard Disk Drive)
An HDD stores data magnetically on rotating rigid platters.
- Mechanism: platters spin at 5400–7200 RPM; a read/write head on an actuator arm floats above the surface, flipping magnetic domains to write bits.
- Geometry: data is organised into concentric tracks, wedge-shaped sectors (typically 512 bytes or 4 KB), and vertically aligned cylinders.
- Performance: speed depends on rotational latency plus seek time (moving the head); mechanical motion makes it slower than solid-state.
- Trade-off: low cost per gigabyte and high capacity (multiple TB), but fragile to shock and slower to access.
B. Flash Drives
A flash drive is a compact non-volatile device using EEPROM-based flash memory with a USB interface.
- Principle: stores bits as trapped charge in floating-gate transistors; no moving parts.
- Form: the USB pen drive plugs directly into a USB port and is recognised as removable storage.
- Use: portable transfer of files, bootable OS media; capacities from a few GB to 1 TB+.
- Endurance: flash cells tolerate a finite number of write/erase cycles, so lifespan is write-limited.
C. Optical Disks: DVD
Optical disks store data as physical pits read by a laser; the DVD is the high-density successor to the CD.
- DVD (Digital Versatile Disc): reads pits with a red laser (~650 nm); a single-layer disc holds about 4.7 GB, dual-layer about 8.5 GB.
- Reading: a laser beam reflects off lands and scatters off pits along a spiral track; the reflection pattern is decoded into bits.
- Variants: DVD-ROM (read only, pressed), DVD-R (write once), DVD-RW (rewritable).
- Context: Blu-ray extends the idea with a blue laser (~405 nm) for ~25 GB per layer; optical media is sequential-leaning and now largely archival.
D. SSD (Solid State Drive)
An SSD is secondary storage built entirely from flash memory, replacing the mechanical HDD.
- No moving parts: data lives in NAND flash chips managed by a controller, so access is near-instant with no seek delay.
- Speed: far higher read/write throughput than HDD; NVMe SSDs over PCIe reach several GB/s versus SATA HDD's ~150 MB/s.
- Wear levelling: the controller spreads writes across cells to offset flash's limited erase cycles.
- Trade-off: faster, quieter, shock-resistant and power-efficient, but higher cost per gigabyte than HDD.
V. I/O Devices
Hardware that carries data between the user and the system, as input, output, or both.
A. Keyboard
The keyboard is the primary text input device, translating key presses into character codes.
- Working: pressing a key closes a circuit; the controller generates a scan code that the OS maps to a character.
- Layout: the QWERTY arrangement plus function, numeric and control keys.
- Types: membrane keyboards (rubber dome, quiet, cheap) versus mechanical keyboards (individual switches, tactile, durable).
B. Mouse
The mouse is a pointing device that converts hand movement into on-screen cursor motion.
- Optical mouse: an LED and image sensor track surface texture to sense movement.
- Buttons and wheel: left/right click select and open; the scroll wheel moves through documents.
- Metric: sensitivity is rated in DPI (dots per inch) — higher DPI moves the cursor further per unit of hand movement.
C. LCDs (Liquid Crystal Displays)
The LCD is the standard flat-panel output device for showing text and images.
- Principle: liquid crystals between polarising filters twist to block or pass backlight when voltage is applied, controlling each pixel.
- Colour: each pixel has red, green and blue sub-pixels; combining their intensities yields the full colour range.
- Metrics: resolution (e.g. 1920×1080), refresh rate in Hz, and backlight type (LED-backlit LCD is the common form).
D. Scanner
A scanner is an input device that converts a physical document or image into a digital file.
- Working: a moving light source illuminates the page; a CCD/CIS sensor captures reflected light row by row and digitises it.
- Resolution: measured in DPI; higher DPI captures finer detail.
- OCR: Optical Character Recognition software converts a scanned image of text into editable, searchable characters.
E. Plotter
A plotter is a specialised output device for large-format, precise line drawings.
- Purpose: produces engineering drawings, architectural plans and maps where accuracy of continuous lines matters.
- Pen plotter: moves a pen across paper along vector paths rather than printing dots.
- Distinction: draws continuous vector lines, unlike a printer's raster of dots, giving crisp technical diagrams.
F. Printer
A printer is an output device that produces a physical (hard) copy of digital documents.
- Impact printer: strikes an inked ribbon against paper, e.g. the dot-matrix printer forming characters from pins; noisy, low quality, but works with carbon copies.
- Non-impact printer: forms images without striking:
- Inkjet: sprays fine droplets of liquid ink; good colour, low device cost, higher ink cost.
- Laser: a laser charges a drum that attracts toner powder, fused onto paper by heat; fast, sharp text, economical for volume.
G. Latest I/O devices in market
Newer devices broaden input and output beyond the keyboard-and-screen model.
- Touchscreen: combines display and input, sensing finger position capacitively; standard on phones and tablets.
- 3D printer: an output device building solid objects layer by layer from plastic filament or resin.
- VR/AR headsets: stereoscopic displays with motion sensors for immersive output and gesture input.
- Voice assistants: microphone input with speech recognition and speaker output, e.g. smart speakers.
- Biometric scanners: fingerprint and face sensors for authentication input.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →