The main difference between register and main memory is that a register is a small and fast storage inside the CPU that holds data temporarily while the main memory is a storage component in the computer that stores data and programs currently used by the CPU.
A register is a high-speed memory location in the CPU. It allows the CPU to store data temporarily for processing. The number of available registers can change from the computer to computer. The total number of registers helps to increase the performance of the CPU. On the other hand, the main memory is also called the Random Access Memory (RAM). It holds data and programs that are currently running. The main memory is located outside the CPU. In brief, registers are faster than the main memory.
Key Areas Covered
Main Memory, RAM, Register
What is Register
Register is a small and fast storage unit. Registers are at the top of the memory hierarchy. The CPU stores data temporarily in these memory locations. Registers allow the CPU to store and transfer data from one component to another. The size of a register depends on the computer architecture. Each register receives information, holds them temporary and sends them to the required location as instructed by the CPU.
There are multiple registers in the CPU. They perform different functionalities. Some common registers are as follows.
Program Counter (PC) – Holds the address of the next instruction to be fetched and executed. After fetching the instruction, the value of the PC increases, and it points to the next instruction.
Instruction Register (IR) – Holds the current instruction that is being executed.
Memory Address Register (MAR) – Holds the address of the active memory location. When the CPU requires reading or writing from the memory, the required address is stored in MAR.
Memory Buffer Register (MBR) – Holds the content of the memory location read from or written to the memory.
Stack Pointer Register (SPR) – Used to manage the stack and store the values on top of the stack.
Accumulator Register (AX) – Used to store intermediate arithmetic and logical results.
Data register (DR) – Holds numerical data values such as integer, floating point values etc.
What is Main Memory
The main memory (or the primary memory) is the Random Access Memory (RAM). Usually, the programs are stored in secondary memory devices such as hard disk. It requires more time for the CPU to access secondary storage. Therefore, programs are placed in the main memory at the time of execution. This makes the computation speed faster. The capacity of the main memory is a considerable factor in determining the performance of the computer. When the main memory is high, the performance is also high.
There are two types of main memory as SRAM and DRAM. SRAM stands for Static RAM. It uses bistable latching circuit or flip flop to store data. It is expensive and much faster. DRAM stands for Dynamic RAM. It uses a capacitor within an integrated circuit to store data and requires periodical refresh cycles to retain data because of the leakage current due to the capacitor. DRAM is not fast and expensive as SRAM.
Moreover, SDRAM is a type of DRAM. It stands for Synchronize DRAM. DRAM operates asynchronously with the system clock. SDRAM operates synchronously with the system clock. Therefore, the SDRAM is faster than DRAM.
Difference Between Register and Main Memory
Register is a small amount of fast storage which is a quickly accessible location available to a computer’s CPU. Main memory is a form of computer data storage that stores data and machine code currently being used.
When comparing the speed, registers are faster than the main memory.
Registers are located inside the CPU while the main memory is located outside the CPU.
A register stores data temporarily and sends them to the required location as directed by the CPU. In contrast, the main memory stores the data and programs currently executed by the CPU.
There are various types of registers that perform various functionalities. Program counter, instruction register, data register, accumulator register are few examples. In contrast, main memory is divided into two main types called SRAM and DRAM.
Both register and main memory are volatile. They require a continuous flow of power to hold the data. The difference between register and main memory is that a register is a small and fast storage inside the CPU that holds data temporarily while the main memory is a storage component in the computer that stores data and programs currently used by the CPU.
1. “Registers CPU i386” By Bruce Shorty at Czech Wikipedia – Transferred from cs.wikipedia to Commons by Sevela.p using CommonsHelper (Public Domain) via Commons Wikimedia
2. “A pile of RAM” by Blake Patterson (CC BY 2.0) via Flickr