# RAM vs ROM

> RAM (Random Access Memory) is fast, volatile memory that loses its contents when power is cut and holds the programs and data actively in use. ROM (Read-Only Memory) is non-volatile, keeping its contents without power, and stores the first instructions a device runs before an operating system loads. The key difference is volatility.

Canonical: https://devsunite.com/resources/core-subjects/operating-systems/ram-vs-rom
Last updated: 2026-11-22

Subject: Operating Systems · Category: Introduction · 3 min read

RAM (Random Access Memory) and ROM (Read-Only Memory) are both physical memory chips inside a computer, but they exist for opposite reasons: RAM is fast, temporary workspace, and ROM is permanent, unchanging storage for the instructions needed before anything else can run.

## What separates them

**RAM is volatile**: the instant power is cut, everything stored in it disappears. That's exactly why closing an application without saving loses your unsaved work, it existed only in RAM. In exchange for that volatility, RAM is extremely fast to read and write, fast enough to hold the actively running programs and the data they're working with right now.

**ROM is non-volatile**: it keeps its contents with no power at all, which is exactly why it's used to store the very first instructions a device runs, before an operating system has even loaded from disk into RAM. Traditionally, ROM chips were also literally unwritable after manufacturing (hence "read-only"), though modern devices mostly use variants like EEPROM or flash-based ROM that can be rewritten deliberately (a firmware update), just not casually the way RAM is constantly rewritten during normal operation.

## A concrete example

When you press the power button on a laptop, the very first code that runs lives in ROM (or a ROM-like flash chip), because at that instant nothing has been loaded into RAM yet, RAM itself is just empty, uninitialized memory the moment power turns on. That initial ROM code (part of the BIOS/UEFI firmware) knows how to find a storage device, load the operating system from it, and copy the OS into RAM. Only after that handoff does RAM become the place where your actual programs run. If ROM were volatile like RAM, a device would have nothing telling it what to do the moment it powered on, no bootstrap possible at all.

## Where this matters in real systems

Every computer, phone, and embedded device relies on this exact split. A smartphone's ROM (or ROM-like flash) holds its bootloader, the code that starts the boot process before Android or iOS itself is running; its RAM holds every app you currently have open, which is why force-closing an app frees up RAM, and why restarting the phone clears all of it. Game consoles historically used actual ROM cartridges specifically because game code needed to survive with zero power indefinitely, unlike RAM-based save data.

## What interviewers actually ask about RAM vs ROM

- **"What's the fundamental difference between RAM and ROM?"** RAM is volatile (loses data without power) and fast, used for actively running programs; ROM is non-volatile (keeps data without power), traditionally used to store fixed startup instructions.
- **"Why can't a computer boot directly from RAM?"** Because RAM has no contents at all the instant power turns on, there's nothing in it to execute; ROM holds the fixed bootstrap code that runs first and then loads the OS into RAM.
- **"Is ROM really unwritable?"** Not always anymore, traditional ROM was, but modern devices commonly use EEPROM or flash-based ROM, which can be deliberately rewritten (firmware updates) while still being non-volatile and much harder to casually overwrite than RAM.
- **"Why does RAM need to be fast if ROM doesn't?"** RAM holds actively running programs where speed directly affects performance; ROM's job is mostly to run once at boot, so its speed matters far less than its ability to reliably retain fixed instructions.

## Key takeaways

- RAM is volatile and fast, used for currently running programs and their working data.
- ROM is non-volatile, traditionally used for fixed startup instructions that must survive with no power.
- A device boots from ROM first, because RAM is empty until the OS is loaded into it.
- Modern ROM is often actually rewritable flash memory, just far more resistant to casual overwriting than RAM.

## Related

- [Previous: Types of Operating Systems](https://devsunite.com/resources/core-subjects/operating-systems/types-of-operating-systems)
- [Next: System Calls and APIs](https://devsunite.com/resources/core-subjects/operating-systems/system-calls-and-apis)
- [More in Introduction: What Is an Operating System?](https://devsunite.com/resources/core-subjects/operating-systems/what-is-operating-systems)
- [More in Introduction: Virtualization vs Containerization](https://devsunite.com/resources/core-subjects/operating-systems/virtualization-vs-containerization)
- [More in Introduction: BIOS vs UEFI](https://devsunite.com/resources/core-subjects/operating-systems/bios-vs-uefi)
- [More in Introduction: Important Terms in Operating Systems](https://devsunite.com/resources/core-subjects/operating-systems/important-terms-in-os)
- [More in Introduction: Monolithic Kernel vs Microkernel](https://devsunite.com/resources/core-subjects/operating-systems/monolithic-kernal-vs-microkernal)
- [More in Introduction: The Complete Booting Process](https://devsunite.com/resources/core-subjects/operating-systems/complete-booting-process)
- [All 205 OS interview questions](https://devsunite.com/resources/core-subjects/operating-systems)
