Skip to content
Learnearn.uk » IB Computer Science » RAM & ROM

RAM & ROM

RAM

Random Access Memory (RAM)

RAM is a type of very fast memory that is used to temporarily hold data about currently running programs. When you load any file from the hard drive there is a lag between the request and the data being sent, this would cause massive slow down of the CPU if data was constantly being requested from the hard drive. Instead a single request is sent to the hard drive when the program loads and the whole program is loaded in to RAM. The RAM is electronic memory and all the data is stored in flop flop circuits using electrical currents and transistors. This means that there is very little latency and there the computer loads the program much faster than if it wasn’t used. However because RAM data is stored electronically, RAM is volatile – once power is lost all data is lost as well.

ROM

Read Only Memory ( ROM)

Read only memory is mainly used in a PC to store the tiny mini operating system called the BIOS. The BIOS data is flashed to the ROM chip when the motherboard is made and does not change for it’s entire lifetime (hence the term Read Only). If you want to update the BIOS, you need to flash the ROM chip.

The BIOS is responsible for doing a system hardware check before the system starts to make sure all the connected devices are functioning. Once it has completed the check it boots up the operating system.

Cache Memory

Cache Memory

Cache memory is a small, high-speed type of memory located directly on or very close to the CPU. It stores frequently accessed data and instructions, allowing the processor to retrieve this information more quickly than if it had to access the main memory (RAM). Cache acts as a buffer between the CPU and RAM, helping to reduce the time it takes to access data and improving overall system performance.

Cache memory is typically built using SRAM (Static Random-Access Memory), which is faster but more expensive and power-hungry than DRAM (used in regular RAM). SRAM retains data as long as power is supplied and does not need to be refreshed like DRAM, making it ideal for cache.

SRAM vs DRAM

SRAM vs DRAM

SRAM (Static RAM):

  • Used in CPU cache (L1, L2, sometimes L3).

  • Made of flip-flop circuits (usually 6 transistors per bit).

  • Faster and more reliable.

  • Does not need refreshing – it holds data as long as it’s powered.

  • More expensive and takes up more space per bit.

  • Consumes more power.

DRAM (Dynamic RAM):

  • Used in main system memory (regular RAM sticks).

  • Stores each bit of data in a capacitor and a transistor.

  • Must be refreshed thousands of times per second to retain data.

  • Slower than SRAM but cheaper and more compact.

  • Allows for higher memory density (more data in smaller space).


How They Work Together

  1. CPU first checks the cache (SRAM) for data.

  2. If data isn’t in the cache (a cache miss), it retrieves it from main memory (DRAM).

  3. Once retrieved, the data is usually stored in the cache for quicker access next time.

This tiered memory hierarchy helps bridge the speed gap between the ultra-fast CPU and slower main memory, with SRAM as the high-speed layer and DRAM as the larger but slower backing layer.

 

Virtual Memory

Virtual Memory

Often when you open up multiple programs at the same time, or if you are completing memory intensive tasks ( such as modern 3D gaming) your computer will run out of available RAM. This would potentially cause the computer to crash as it would have to dump the contents of the RAM. Instead it creates an area of pretend RAM on your main hard disk, storing excess RAM instead of a page file. This stops the PC from crashing, but is much slower than RAM, so your PC will often slow down or become unresponsive when this is necessary.

 

Flash Memory

Flash Memory

Flash memory is a form of ROM that is commonly used in embedded devices such as washing machines or smart tvs.

Flash memory is:

  • Very reliable
  • Relatively Secure( because it requires the memory to be flashed, files can’t just be copied / edited in place.