Primary vs Secondary Memory | Auxiliary Storage Devices
A computer contains a hierarchy of memory devices for storing data. They vary in their capacity, speed and cost. Primary memory (also referred to as the main memory) is the memory that is directly accessed by the CPU to store and retrieve information. Secondary memory (also referred to as the external or auxiliary memory) is a storage device that is not accessible directly by the CPU and used as a permanent storage device that retains data even after the power is turned off.
What is Primary Memory?
Primary memory is the memory that is directly accessed by the CPU to store and retrieve information. Most of the time, primary memory is also referred to as the RAM (Random Access Memory). It is a volatile memory, which loses its data when the power is turned off. Primary memory is directly accessible by the CPU through the address and memory bus and it is constantly accessed by the CPU to get data and instructions. Furthermore, computers contain a ROM (Read Only Memory), which holds instructions that are executed often such as the startup program (BIOS). This is a non volatile memory that retains its data when the power is turned off. Since the main memory is accessed often, it needs to be faster. But they are smaller in size and also costly.
What is Secondary Memory?
Secondary memory is a storage device that is not accessible directly by the CPU and used as a permanent storage device that retains data even after power is turned off. CPU accesses these devices through an input/ output channel and data is first transferred in to the primary memory from the secondary memory before accessing. Usually, hard disk drives and optical storage devices (CDs, DVDs) are used as secondary storage devices in modern computers. In a secondary storage device, data are organized in to files and directories according to a file system. This also allows to associate additional information with data such as the access permissions, owner, last access time, etc. Furthermore, when the primary memory is filled up, secondary memory is used as a temporary storage for keeping least used data in the primary memory. Secondary memory devices are less costly and larger in size. But they have a large access time.
Difference between Primary and Secondary Memory
Primary memory is the memory that is directly accessed by the CPU to store and retrieve information, whereas the secondary memory is not accessible directly by the CPU. Primary memory is accessed using address and data buses by the CPU, while secondary memory is accessed using input/ output channels. Primary memory does not retain data when the power is turned off (volatile) while secondary memory retains data when the power is turned off (non-volatile). Furthermore, primary memory is very fast compared to the secondary memory and has a lower access time. But, primary memory devices are more costly compared to secondary memory devices. Due to this reason, usually a computer comprises of a smaller primary memory and a much larger secondary memory.