Random-access memory

From LinuxReviews
Jump to navigationJump to search

Random-access memory (RAM) is the system memory used to run software and temporarily store data and cache of more permanent storage-technologies like Solid State Drives and hard drives. The contents of the systems RAM disappear after a minute when power is turned off. It is generally a lot faster than permanent storage solutions.

HOWTO do a close-up inspection of your RAM

The handy tool dmidecode - found in a package with that name - can be used to inspect all kinds of incriminating information about a computer, including the RAM amount and type. It must be executed as root since it requests information from /sys/firmware/dmi and /dev/mem. The option -t memory will limits it's output to memory-related information:

dmidecode -t memory

This command will produce a summary of memory followed by details about each stick. The summary looks like this:

Handle 0x0027, DMI type 16, 23 bytes
Physical Memory Array
        Location: System Board Or Motherboard
        Use: System Memory
        Error Correction Type: None
        Maximum Capacity: 256 GB
        Error Information Handle: 0x0026
        Number Of Devices: 4

This will be followed by one, two or four or more listings - one for each memory stick - like this:

Handle 0x0037, DMI type 17, 40 bytes
Memory Device
        Array Handle: 0x0027
        Error Information Handle: 0x0036
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 8192 MB
        Form Factor: DIMM
        Set: None
        Locator: DIMM 1
        Bank Locator: P0 CHANNEL B
        Type: DDR4
        Type Detail: Synchronous Unbuffered (Unregistered)
        Speed: 2666 MT/s
        Manufacturer: Unknown
        Serial Number: 00000000
        Asset Tag: Not Specified
        Part Number: CMK32GX4M4A2666C16  
        Rank: 1
        Configured Memory Speed: 2666 MT/s
        Minimum Voltage: 1.2 V
        Maximum Voltage: 1.2 V
        Configured Voltage: 1.2 V

It is obviously possible to pipe the output to grep to get limited information like the memory's speed when setting up a new system:

dmidecode -t memory|grep Speed 

Getting amount of total and used memory

The command free will show this information. It will look like this:

              total        used        free      shared  buff/cache   available
Mem:       32913316    11395368     1357032      916988    20160916    19422248
Swap:      20971516      338688    20632828
Kemonomimi rabbit.svg
Note: The number shown as available is the number in free's output which actually refers to how much memory applications are free to use. Linux will by default cache anything because using caches are always much faster than direct IO. The number shown as "free" means unused while used refers to what applications are using - which may be somewhat confusing because "used"+"buff/cache" is the actual amount of memory the Linux kernel is using for something. However, the amount used for "buff/cache" will be dropped as soon as any applications requests more memory than what is "free".