Computer memory is similar to the human brain. It is used to save data, information, or instructions. Computers accept the data, process that data, and give the desired output. It is capable of storing both input and output.
The main memory of a computer, also known as RAM (Random Access Memory), is a crucial component responsible for temporarily storing data and instructions that the CPU (Central Processing Unit) needs to access quickly during program execution. It serves as a workspace where the CPU can read and write data rapidly, enabling efficient processing of instructions.
Main memory is volatile, meaning its contents are lost when the computer is powered off. It consists of memory cells organized in a hierarchical structure, with each cell capable of storing a single binary digit (bit). These cells are grouped into bytes, which are the fundamental units of data storage in computers.
It is of two types:
RAM (Random Access Memory)
ROM (Read Only Memory)
RAM(Random Access Memory)
RAM is a type of volatile memory used in computers and electronic devices to temporarily store data and instructions that the CPU needs to access quickly during program execution. It allows for random access, meaning any memory location can be accessed directly, enabling efficient read and write operations. RAM is volatile, meaning its contents are lost when power is turned off. It comes in various forms such as SRAM and DRAM, each with its own characteristics and applications.
ROM(Read-Only Memory)
ROM is a type of non-volatile memory used in computers and electronic devices to store firmware, boot loaders, and other essential system software that must not be modified during normal operation. Unlike RAM, ROM is read-only, meaning its contents cannot be modified or overwritten. It retains data even when power is turned off. ROM is commonly used to store the BIOS (Basic Input/Output System) in computers, firmware in embedded systems, and other critical software components.
SRAM (Static Random Access Memory)
SRAM is a type of memory that uses bistable latching circuitry to store each bit. Unlike DRAM, which requires periodic refreshing to maintain data integrity, SRAM retains data as long as power is supplied. It offers faster access times and lower power consumption compared to DRAM, making it suitable for cache memory in CPUs and other high-performance applications. However, SRAM is more expensive and has lower storage density than DRAM.
DRAM (Dynamic Random Access Memory)
DRAM is a type of memory that stores each bit as an electrical charge in a capacitor within an integrated circuit. Unlike SRAM, DRAM requires periodic refreshing to maintain data integrity, which can lead to slower access times. However, DRAM offers higher storage density and lower cost per bit compared to SRAM, making it suitable for main memory in most computing devices, such as personal computers and mobile devices.
A static RAM's main components are flip-flops, which store binary data. The information stored in RAM chips is volatile, which means it will remain valid as long as the device is powered on.
Characteristics of a RAM chip:
A RAM chip is suited for communication with the CPU if it has one or more control inputs that choose the chip only when needed.
A bidirectional data bus is another typical feature that allows data to be transferred from memory to CPU during a read operation and from CPU to memory during a write operation.
The logic 1 and 0 signals are standard digital signals.
RAM chips come in a variety of sizes and are used based on the needs of the system.
The RAM chips are further classified into two modes, static and dynamic.
A ROM memory is used to store data and programs permanently in a computer system. ROM chips are available in a variety of sizes. The following block diagram represents a 128 * 8 ROM chip.
A ROM chip has a similar architecture as a RAM chip. However, there is a slight difference. While RAM can perform both read and write operations, a ROM can only perform read operations. In other words, the data bus operates in output mode only.
The 9-bit address lines in the ROM chip indicate any of the 512 bytes stored in it.
The value for chip select 1(CS1) and chip select 2(CS2) must be 0 or 1 for the proper functioning of the unit. If this is not the case, then the data bus is said to be in a high-impedance state.
Memory Address Map
The system designer must calculate the amount of memory required for a given application and assign it to RAM or ROM. The interconnection between the processor and the memory is established by knowing the size of memory required and the type of ROM and RAM chips available. The addressing of memory can be established using a table that specifies the memory address assigned to each chip. The table is called the Memory address map.
For example, 512 bytes RAM and 512 bytes ROM.
Address Bus
Component
Hexa Decimal Address
10
9
8
7
6
5
4
3
2
1
RAM 1
0000-007F
0
0
0
X
X
X
X
X
X
X
RAM 1
0080-007F
0
0
1
X
X
X
X
X
X
X
RAM 1
0100-017F
0
1
0
X
X
X
X
X
X
X
RAM 1
0180-01FF
0
1
1
X
X
X
X
X
X
X
ROM
0200-03FF
1
X
X
X
X
X
X
X
X
X
Memory Connection to CPU
The data and address buses are used to connect RAM and ROM chips to a CPU.
The low-order lines in the address bus choose the byte within the chips, while the other lines in the address bus select a particular chip through its chip select inputs.
Main memory is typically stored on integrated circuits (ICs) or chips located on the motherboard of a computer or electronic device. It consists of volatile memory modules such as DRAM or SRAM, which are directly accessible by the CPU for fast data retrieval and manipulation.
What are the main memory operations?
Main memory operations include reading data from memory, writing data to memory, and refreshing memory contents to maintain data integrity. These operations are essential for storing and accessing data during program execution and system operation.
What is RAM also called?
RAM (Random Access Memory) is also called primary memory or main memory. It serves as a temporary storage space for data and instructions that the CPU needs to access quickly during program execution. RAM is volatile, meaning its contents are lost when power is turned off.
Is ROM a real optical memory?
No, ROM (Read-Only Memory) is not a real optical memory. It is a type of non-volatile memory that stores data and instructions permanently, typically using electronic circuits or semiconductor technology. ROM retains its contents even when power is turned off and is commonly used for firmware and system software storage in computers and electronic devices.
Conclusion
In this article, we learned about the main memory. We learned that primary memory is known as the computer system's main memory. It is a computer's built-in memory; therefore, data from and to the main memory can be read and written very quickly. We also learned about RAM ROM chips, Memory Address Map, and Memory Connection to the CPU.
Check out our blog on Register in Computer to find out more about computer architecture.
Explore more!
You can use Code360 to practice various DSA questions asked in different interviews. It will help you master effective coding techniques, and you will also getinterview experiencesfrom people working in big companies.
Live masterclass
Master PowerBI using Netflix Data
by Ashwin Goyal, Product @ HRS Groups, Ex - Udaan, OYO