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 that enhances the performance of 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 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 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 has direct access to and it stores instruction and data needed for processing by CPU. Primary memory stores the intermediate results and final results of the processing before it is stored in the 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 and stores them in the main memory and control unit of the CPU loads instruction after instruction and the corresponding data in the register memory for CPU to process and produce a result.
Due to the main memory size limitation and multi-user environment, 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 size of Main memory is the largest when 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), 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 the memory 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 16/32/64 bits. Hence the data can be accessed from RAM at a faster rate than external hard disk and CPU normally takes 10 nanoseconds to read from RAM. This memory is costlier than RAM and hence the size is restricted to 1 GB in most of the computers. Each and every location in RAM is identified uniquely by an address and hence the instructions or data stored in it are referred by the processor 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, smaller in size, more expensive than dynamic RAM, and faster in data retrieval and write, 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 and 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, 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 it cannot be erased or rewritten. Contents like boot program, firmware, mathematical tables in scientific applications are stored during the manufacturing stage and sold with pre-stored contents. These contents are used during the operation of the device and it 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): 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 the proven and ready to use contents during manufacturing whereas 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 CPU to avoid waste 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 lower than the main memory and cost is higher than the main memory but lesser than the Resisters.
3. Register Memory
Registers as part of CPU, 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 and 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 –
- Types of Memory in Computer
- New Technologies of Computer
- Types of Computer Worms
- Types of Computer Cables