AQA Computer Science GCSE
Computer Systems - Memory
The CPU uses main memory to store data and instructions.
Main memory is memory which is accessible directly by the CPU but which isn't a register or cache. It includes RAM and ROM (but is mainly RAM), but not a hard drive (which isn't directly accessible).
The differences between RAM and ROM are important to know here.
Memory slides - slides from class
Memory - double page spread with detail
Main memory, and especially RAM, is the crucial element which has allowed the development of general purpose computers. It is flexible and can be used to hold either data or instructions as required. This is the memory part of the von Neumann architecture and is a major part of what makes modern computer systems able to do the jobs they need to do.
RAM in particular is important. More RAM is often considered useful and is a factor which can effect the performance of a computer.
More RAM - slides from class
BBC Bitesize has a useful set of pages about main memory and secondary storage that you might want to look at.
Registers - slides from class detailing how registers work
How RAM works
Every location in memory has an address (a memory address). A single memory address can hold one item of data or one instruction – both of which are, ultimately, stored as binary values.
The Control Unit in the CPU determines what data or instruction it needs next and where it is stored. It brings data and instructions into registers as required and then writes values back to memory addresses if needed.
Data isn't deleted from main memory whilst the program it is used in is still running. Bringing data in to the registers doesn't move it – it simply copies the value in.
Once data or instructions are no longer required by the CPU they are dumped in a cache. These are quicker areas of RAM closer to the CPU than main memory where data and instructions can be stored temporarily.
Booting a computer system – the main use of ROM
When you turn on a computer it boots.
Booting a computer loads the operating system and gets the machine in a position where it can be used. ROM is used to store the essential commands to start the process of loading the operating system into main memory. These are the same each time the system boots so they never need to be changed.
Once the OS begins to load into the computer's main RAM, it can begin to take care of its own loading procedures – this means that the OS can be updated or patched and not have to rely on an out of date version stored in ROM.