Summary

This document explores the different types of computer memory, including RAM, ROM, cache, registers, and the memory hierarchy. It explains how memory stores and retrieves data, and discusses key concepts such as volatile vs non-volatile memory, memory addressing, and common memory problems.

Full Transcript

Week 4: Understanding Memory in Computers This week, we explore the different types of memory in computer systems and how they store and retrieve data. We'll learn about RAM, ROM, cache, registers, and memory hierarchy. What is Memory in Computing...

Week 4: Understanding Memory in Computers This week, we explore the different types of memory in computer systems and how they store and retrieve data. We'll learn about RAM, ROM, cache, registers, and memory hierarchy. What is Memory in Computing? Memory is the part of a computer that stores data and instructions, either temporarily or permanently. Memory vs Storage Memory (e.g., RAM) is fast and temporary, used for active tasks. Storage (e.g., SSD) is slower but permanent. Example: RAM = Whiteboard for writing notes during a class. Storage = Notebook where you keep those notes forever. Memory is wiped when the computer shuts down; storage remains intact. Types of Memory - RAM (Random Access Memory) - ROM (Read-Only Memory) - Cache Memory - Registers RAM – Random Access Memory RAM is volatile memory that temporarily stores the data and programs that are actively used. Example: When editing a photo, the image is in RAM. Once saved, it's stored in permanent storage like a hard drive. More RAM allows multitasking without slowing down. ROM – Read-Only Memory ROM is non-volatile memory that contains essential instructions for the computer to boot (startup). Example: When you turn on your computer, ROM runs a program (BIOS or UEFI) that starts your operating system. ROM data is written once and rarely changes. Cache Memory Cache stores copies of frequently accessed data for faster retrieval. It sits closer to the CPU than RAM. Example: If you open a large spreadsheet multiple times, cache helps the CPU access the required data more quickly. L1 cache is smallest and fastest; L3 is larger but slower. Registers Registers are ultra-fast memory components inside the CPU that store temporary results of operations. Example: When adding two numbers, the operands and result are stored in registers during the calculation. They are very small (a few bytes) but crucial for CPU speed. Memory Hierarchy Organized by speed and cost: Registers > Cache > RAM > Storage (SSD/HDD) Higher up = faster & more expensive. Volatile vs Non-Volatile Memory Volatile: needs power to retain data (RAM). Non-Volatile: keeps data without power (ROM, SSD). Primary vs Secondary Memory Primary: RAM, ROM — directly accessed by CPU. Secondary: HDD, SSD — long-term storage. Virtual Memory Virtual memory uses part of the hard drive as RAM when real RAM runs out. Example: When too many apps are open, your system may slow down. It is using storage as pretend-RAM (swap file or pagefile). It allows more applications to run but decreases performance. Memory Access Methods - Sequential Access (e.g. magnetic tape) - Direct Access (e.g. RAM, SSD) Binary Representation in Memory Data in memory is stored in binary — 0s and 1s. Each memory cell stores bits that represent characters, numbers, etc. Measuring Memory Memory is measured in bytes: - 1 KB = 1024 bytes - 1 MB = 1024 KB - 1 GB = 1024 MB Memory Addressing Every byte in RAM has a unique address so the CPU knows where to find or store data. Example: Imagine RAM as an apartment block. Each room (byte) has a number (address). CPU knocks on the door to fetch data. Addresses are used in hexadecimal format (e.g., 0x1A3F). Why is Memory Important? It directly impacts system speed and performance. More RAM = more apps open at once, faster computing. Memory in Mobile Devices Smartphones and tablets use similar memory principles with flash- based storage and optimized RAM usage. Example: A smartphone with 8 GB RAM can keep more apps running in the background than one with 4 GB. Flash memory used in phones combines speed and efficiency. Common Memory Problems - **Low RAM**: apps freeze or crash - **Memory leaks**: apps use more memory over time without releasing it - **Corrupt memory**: leads to random errors or crashes Example: If your system reboots randomly or freezes often, failing RAM might be the cause. Review & Activity Review key terms: RAM, ROM, cache, memory hierarchy, addressing. Activity: Label components on a memory pyramid.