List CPU Caches and Their Sizes

This section describes how to use 'lscpu', 'lshw' and 'dmidecode' commands to list CPU caches and their sizes.

You can different Ubuntu commands to list CPU caches and their sizes, lscpu, lshw and dmidecode, as described below.

"lscpu" - Display CPU Caches - "lscpu" command displays information about the CPU and its caches. The following output shows 4 CPU caches.

herong$ lscpu

Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  2
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               69
Model name:          Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz
Stepping:            1
CPU MHz:             877.974
CPU max MHz:         2900.0000
CPU min MHz:         800.0000
BogoMIPS:            4988.41
Virtualisation:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            3072K
...

"lshw" - Display CPU Caches - "lshw" command displays hardware configurations including CPU caches. The following output shows multiple CPUs with 3 caches connected each CPU.

herong$ sudo lscpu

    description: Computer
    width: 64 bits
    capabilities: smp vsyscall32
  *-core
       description: Motherboard
       physical id: 0
     *-memory
          description: System memory
          physical id: 0
          size: 3622MiB
     *-cpu
          product: Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz
          vendor: Intel Corp.
          physical id: 1
          bus info: cpu@0
          size: 1940MHz
          capacity: 2900MHz
          width: 64 bits
    ...

"dmidecode" - Display CPU Caches - "dmidecode" command decodes DMI (Direct Media Interface), also called SMBIOS, information including CPU caches. The following output shows 3 CPU caches:

herong$ sudo dmidecode

# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
62 structures occupying 2490 bytes.
Table at 0xDCD3D000.

Handle 0x0000, DMI type 4, 42 bytes
Processor Information
...

Handle 0x0001, DMI type 7, 19 bytes
Cache Information
  Socket Designation: L1-Cache
  Configuration: Enabled, Not Socketed, Level 1
  Operational Mode: Write Back
  Location: Internal
  Installed Size: 32 kB
  ...

Handle 0x0002, DMI type 7, 19 bytes
Cache Information
  Socket Designation: L1-Cache
  Configuration: Enabled, Not Socketed, Level 1
  Operational Mode: Write Back
  Location: Internal
  Installed Size: 32 kB
  ...

Handle 0x0003, DMI type 7, 19 bytes
Cache Information
  Socket Designation: L2-Cache
  Configuration: Enabled, Not Socketed, Level 2
  Operational Mode: Write Back
  Location: Internal
  Installed Size: 256 kB
  ... 

Handle 0x0004, DMI type 7, 19 bytes
Cache Information
  Socket Designation: L3-Cache
  Configuration: Enabled, Not Socketed, Level 3
  Operational Mode: Write Back
  Location: Internal
  Installed Size: 3072 kB
  Maximum Size: 3072 kB
  ... 

...

Table of Contents

 About This Book

 Introduction to Ubuntu Systems

 GNOME - Desktop Interface and Environment

 Shell - The Command-Line Interpreter

 Process Management

Memory Management

 Layers of Memory and Access Speed

List CPU Caches and Their Sizes

 Virtual Memory vs. Physical Memory

 Buffer Memory and Cache Memory

 Verify Cache Memory with "cp" Command

 What Is Swap Space

 Virtual Memory Mapping and Page Table

 "ps -o rss,drs,trs,vsz,sz" - Process Status Options

 smem - Process Memory Usage Report

 pmap - Process Memory Map

 /proc/{id}/maps - Process Memory Map

 /proc/{id}/smaps - Process Memory Map Details

 earlyoom - A Simple OOM Killer

 Files and Directories

 APT (Advanced Package Tool)

 Network Connection on Ubuntu

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

 Administrative Tasks

 References

 Full Version in PDF/EPUB