Memory and registers both increase processor’s working speed. Processor’s speed can be enhanced by increasing the registers in CPU or by using registers of high bit capacity. Similarly, by increasing the actual main memory of the computer can cause CPU to process fast. Memory is usually called as Random-Access Memory or primary memory.
Although both memory and register are used to increase processor’s speed, but both have differences in their actual working. Register holds the program that is being processed by the CPU whereas the main memory/RAM holds the data or instructions that are required by the CPU for execution of the program.
The complete definition and details of both memory and registers is given below:
Computer memory is a kind of computer storage space/device that stores the data temporarily. It can be categorized in two types:
- Primary/Main Memory and
- Secondary/Permanent Memory
Main Memory is placed inside the CPU and is usually called as RAM or Main Memory. It is also called as volatile memory or temporary storage. Volatile memory is a kind of memory whose contents are wiped off when the power supply to the system is powered off. Or in other words, its contents are only available if the power of system is turned on and whenever the supply is off, the contents no longer remain there, until or unless they are explicitly stored in external or internal secondary storage. CPU takes less time in retrieving the data from the RAM as compared to secondary storage or permanent memory.
RAM stores the data that has to be used by the CPU during execution of a program. If the data that has to be used by the CPU for the execution of the program is not present in the RAM, it is fetched from the Secondary memory into the RAM. When the data is fetched from Secondary memory into the RAM/primary memory, it remains there until the new data replaces it or the power supply is powered off.
As main memory is packed inside the computer it is also called as internal memory. Being placed closer to the processor/CPU is the actual reason that it takes less time to send the data/instructions from the main/primary memory to the CPU for execution of a program as compared to secondary memory.
Now-a-days main memory or RAM may range from 1GB to 16GB of storage. As much the storage of the primary memory/RAM will be, processing speed of processor/CPU will increase accordingly.
Secondary memory is a type of hardware device that stores the data permanently. It is also called as non-volatile memory. Non-volatile means that the contents of secondary memory are not lost if the electricity supply is lost.
Secondary memory actually can be categorized as internal and external Secondary storage. Internal secondary storage is usually called as hard drive or ROM (Read Only Memory). External secondary storage may include USB flash drive, CD (Compact Disk).
Now-a-days, the capacity of secondary storage may range from several Giga-Bytes (GBs) to Tera-Bytes (TBs).
Fetching of data from secondary storage to CPU for the processing takes more time than retrieving data from main memory. Hence usually the execution of the programs that require data from internal or external secondary storage devices slows down the processing. Secondary memory never holds the data being processed. It only stores data and when that data stored is required for execution of any program, it is fetched into the main memory.
ROM has many other types as well. Some ROMs are programmed by the manufacturer and the programmed data cannot be deleted or altered as it contains some permanent instructions/programs for the system such as booting of the system etc. Other types of ROM are re-programmable which means their data can be altered or deleted or rewritten through electronic or magnetic ways.
You may like to read this:
- Difference between DDR2 and DDR3 Memory
- Difference between SRAM and DRAM
- Difference between stack and heap
Registers are storage area elements that are built inside the CPU and keep holding the data temporarily. Registers only hold the program/instructions that are being executed by the processor/CPU. Data/instructions of the register are directly accessible by the CPU/processor. Retrieval of data from registers is faster as compared to main memory and therefore registers are used to increase the speed of the processor. CPU decodes the instructions/program and executes them at the rate of more than one operation per CPU/processor cycle.
Unlike main memory, registers are controllable. User of the computer may store or retrieve the information/data from the registers.
A register is measured in terms of bit. For example, a CPU can have registers of sizes 16-bits, 32-bits or 64-bits. Greater the bit capacity of CPU, greater will be the speed of CPU processing.
There are several types of registers. Some of the registers are described as follows:
Data Register (DR):
Data register has a capacity of 16-bits. It keeps holding the operands on which operations are needed to be performed.
Address Register (AR):
Address register has the capacity of 12-bits. It keeps holding the address of a memory location.
Accumulator Register (AC):
Accumulator Register is 16-bit register. It collects the results of CPU operation that are produced after processing.
Instruction Register (IR):
It is also a 16-bit register. It keeps holding the current instruction that is being processed or executed by the processor.
Program Counter Register (PC):
Program counter register is a 12-bit register. It keeps holding the address of the next instruction that is to be fetched and executed by the processor.
|Definition||It holds the instructions/program that is being executed by the processor.||It holds the data/instructions that are required by the processor/CPU for execution of a program.|
|Speed of fetching of data||The data from the CPU is fetched more quickly as compared to memory.||Fetching of data from memory takes more time as compared to registers.|
|Location||Registers are placed inside the processor of the computer.||Main Memory is located outside the CPU but is closer to it.|
|Measurement||Registers are measured in bits.||Memory capacity is measured in kilo-bytes (KBs) or giga-bytes (GBs)|
|Capacity||CPU can have register capacity of 16-bits, 32-bits or 64-bits built inside of it that also determines its speed.||Memory now-a-days may range from Giga-bytes (GBs) to Kilo-bytes (KBs).|
|Types/Examples||Data Register (DR)
Address Register (AR)
Accumulator Register (AC)
Instruction Register (IR)
Program Counter Register (PC)
|Main memory or RAM of the computer.|
|Data holding||Registers are small storage elements. Therefore they hold less data as compared to memory.||Memory has more storage capacity than register, therefore it can hold more data as compared to registers.|
|Control of the User||Registers are controllable. User may store or retrieve data or information from registers.||Memory is completely uncontrollable.|
|Access rate of CPU||CPU executes more than one instruction from register in one CPU/processor cycle.||Rate of data retrieval by the CPU from memory is slower as compared to registers.|
In short words, Registers keeps holding the instructions that is being processed by the CPU/processor while main memory/RAM keeps holding the data/instructions that are required by CPU/processor. Fetching of data from the register is faster as compared to fetching data from RAM. Registers can hold less data at a time as compared to RAM. CPU operates on the contents of the registers more than once in 1 CPU/processor cycle. While retrieval of data from the RAM is slower.