CS101 Computer Basic
In a computer, primary memory is used to store data and instructions that are currently in use. It is a combination of numerous small cells that can store one single bit each. A bit is a memory unit that is either 0 or 1. Actually, the computer could not understand the data or instructions written in English or any other language. It converts it into binary to store or process.
A computer has two types of memory – Primary memory and Secondary memory. Throughout the processing, the primary memory is used to hold the current data, instructions, and intermediate results. The processor or CPU directly accesses it through the system bus. So that data can be read from and written to primary memory instantly. It provides the processor fast access to the data and instructions. These memories are limited in size and made of integrated circuits (IC).
Primary Memory is a type of computer memory that can be directly accessed by the CPU. It holds the current data, instructions, and intermediate results during processing.
Primary memories are classified as below:
Difference between volatile and non-volatile memory
There are two types of primary memory – Non-Volatile and Volatile Memory. Non-volatile memory keeps its contents even when the computer is unpowered. Whereas volatile memory lost all its content when there is no power.
RAM (Random Access Memory)
DRAM (Dynamic Random Access Memory)
DRAM is made of transistors and capacitors. Each pair of capacitor and transistor is responsible for a single bit. A capacitor stores binary information in the form of electric charges. They take a significant amount of time to charge and tend to discharge with time. So DRAM needs to refresh frequently to prevent data loss. Also, these are comparatively slower than SRAM.
DRAM is more popular because of its tiny size and low power consumption. A single DRAM can have billions of memory cells.
SRAM (Static Random Access Memory)
SRAM uses latching circuits (flip-flops) that can store binary information. As compared to DRAM, SRAM uses more transistors. They use 6 transistors to store a single bit. It can hold the stored information till the power is on. However, they don’t need to be refreshed and work much faster, yet they are more expensive.
ROM (Read Only Memory)
ROM is an acronym for read-only memory. It is a kind of non-volatile memory that can only be read by the processor. The information stored in it is written at the time of manufacturing and not supposed to alter in the future, such as BIOS, firmware, etc.
However, ROM is not written very often, yet technologies are available to write or program them –
- PROM: Programmable Read Only Memory
- EPROM: Erasable Programmable Read Only Memory
- EEPROM: Electronically Erasable Programmable Read Only Memory
- UV EPROM: Ultra-Violet Erasable Programmable Read Only Memory
Cache memory is a small piece of high-speed memory often attached to the CPU. Cache memory serves as an extension for RAM and increases the CPU performance or throughput. Being made of SRAM and directly connected to the CPU, it is significantly much faster than RAM. It fetches the data and instructions from RAM that is to be used by the CPU in advance and makes it available when needed. Modern CPUs have more than one level of cache memory called L1, L2, and L3 cache.
CPU registers are small capacity memory units inside the CPU. These memory units operate at very high speed and are used for specific purposes. It accumulates the necessary and expected data during processing, such as the memory address of current and next instructions, operands of the current instruction, and so on. Each CPU has various CPU registers as per the requirement. Following is a list of commonly used CPU registers:
- Accumulator (AC),
- Memory Address Register (MAR),
- General Purpose Registers,
- Program Counter (PC),
- Memory Data Register (MDR),
- Index Register (IR),
- Memory Buffer Register (MBR), etc.