Primary storage

There are two types of storage -

  • primary storage - (memory)
  • secondary storage - (backing storage)

Memory

The most important thing about memory is that it is very fast to store data and retrieve data from it. 

RAM (Random Access Memory) is used for temporary storage of data and programs. It consists of a large number of store locations, each of which can store a (binary) number. Each store location is identified by a unique address.

RAM is volatile - the data is lost when power is switched off.

Example : When you are working on a spreadsheet, the program you are using and the spreadsheet data are both stored in RAM.

ROM (Read Only Memory) is used for storing permanent data. The numbers in the store locations cannot be altered.

ROM is non-volatile. The data is never lost.

Example : ROM is used for storing the programs that control  embedded systems. ROM may also store the first section of a program which boots a computer - this is the program which starts running as soon as you switch on a PC.

Registers

There are some special store locations in the CPU called registers which are used extensively when a program is being run.

Cache

RAM cache is a memory chip used to temporarily store data, and is used to improve the speed of a computer when running a program, because it can supply data to the CPU faster than normal RAM. It is used to store the most frequently used data when a program is run.

Eg. - when a loop in a program is executed, the data that is repeatedly used may be placed in cache memory.

Disc cache is an area of memory used for storing data when it is input from a disc. 

Eg. - recently accessed data from a disc may be temporarily stored in cache, because if it is needed again, it is faster to access it from cache than keep reading it from the disc.

A similar system is used when web pages are viewed. Recently viewed pages are stored temporarily in cache. A second viewing of the page (perhaps the 'Back' button has been clicked) would be loaded faster from cache than downloading the whole page again.