Updated June 29, 2023
Introduction to Primary Memory
The primary memory of a computer can be categorized into three major types. viz., a. Main memory that holds instructions and data of the current program, b. Cache memory enhances the performance of the CPU by holding a copy of instructions/data stored in the main memory to save unwanted retrieval, c. Register memory that holds information required by arithmetic and logical unit of the CPU to execute the instructions.
While Cache memory and Register memory are embedded as part of the CPU, the main memory is an independent unit in a computer connected to the CPU by a data bus and memory bus. In this article, let’s analyze various types and subtypes of Primary memory in detail.
What is Primary Memory?
Primary memory refers to a set of memory units within the computer CPU that has direct access to, and it stores instruction and data needed for processing by the CPU. Primary memory stores the intermediate results and final results of the processing before it is stored in permanent storage. Some of this memory is volatile i.e. contents stored will get erased if power is switched off, and some of them are non-volatile i.e. contents cannot be erased.
A program has a set of instructions in a logical sequence, and it has to process the data using the instructions in the program and produce the result. Program and data are stored in the secondary storage i.e. External hard disks. Primary memory picks up the relevant portion of the memory called “page” and the related data. It stores them in the main memory, and the control unit of the CPU loads instruction after instruction and the corresponding data in the register memory for the CPU to process and produce a result.
Due to the main memory size limitation and multi-user environment, the operating system loads only the relevant page of the program and its data from secondary storage and keeps refreshing the main memory. The memory management aspect of the Operating system deals with moving the relevant pages of various programs into the available main memory and keeps refreshing as per the requirement.
Different Types of Primary Memory
Below are the Types mentioned :
1. Main Memory
The Main memory size is the largest compared to Cache Memory and Register memory, but the cost is the lowest among them. Main memory can be divided into two main types, viz., Random Access Memory (RAM), and Read-only Memory (ROM), and each of these is divided into further sub-types.
Random Access Memory
It is a volatile type of memory wherein it loses its contents when the power is switched off. The processor reads instructions/data from it and also writes into it. Data and instructions are loaded into RAM from the external hard disk, and processed data are stored back into the hard disk.
The data from RAM is read directly in random access mode using memory addresses irrespective of its length of 16/32/64 bits. Hence the data can be accessed from RAM faster than external hard disk, and the CPU normally takes 10 nanoseconds to read from RAM. This memory is costlier than RAM, so the size is restricted to 1 GB in most computers. Each and every location in RAM is uniquely identified by an address; hence, the processor refers to the instructions or data stored in it, and these addresses are stored in CPU registers during the runtime.
RAM has two subcategories:
a. Static Random Access Memory (SRAM): Transistors are used in this memory, and constant power flow is needed to keep it alive. Data remains static in this memory, and hence no refresh is needed at any point in time. It has a short read/write cycle, is smaller in size, is more expensive than dynamic RAM, and is faster in data retrieval and writes, and hence it is deployed in special applications like cache memory.
b. Dynamic Random Access Memory (DRAM): Capacitors are used in this type, and it tends to lose energy gradually over a period of time; hence the data is likely to be lost. A periodic refresh is required to retain the data. It is a high-density type, cheaper than SRAM but slower than it, larger in size, and used in main memory mostly.
Read-only Memory (ROM)
A non-volatile type of memory that continues to hold the contents even when the power is switched off. As per the name, contents can only be read from these memory locations and cannot be erased or rewritten. Contents like boot programs, firmware, and mathematical tables in scientific applications are stored during manufacturing and sold with pre-stored contents. These contents are used during the operation of the device, and they cannot be altered. In modern computers, Flash memory is used for storing BIOS, Firmware instead of ROM, as it enables easier version updating.
ROM has two subcategories:
a. Programmable ROM (PROM): The difference between normal ROM and PROM is that ROM is preloaded with contents when it is sold, whereas PROM is sold as a device with a blank memory, and the contents are stored in PROM using a device called PROM Programmer. ROM is pre-stored with proven and ready-to-use contents during manufacturing. In contrast, PROM allows flexibility and time to burn the data post-manufacture when the content becomes ready after verification.
b. Erasable Programmable ROM (EPROM): ROM, once programmed, can be erased and reprogrammed. The electrical signal can be used to erase the contents stored already. Such a PROM is known as EEPROM. Contents can be erased using UV rays also, and such devices are called UV EPROM. The process of erasing the data using an Electric signal is simpler than operating with UV rays.
2. Cache Memory
Frequently addressed Instructions and data are stored in an exclusive faster memory in the CPU to avoid wasting effort and time to bring it from slow main memory. Such storage is called Cache memory, and its size is in the range of 2KB to 64KB. The size of this memory is much smaller than the main memory, and the cost is higher than the main memory but lesser than the Resisters.
3. Register Memory
As part of the CPU, Registers are used to hold the memory addresses of the data, next instruction, and intermediate results during the program execution. It also acts as transit storage between the main memory and the Processor. It is the costliest of all the memory; size-wise, it is the smallest.
Primary memory plays a critical role in the execution of the program. Any improvements in memory operations will lead to faster execution of the program and, in turn, enhance business operation efficiency. Continuous improvisations keep on taking place in this area to meet the expectations of the Digital world.
This is a guide to Types of Primary Memory. Here we discuss an introduction to Types of Primary Memory, along with 3 different types explained in detail. You can also go through our other related articles to learn more –