GCSE Computer Science · public explanation

Virtual Memory

Understand why virtual memory is needed when RAM is full. Follow data moving between RAM and secondary storage and explain the effect on performance.

Read the explanation and worked examples, then choose your exam board to continue with activities and practice in your account.

OCR J277On the specificationOCR J277 1.2.1

Explain why virtual memory is needed and how data moves between RAM and secondary storage.

AQA 8525 (2027+)Not separately assessedAQA 8525 (2027+) 3.4.5

Virtual memory is not named in the current AQA subject content; prioritise RAM, ROM, cache and registers.

Start with the shortage in RAM

Virtual memory can support current work when the active programs and data cannot all fit in available RAM. The operating system uses a reserved area of secondary storage, such as an SSD or hard disk. This does not manufacture more physical RAM.

In a simplified example, a program needs 500 MB and only 200 MB of RAM is free. There is a 300 MB shortfall. If enough less-needed data is currently in RAM and enough secondary-storage space is available, moving that data out can free working space. The figures illustrate capacity, not the speed of a real computer.

Follow the same block out and back

Choose a block of data that is in RAM but is not currently needed. Moving it to the reserved secondary-storage area frees RAM for more urgent work. This movement is often called swapping out.

If the program needs that block again, it must return to RAM for processing. Another less-needed block may have to move out first to make room. The two locations are RAM and secondary storage, not ROM and cache.

EventLocation of block P
Before swapping outRAM
After swapping outReserved secondary-storage area
After swapping backRAM

Why more usable space can mean more waiting

Access to secondary storage is slower than access to RAM. Repeated transfers therefore take time and can leave the processor waiting for required data. Virtual memory may allow work to continue, but heavy use can make the application slower.

More RAM can reduce swapping by keeping more active work in RAM. A larger SSD increases storage capacity but does not by itself add RAM or speed up each transfer. Virtual memory is also not a saved document or a backup to rely on after shutdown.

Continue with your exam board

The course combines lesson videos, interactive activities, topic questions and original exam mocks. Sign in to use the learning tools and save your progress; your account’s course access applies.

Independent learning resources. Not endorsed by AQA or OCR. These public introductions complement the full course and the official specification.