1.2.1 – Primary storage (Memory) 

A computer will store lots of information, this includes your photographs, messages, contacts or even the programs and apps we use on a daily basis. All of this data is in the form of binary bits – ones and zeroes. There are billions of them in a typical system and they all need to be stored somewhere. Without any storage your computer, phone or tablet would simply “forget” everything every time you turned the power off.

Computer storage is, sadly, not straightforward, there is not just one single type of storage or one place for data to be placed. In this section we look at the first place that a CPU will look for data and instructions – “primary storage” or RAM.

In this section:


RAM – it doesn’t look impressive but it is essential to the performance of a computer. Image credit : An-d, CC BY-SA 3.0 https://creativecommons.org/licenses/by-sa/3.0, via Wikimedia Commons

RAM – A Definition

Let us begin with a definition and break it down from there.

RAM is: Random Access Memory – A temporary area of storage for programs and data that are currently being used.

That’s fine as far as a definition goes, but what does it mean and why do we need RAM?

Remember back to our learning about the CPU. To summarise:

  • The CPU fetches, decodes and executes program instructions continuously
  • Program instructions are stored in RAM until the CPU requires them.

The last part is key – the CPU is expecting to be able to read the data and instructions it needs from RAM. This explains why every program, everything that we are currently working on, this very website right now this second, is stored in RAM. If your computer is using it, if you are using it – it is stored in RAM.

The RAM works in tandem with any Secondary Storage device a computer may have. When you tap an app on your phone, it is fetched from secondary storage (you will learn about this later) and copied in to RAM ready for the CPU to use and access. When you take a photograph on your phone, all the data is stored in RAM, processed by the CPU and then placed into secondary storage for later use.

RAM is a temporary working space – the equivalent of the desk you use in a classroom. Imagine that you are the CPU, the thing that gets work done, you need a space to do your work quickly and efficiently. Each lesson you fetch out your books and other things you need, lay them out on the desk and perform the tasks you have been asked to do. At the end of the lesson you clear everything away ready for the next person and task – this is very much the way in which RAM is used – when you close a program, it is removed from RAM to make space for the next task. Without a desk, things would be… difficult. Without RAM, your computer would be unimaginably slow.

Why is it called Random Access Memory?

The programs you use and the data they create are unpredictable. Think about it, one day you might copy 1000 lines of Wikipedia in to Word for your homework, the next you might actually write it yourself and produce 3 lines. This means we have no idea how much data each individual program will create.

To further complicate matters, no one can predict which programs you will use each time you pick up your phone or turn your computer on. You may use one single app, you may have 15 open at once. Again, this means we have no idea how much information a user may create.

Finally, it is not possible to know when each program will be needed. When might a user click from one application to another?

Consequently, computers require a form of storage which allows any part to be accessed at any time, in any order. Hence random access – we can access any part of RAM at any time we desire to retrieve or store any piece of data.


RAM has one significant disadvantage – it is volatile. In computing, volatility refers to how stable something is without power. If a component such as RAM is said to be volatile, then when you turn the power off whatever is stored there will be lost.

The fact that RAM is volatile (use this key word in your exam answers always) has two implications:

  1. Anything stored there will be erased if you turn the power off, shut down or restart your computer. The same is true even for a very short power cut.
  2. If a computer does not have any kind of secondary storage, then your computer cannot store or “remember” anything when the power is off.

This explains why it’s so depressing when a program crashes or if our computer randomly restarts for some reason. If this happens then we usually lose what we were working on. Why? Because whatever we work on is stored in RAM and until we click “save” which commits our work back to secondary storage, it is not safe! Anything stored in RAM runs the risk of being lost if there is a program crash or loss of power.

Consequently, you must surely ask the question “If RAM can’t store anything without power and it can so easily lose our work… why do we use it?!

Excellent question, I’m so glad you asked!

The answer is that RAM is fast in computing terms. As a ball park you can imagine that RAM runs between 1/2 and 3/4 the speed that the processor does. This means it’s fairly handy at keeping up with the demand from the CPU for instructions and data, ensuring the CPU doesn’t sit there idle, doing nothing whilst waiting for program instructions to arrive. 

Modern RAM is very fast. DDR 4 RAM is currently clocked at over 2Ghz, but even this cannot keep up completely with modern processors, but it’s “good enough” to give a huge performance advantage over accessing data from any form of secondary storage.

Uses of RAM

RAM is used to hold open, currently running programs and data. Remember the rule we learned previously? If you’re using it, then it’s in RAM. This means that anything you have open on a computer, anything you tap on your phone, any website you visit, video you watch and so forth are all stored in RAM.

Some examples:

  • Parts of the operating system (the software that controls everything in a computer system)
  • Any programs you are currently using, e.g. a web browser, word processor, music player, social media app
  • Any data you have not yet saved – for example, the work you have typed in to a new Word document.

When you open a program or tap on an app icon on your phone:

  • The program is copied from storage to RAM
  • Any data created whilst using the program is stored in RAM (things you type in for example)
  • When you close the program, any changes should be saved to secondary storage again
  • The area of RAM used by the program is then marked as empty or erased.

The need for RAM

​So we know that RAM is very fast, but not quite as fast as the CPU. But we still haven’t answered why we need it. The answer is simple: performance.

If we had computers with no RAM at all and just relied on fetching programs and data directly from secondary storage to the CPU as it needed them, they would be hideously slow.

I cannot begin to tell you how slow.

Even the most super charged modern SSD is, to a CPU, the equivalent of a one legged man with heart trouble trying to chase after Usain Bolt. He’d have time to go for his post race massage, have a nice cup of tea, do a few interviews and play a game or two of Rocket League before the second man crossed the line.

To get an idea of how bad performance would be without RAM, I often refer to this article:


and particularly this table (the guy that wrote the page actually took it from a particularly mind numbing book, saving you and I the pain of ever having to read it):

Comparison table showing the relative speeds of various computing components/operations when compared to a single CPU cycle.

There’s a lot to take in from that table but we only need to look at three things:

  • 1 CPU cycle – 1s
  • Main Memory Access (RAM) – 6 mins
  • Solid State I/O – 2-6 days

Lets not even bother looking at “rotational disk” which, to you and I, is more commonly known as a hard drive. Most computers now, and in the future will only, use an SSD.

So what does this mean? Well to understand the difference in speed, we pretend that one Fetch, Decode, Execute cycle takes only 1 second. If 1 CPU cycle takes 1 second, then to read some instructions or data from RAM takes the equivalent of 6 minutes.

Stop and think for a minute – if it took me 6 minutes to answer a question you asked in class you’d be bored wouldn’t you? This neatly explains exactly why we need cache inside a CPU.

More to the point, this perfectly illustrates why we need RAM so badly. Although it might take “6 minutes” to access RAM, the fastest storage we have today, a solid state drive, would take between 2 to 6 days.

6 days!

Now you should have a clear understanding of why, even though RAM is volatile, the trade off for fast access to instructions and data is worth it. If we didn’t have RAM, basically computers would be too slow to use.


I’d be surprised if you haven’t seen a screen like the one above, or at least one that’s very similar, so what is it?

This text and information is all output from something called the BIOS, which stands for Basic Input Output System. This is, as everything that runs on a computer is, software. It’s software that most people don’t even notice or pay any attention to (why would most people?) but it is the single most important piece of software in any computer. Without a BIOS, your computer would do absolutely nothing when you turn it on.

If we think about it, we’ve gone on and on about what software is and the fact that the CPU, from the moment you turn the power on, starts fetching, decoding and executing instructions. We also know that the CPU fetches these instructions from RAM, but when we turn the power off, because RAM is volatile, the contents is lost.

So, when we turn the power on, and RAM is empty… where does the CPU get the instructions from to start the computer up?! The answer, of course, is from the BIOS which is stored in a special kind of memory called ROM. BIOS has largely been replaced by UEFI these days which is far more intuitive and fully featured, however their purpose is still the same.

ROM stands for Read Only Memory. This means:

  • The contents can be looked at or copied by the system but NOT changed
  • You cannot “save” anything to ROM
  • It is non-volatile, meaning the contents of ROM is NOT lost when the power is turned off

Every computing device needs some form of ROM which will hold the software that makes that device work, without it there would be nothing for the CPU to do when the power is turned on. This software can be called:

  • BIOS (Basic Input Output System)
  • UEFI (Unified, Extensible Firmware Interface) – the new version of BIOS for computers
  • Firmware – any software which is designed to enable a device to turn on and handle the functions of that device

When a device is turned on, the contents of ROM will be copied to RAM and the CPU will know to look at a certain address in memory to find and execute its first instructions. Once the firmware/bios has done it’s job it can hand over control of the device to other software such as an operating system.

It is important to be really clear in your exam answers:

  • You need ROM to hold the software that makes a device work, such as BIOS or UEFI.
  • You cannot change the contents of ROM.

RAM and ROM – The difference

A really common exam question is to ask what the difference is between ROM and RAM. The answer is… everything! The only similarity between ROM and RAM is that they are both forms of storage.

When answering a question like this, it’s essential you do two things:

  • Use the word “whereas” in your answer. This will force you to structure your answer and ensure you address both components.
  • Do not shorten your answers or make presumptions. For example, don’t write “ROM is non volatile where as RAM isn’t.” You have to be explicit – “ROM is non volatile where as RAM is volatile.” See the difference?

To the point, then, what would you write in an exam for this question?

  1. RAM is volatile whereas ROM is non-volatile
  2. The contents of RAM is lost/cleared when the power is off, whereas the contents of ROM will be preserved/unchanged
  3. ROM is read only meaning it cannot be changed, whereas the contents of RAM can be changed
  4. RAM holds open, running programs such as the operating system, whereas ROM holds the code which the system needs to start up, such as the BIOS

That should sort you right out.


A desk, like RAM, is an example of a temporary working space. Imagine if your desk looked like the one in the picture above.

If you think of each item on the desk as a separate task, as we add new tasks (objects) to the desk, it gets more and more full. As it gets full, it takes us longer to find space for things or, worse, we have to re-arrange the contents of the desk to find a space to use. Eventually, as our desk is quite small, we will run out of space completely and no amount of moving or tidying will improve the situation.

Once the desk is totally full, to do something new we have to do the following:

  • Put something away
  • Make a space for the new task
  • Put the new task on the desk

This obviously takes time.

​How can you improve this situation?

Simple! Get a bigger desk! More space means more room to spread your tasks around and you can put more things on a larger desk. It’s fairly obvious isn’t it?

What on earth has this got to do with RAM?


The RAM in a computer is a fixed size. In most machines these days that’s a minimum of 4-8Gb of space, but 16-32Gb is becoming the standard for a reasonable PC. This sounds like a lot, but right now I have the following open on my laptop (so it’s in RAM):

  • Chrome
  • Outlook
  • File Explorer
  • Powerpoint

I am currently using 5.7GB of RAM and I’m not actually doing a great deal – none of those applications are particularly stressful on the machine I’m using. 

As you should see, then, it’s actually quite easy or feasible to run out of RAM. This is a real problem. If you haven’t read all of this page, scroll up and read about the speed difference between RAM and Secondary Storage.

When a computer runs out of memory, it will slow down significantly. Years ago when computers had 16mb (that’s megabytes not gigabytes) of RAM or so, computers ran out of space to store programs and data in RAM all the time. These days it’s less likely you will run out of memory but it still happens and the consequences are the same – massive slow down. Why is this?

The operating system doesn’t want to say no to you, so when you ask it to open another program that doesn’t fit into RAM, then it will start to use secondary storage as RAM to fulfil your request. This is called “Virtual Memory” and we will discuss it in more detail in the next section.

What we learn from this is simple:

  • The more RAM a system has, the more programs and data can be open at any one time without losing any performance or slowing the system down.
  • More RAM means you don’t need to use virtual memory, which is slow
  • Running out of RAM has a severe performance impact on a machine, so small amounts of RAM are a bad idea in most computers.

But be careful because…

  • You will NOT gain any performance increase if you were not running out of RAM in the first place. E.g. you had 16GB of RAM, only really used 8GB and then installed 32GB of RAM in your system, there would be no increase in performance.

Virtual Memory

Computers have a fixed amount of RAM and it used to be the case that when your computer ran out of memory, that was it. It literally wouldn’t let you do any more. This was clearly quite a barrier to people working with computers as programs and their data sets got larger and larger. Operating systems began to implement a system to get round this problem called “Virtual Memory” and it is a real compromise between convenience and performance (speed).

Secondary storage (i.e. a hard drive or solid state drive) is usually very, very large. Therefore, we can create a large file in secondary storage called a “swap file” which the operating system pretends is more RAM. When the main system RAM fills up, we can then start moving things out of RAM and in to the swap file to make room for new programs or more data. By doing this, we don’t stop the user doing more things when they have run out of memory.

The process works like this:

  1. Programs are opened and RAM fills up
  2. RAM is full
  3. The user opens a program or more data is created/loaded
  4. The operating system looks at the data in RAM, which is split into “pages” like a book.
  5. The pages that are either not being used at present or are being used the least are copied in to the swap file
  6. The new program/data can then move in to the space created in RAM.
  7. If pages from the swap file are needed, the operating system can again swap some other pages out and move these pages back in to RAM to be used.

The advantages of a swap file are:

  • The computer should continue to work when physical RAM is full (use the term “physical RAM” in your exam answers)
  • It enables the computer to work on far larger amounts of data without the user needing to install more physical RAM

The big disadvantage is:

  • It is SLOW because storage is far, far slower than physical RAM
  • It is also slow because it takes time to move pages from physical RAM to the swap file.