What RAM is, and how it is fitted
Video 035 of 140 in Virtualization Foundations, in the unit “Memory: RAM, addresses and virtual memory”. 4:01, with English and Hindi audio.
A processor can calculate very fast, but it can only work on data that is already in memory. If memory is slow or badly fitted, a fast processor spends its time waiting. This article explains why a program's data must sit in RAM, how memory sticks called DIMMs connect to the processor through channels, and how to ask Ubuntu what memory is fitted in a server.
What you will learn
- RAM holds a running program's working data, and loses it when the power goes off.
- A DIMM is a memory stick, wired to the processor through channels.
- Channels and transfer rate set how much data memory can move each second.
- An empty channel wastes the memory speed you paid for.
Why a program's data must sit in RAM
A disk keeps data safely, even when the power is off. But a disk is far too slow for a processor to wait on. So a program's working data is copied into RAM, which stands for random access memory. In RAM, any byte can be reached in about the same time, and the processor reads and writes this working copy directly.
RAM is volatile. Its contents are lost when the power goes off, so anything that must survive a power cut stays on the disk.
How memory sticks reach the processor
- Memory chips store the bits, the ones and zeros from which all data is made.
- A DIMM is a small circuit board with several memory chips on it. It is simply a memory stick.
- The DIMM plugs into a memory slot on the server's main board.
- A channel is a group of wires that serves a set of slots.
- The memory controller, which sits inside the processor, sends every read and write down the channels.
The width and speed of those channels set how much data can move at once.
How channels and transfer rate set memory speed
A memory controller can run several channels at once. More channels let more data move in the same moment. Speed is written as a transfer rate. DDR4-3200 memory makes three thousand two hundred million transfers every second, which is written as 3200 MT/s, meaning megatransfers per second.
Each transfer carries eight bytes over one channel. Treat any speed you work out from these numbers as a best case, because a program does not always get it.
Note: An empty channel wastes the capacity and speed you paid for. Its wires sit idle, and the server runs below its best speed.
What goes wrong with memory, and how you notice it
- A channel left empty: its wires sit idle, so the server runs below its best speed.
- A failed DIMM: the server logs memory errors, or it will not start.
You would notice slow programs, memory errors in the system log, or a server that stops during start-up.
How to ask Ubuntu what memory is fitted
On Ubuntu, the dmidecode command reads the hardware record that the firmware keeps. It needs root rights, so it starts with sudo. It shows each memory slot, with its size and its type.
sudo dmidecode -t memoryThe kernel, which is the core of the operating system, sees memory as blocks. The lsmem command lists those blocks and the total memory the kernel can use.
lsmemTry it yourself
You need an Ubuntu machine and an account with sudo rights. You will see one block for each memory slot, then the memory blocks the kernel can use.
Ask the firmware record for the memory slots. The command needs root rights, so it starts with sudo.
sudo dmidecode -t memoryWhat you should see: One block for each memory slot, with its size, its type and its speed.
List the memory blocks the kernel can use, and the total online memory.
lsmemWhat you should see: The memory blocks as the kernel sees them, and the total online memory.
Terms
- RAM
- Random access memory, the fast working memory where a running program keeps the data it is using.
- DIMM
- A small circuit board carrying memory chips, which plugs into a slot on the server's main board.
- Channel
- A group of wires that serves a set of memory slots and carries data between them and the processor.
- Memory controller
- The part inside the processor that sends every memory read and write down the channels.
Check yourself
Why is a program's working data copied from the disk into RAM?
A disk is far too slow for a processor to wait on, while RAM lets the processor reach the data quickly.
What happens to the contents of RAM when the power goes off?
They are lost, because RAM is volatile. Anything that must survive a power cut has to stay on the disk.
Which command shows the memory slots recorded by the firmware?
The command sudo dmidecode -t memory, which needs root rights. It shows the size and type of each memory slot.
Previous: Why privilege matters for virtualization. Next: Bits, bytes, GB and GiB.