快速補充關於內存的一些基礎知識,主要是為了理解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.
原文鏈接:
參考資料:
