عجفت الغور

ram (computer memory)

Tags: computers

What Every Programmer Needs to Know About Memory:

  • https://lwn.net/Articles/250967/
  • Northbridge vs southbridge (circa 2007)
    • Northbridge is CPU and RAM
    • Southbridge is other IO. All PCI-E slots are in south bridge
    • Now different, , memory controller is directly on CPU
    • And PCIe slots are directly for CPU
    • Southbridge has trasnsitioned to the PCH (Platform Controller Hub on INtel) and Chipset on AMD
    • Primary M.2 NVME slot is now directly on the integrated northbridge, and PCH (wifi, sound cards, extra storage) now share a link back to the CPU
    • Northbridge is what gave us UMA. Now integrated memory bandiwdth gaves us NUMA

SRAM vs DRAM

  • SRAM is still alive and critical, which is used in CPU caches
    • Recent changes (3D v-cache) stacks layers of SRAM on top of the CPU die to increase cache size

    
  • DRAM still use like regular DRAM

Stack Smashing Protector

Memory Management

Garbage Collection

Linux Virtual Memory

  • Virtual memory range is divided into the kernel space part, a user space part, and a inaccessible part for catching null pointers

    • cat /proc/sys/vm/mmap_min_addr
  • Mode is the execution privileage (code in kernel mode vs code in user mode). Kernel mode can access user space, this is used to prevent bad accesses

  • Uniform memory space presented to process is considered the virtual process space, and this is how all process dumps are presented

  • When an app is loaded, all the referenced dynamic libraries are mapped to a virtual memory space

  • A memory dump is the process of taking all the contents of ram and writing them into a readible file

  • Process memory dump is the user space protion of the process space saved, but also your memory is not usually filled, your core dump is has everything outside of kernel space (user and null)

  • GDB commands

    • info shared -> gets dynamic libraries
    • maintenence info sections -> get memory regions
  • LLDB commands

    • image list -> gets dynamic libraries
    • image dump sections -> Get memory regions
  • Kernel panic has kernel memory dump only

  • Fiber bundle -> dumping individual processes together with the kernel memory dump

Data Centers

  • HeMem Talk Feb 27th 2024
    • Monitors memory access async - PEBS - processor event based sampling - supported in modern Intel
    • HeMem policy moves hot pages from slow memory to fast memory, and cold pages down from hot memory to cold memory
    • NVM specific becuase its using NVM counters, can be used with CXL by using the CXL specific counters
    • Maybe allow the application to specify where in memory it can be
    • Currently tools to monitor bandwidth are not super great
    • Linux nimble tiered memory

Memory Overlays

  • Old systems used to shift stuff in and out of memory as needed,

Links to this note