[转帖] 内存扫盲

https://www.cnblogs.com/jintianfree/archive/2010/03/16/1687540.html#3841218

快速补充关于内存的一些基础知识,主要是为了理解DPDK,没有涉及太深。

简介

RAM (random access memory) 随机存取存储器,随机存取是指存储单元的内容可按需要随意取出或存入,且存取的速度与存储单元的位置无关。

RAM分为SRAM(static random access memory)和DRAM(dynamic random access memory),

SRAM结构复杂,单位面积容量少,存取速度快;

DRAM结构简单,单位面积容量多,存储速度慢。

DRAM因为结构简单,存储的电荷会随着时间渐渐消失,因此需要有个再充电(refresh)的动作保持储存的数据。

SRAM适合做寄存器和CPU缓存。DRAM则适合做主存及其他硬件装置的缓存

主存(通常所说的内存)结构层次

主存DRAM由大至小,由上往下可做以下拆分:

channel > DIMM > rank > chip > bank > row / column

主存从channel到chip的对应关系

Chip往下拆分

Bank往下拆就是一个个的储存单元,横向为row,纵向为column。每个column下方有一个row buffer,用于缓存读出的数据。

channel

In the past, memory speeds were able to keep up with the processor‘ s requirements.However, when we reached the point where the processor‘ s ability to process data was accelerating faster than current memory technologies could support, memory became a major limitation in system performance. Simply put, memory speeds could no longer keep up with advances in processor speeds and data throughput. A new method to get more data to the processor in mainstream computers was needed – without relying solely on memory speed.

Intel and many system architects decided that the solution was to add a second channelof memory – called the "dual channel" memory layout.

A processor in a computer is like the engine of a car. A car needs gasoline to fuel its engine. Similarly, a computer processor needs memory storage to process its data. Data (in bits which are zeros and ones) must be stored in memory first, before being delivered to the processor. When more data can be delivered to the processor via memory at faster speeds, the processor can manipulate instructions and data more efficiently and ultimately, the requested task can be accomplished in less time.

To illustrate the difference between single- and dual-channel memory, let‘ s extend the analogy above. Data is filled into a funnel (memory); the funnel then "channels" the data through its pipe to the processor‘ s input: In this illustration, single-channel memory is like a funnel that feeds data to the processor engine through a single pipe. Data is transferred 64 bits at a time.

Dual-channel memory utilizes two funnels (and thus two pipes) to feed data to the processor, thereby being able to deliver up to twice the data of the single funnel. With two funnels or channels, data is transferred 128 bits at a time. The process works the same way when data is "emptied" from the processor by reversing the flow of data. To prevent the funnel from being over-filled with data or to reverse the flow of data through the funnel, there is a "traffic" controller shown as a valve on the funnel‘ s pipe. In computers, there is a special chip called the "Memory Controller" that handles all data transfers involving the memory modules and the processor.

The Memory Controller manages all movement of data between the processor and the memory modules. Data is sent to the Memory Controller (which is part of a computer motherboard‘ s "chipset"). The Memory Controller is like a traffic signal that regulates data transfer either to memory modules for storage, or to the processor for data manipulation or "crunching". Graphically, this architecture is pictured below:

Data moves through the funnel‘ s pipe in one direction at a time (just like a one-lane bridge that can be used in both directions, but only one car can cross it at a time). The memory controller acts like a traffic signal that directs the movement of data across the memory channel. For example, data arriving to the Memory Controller is first stored in the memory modules (2), then is re-read (3) and finally transferred to the processor (4). On a typical motherboard, these same components can be easily identified:

DIMM

DRAM芯片包装在存储器模块(memory module)中,它是插到主板的扩展槽上的。常见的包装是168个引脚的双列直插存储器模块(Dual inline memory module,DIMM),它以64位为块传送数据到存储控制器和从存储控制器传出数据。DIMM是在单列直插存储器模块(single inline memory module,SIMM)发展起来的,SIMM以32位为块传送数据。

rank

内存控制器只允许CPU每次只能与内存进行一组64bits的数据交换,这一个64bit的带宽就是一个rank,即1rank = 64bits。内存数据读写每次是64bits的一个数据宽度,ECC内存增加了8bit的校验位,因此ECC内存是72bits。

内存上的每个内存颗粒(chip),提供4bit/8bit的数据,提供4bit的芯片记作x4,提供8bit的芯片记作x8,为了组成一个rank,内存需要有16片x4的芯片或者8片x8的芯片(没有x4和x8的芯片混搭的情况)。所以,一条DIMM上至少有8颗内存颗粒,排列在DIMM的一面或两面上。标准的DIMM的每一面有足够的空间容纳第9颗芯片,第9颗芯片用来存储4bits或8bits的ECC.。

如果1根ECC DIMM的9颗芯片都位于DIMM的同一面,就叫做single-sided,如果9颗芯片分布在DIMM的两面,就叫做double-sided。

DIMM还被分为single-rank、double-rank、quad-rank(也就是我们在内存的lable上经常能看到的1R、2R、4R,4R的DIMM一般用在server上面)。

double-rank的每一个rank都可以独立的提供64bit的数据,DIMM需要有两个片选信号,选择使用哪个rank,选中的rank,数据会经过MUX输出,或经过MUX输入。同样quad-rank有四个rank,可以提供4组64bit的数据,需要四个片选信号选择使用哪个rank。

Channel是为了快,多个DIMM可以增大内存,多个rank是为了什么?目前我只查到了以下描述,尚不能确定。

Most companies prefer to use more chips, because this gives the DRAM more processing power and more areas in which to store data.As of 2011, there are four types of rank: single or one layer, dual or two layers, quad or four layers and octal or eight layers. The more layers, the more memory the company can fit onto a chip. Commonly, consumers only find single- or dual-layer memory in their computers, while powerful server computers make use of the quad- and octal-layer ranked memory chips.

原文链接:

  内存基础知识扫盲

参考资料:

圖解RAM結構與原理,系統記憶體的Channel、Chip與Bank

Intel Dual Channel DDR Memory Architecture

原文地址:https://www.cnblogs.com/jinanxiaolaohu/p/9824959.html

时间: 2024-09-27 15:24:47

[转帖] 内存扫盲的相关文章

内存扫盲

快速补充关于内存的一些基础知识,主要是为了理解DPDK,没有涉及太深. 简介 RAM (random access memory) 随机存取存储器,随机存取是指存储单元的内容可按需要随意取出或存入,且存取的速度与存储单元的位置无关. RAM分为SRAM(static random access memory)和DRAM(dynamic random access memory), SRAM结构复杂,单位面积容量少,存取速度快: DRAM结构简单,单位面积容量多,存储速度慢. DRAM因为结构简单

关键业务系统的JVM参数推荐(2018仲夏版) (强烈推荐 唯品会)

年更贴,因为两年里遇到的事情,一些想法变了.也补充了不少VJTools的内容,比如为伸手党们准备的jvm-options.sh. 在关键的业务系统里,除了继续追求技术人员最爱的高吞吐与低延时之外,系统的稳定性与排查问题的便捷性也很重要.这是本文的一个原则,后面也会一次又一次的强调. 前言1,资料 1. 学习开源项目的启动脚本是个不错的主意,比如ElasticSearch家的,Cassandra家的, 附送一篇解释它的文章. 2. VJTools的 jvm-options.sh,伸手党们最爱,根据

关键系统的JVM参数推荐

1. 性能篇 1.1 建议的性能参数 1. 取消偏向锁: -XX:-UseBiasedLocking JDK1.6开始默认打开的偏向锁,会尝试把锁赋给第一个访问它的线程,取消同步块上的synchronized原语.如果始终只有一条线程在访问它,就成功略过同步操作以获得性能提升. 但一旦有第二条线程访问这把锁,JVM就要撤销偏向锁恢复之前的状态,如果打开安全点日志,可以看到不少RevokeBiasd的纪录,像GC一样Stop The World的干活,虽然只是很短的停顿,但对于多线程并发的应用,取

hadoop快速扫盲帖,从零了解hadoop

1.MapReduce理论简介 1.1 MapReduce编程模型 MapReduce采用"分而治之"的思想,把对大规模数据集的操作,分发给一个主节点管理下的各个分节点共同完成,然后通过整合各个节点的中间结果,得到最终结果.简单地说,MapReduce就是"任务的分解与结果的汇总". 在Hadoop中,用于执行MapReduce任务的机器角色有两个:一个是JobTracker:另一个是TaskTracker,JobTracker是用于调度工作的,TaskTracke

【KEIL·单片机·扫盲贴】关于ARM单片机程序内存使用情况的细致讨论。

接触了两年多时间的单片机编程本人对关于单片机程序内存如何耗费的问题一直懵懵懂懂,直到在近日看到某篇有关于MDK MAP文件介绍的帖子后才有种醍醐灌顶的感觉,这里我将分享在此之上的观点与见解以供大家讨论学习. 大家都知道ARM单片机的内部存储空间极其匮乏无论是从Flash还是RAM上,每每给单片机机编程都有一种惜字如金的感觉,工程师们一般会在容量有限的情况下规范其编程习惯简化代码避免冗余,那么首先我们如何知道的程序下载到单片机上到底占用了多少Flash程序运行又会使用多少RAM? 首先上一张图:

(转)CreateThread与_beginthread,内存泄漏为何因(原帖排版有些不好 ,所以我稍微整理下)

在写c++代码时,一直牢记着一句话:决不应该调用CreateThread. 应该使用Visual   C++运行期库函数_beginthreadex.好像CreateThread函数就是老虎,既然这样为什么微软要开发这个函数呢? 不要用 CreateThread 创建线程.并用 CloseHandle 来关闭这个线程,因为这样会导致内存泄露,而应该用 _beginthread 来创建线程,_endthread 来销毁线程.其实,真正的原因并非如此. 因为CreateThread 后,线程终止运行

[转帖] 学习 Linux 大页的内存知识

一.在解释什么情况下需要开启大页和为啥需要开启大页前先了解下Linux下页的相关的知识:以下的内容是基于32位的系统,4K的内存页大小做出的计算1)目录表,用来存放页表的位置,共包含1024个目录entry,每个目录entry指向一个页表位置,每个目录entry,4b大小,目录表共4b*1024=4K大小2)页表,用来存放物理地址页的起始地址,每个页表entry也是4b大小,每个页表共1024个页表entry,因此一个页表的大小也是4K,共1024个页表,因此页表的最大大小是1024*4K=4M

[转帖]泡泡网的内存知识

如果您是一位求知欲很强的电脑爱好者,那么本文非常适合您,笔者特意搜集了大量官方技术文档,为大家献上内存和显存鲜为人知的奥秘-- http://www.pcpop.com/article/309766_all.shtml 近年来CPU(中央处理器)和GPU(图形处理器)的发展速度之快让人目不暇接,新产品的运算能力成倍提升,此时就对内存子系统提出了严峻的需求,因为CPU/GPU运算所需的数据和生成的数据都是来自于内存/显存,如果存储速度跟不上,那么就会浪费很多时间在数据等待上面,从而影响CPU/GP

[转帖]linux下的CPU、内存、IO、网络的压力测试

https://www.cnblogs.com/zhuochong/p/10185881.html 一.对CPU进行简单测试: 1.通过bc命令计算特别函数 例:计算圆周率 echo "scale=5000; 4*a(1)" | bc -l -q MATH LIBRARY        If bc is invoked with the -l option, a math library is preloaded and the default  scale  is  set  to