Purpose of RAM and ROM
Purpose of RAM
Random Access Memory (hereinafter referred to as RAM) is a necessary part of a computer. In the processing cycle (fetch, decode, execute cycle), the CPU (central processing unit) pulls data from the RAM to process, then it sends it back to be stored.
Beyond GCSE Information
Different RAM types have different speeds, and this can affect performance in certain situations. DDR3 usually runs at 1333MHz, whilst DDR4’s stock maximum clock speed is 2133MHz. You can also overclock RAM, to allow your processor to access data stored on it faster.
RAM is volatile, meaning that it loses its data once it is no longer being powered. Once you turn off your computer, the RAM loses all its data. This means, everything that was open is lost.
However, if the RAM loses its data, how can we boot up a computer again? The CPU will have no data to utilize to boot up. This is where ROM comes in.
Purpose of ROM
Read-Only Memory (hereinafter referred to as ROM) is another necessary part of a computer. Usually, motherboards are equipped with a small amount of read-only memory, that is non-volatile. This means it keeps all of its data once powered off.
Every motherboard is supplied with a ROM chip. This contains the bootstrap; this is the very first instructions for the computer to start. This means it checks that the hardware is present and functioning correctly, and loads the the 'Basic Input/Output System' (the BIOS). The software that is contained on the ROM chip is called firmware. This tells the computer how to turn on, and load things into RAM, ready for the CPU to process.
Read-Only Memory can also be utilized in embedded systems to hold the program data. Additionally, on older games consoles, such as the Sega Megadrive, catridges contain a ROM chip that has program data, and tells the system how to boot.
The need for virtual memory
A computer has to load relevent information into the RAM to be able to process that data. Most modern machines are equipped with 2GB and upwards of RAM. Some programs require more RAM than what is available to the CPU (either due to lack of RAM, or it is being utilized by another program), yet these applications run perfectly fine. This is where 'virtual memory' comes into play.
Virtual memory (also sometimes known a pagefile, or a swapfile) is a setting that is enabled by default on most operating systems. It allows the computer to use secondary storage (in this case, your hard drive or SSD) as a backup RAM location, if the primary storage (your RAM) becomes full. This means your programs can continue to run, without crashing.
Application processes cannot run from the secondary storage, they have to be moved back to the primary storage (your RAM). So, as a process isn’t running, it is pushed out of the RAM and into the virtual memory location. Then, when a process is required to run, it is pushed back into the RAM, and another process is pushed out.
The benefits of this, is that the pagefile allows the computer to continue operating, even in the event that the RAM is filled. However, a drawback is that virtual memory is much slower than RAM, meaning that any applications that require fast fetching of data from RAM will be severely impacted.
Flash memory, and what it is
Flash memory is a solid state, non-volatile storage medium. It can be electrically erased and reprogrammed with data. Flash memory is becoming more and more widespread, with it being exclusively found on a motherboard to contain the bootstrap, used for mobile phones as an alternative to a traditional hard disk drive, used in Solid State Drives (or SSDs) as a faster storage medium, and finally in some games consoles to store game data.
More information about the benefits and drawbacks of solid state as a medium can be found in topic 1.3 Storage.
Beyond GCSE Information
EEPROM (electrically erasable programmable read-only memory) is used on ROM chips, as a way of permanently storing data (for instance, a motherboards boot sequence, or on old games console cartridges). However, NAND flash is used in USB flash drives, as a way of storing data.