MJay

Studying cache 본문

Cloud Computing/AI

Studying cache

MJSon 2019. 3. 31. 17:30

RAM & FLASH

Dynamic RAM and FLASH both are memory devices ; these use silicon transistors in contrast to magnetic hard drives.

What differs these two is :

Internal structure of the memory
Storage capacity
How long it can hold the data without a refresh ?
Cost vs performance

DRAM

Volatile memory , used for active cpu interactions ( ACTIVE memory)

DRAM is the primary memory which does most of the process work and suppplies the data to CPU (of course it reads/writes back to permanent memory – FLASH as and when required)

In general, it uses one transistor and a capacitor to store a bit. Additionally it needs refreshing circuit to keep periodically refreshing the exiting value of the capacitor. Both transistor and capacitor are fabricated on same substrate most of the times.

DRAM also has sensing ckt to determine the bit state (sensing of data also causes capacitor to lose the charge, hence again refreshing comes in place !!)

Due to its minimalistic structure, it provides greater memory density at relatively faster speeds

Faster , Leakier and Expensive memory

FLASH

Non Volatile Memory (NVM).

Used as a permanent storage (secondary storage)

Slower, Less expensive

It is the permanent memory portion of computer or external ssd which can retain/hold the data when the power is down

Internal structures are of type NAND/NOR cells

While DRAM provides the flexibility to read/write in bits (Bit line and Word Line) , FLASH forces you to erase the data in entire block of word even if few bits are to be erased

SPEED & COST

SRAM > DRAM > FLASH

Always CPU, DRAM FLASH works together; Let’s say CPU started a computation, it does at a faster rate which requires data to be written or read from memory. It essentially needs a faster companion to achieve performance. So it communicates with RAM (DRAM – I am not adding SRAM cache topic here to simplify). In the back ground DRAM communicates with permanent memory to serve cpu as required. Before the power goes of necessary information to be saved is transferred to permanent memory from RAM and when the computer first wakes up basic boot up data gets pushed to RAM automatically.


What is cache

from https://en.wikipedia.org/wiki/cache_(computing)

In computing, a cache (/kæʃ/ kash,[1] or /ˈkeɪʃ/ kaysh in AuE[2]) is a hardware or software component that stores data so that future requests for that data can be served faster; the data stored in a cache might be the result of an earlier computation or a copy of data stored elsewhere. A cache hit occurs when the requested data can be found in a cache, while a cache miss occurs when it cannot. Cache hits are served by reading data from the cache, which is faster than recomputing a result or reading from a slower data store; thus, the more requests that can be served from the cache, the faster the system performs.

To be cost-effective and to enable efficient use of data, caches must be relatively small. Nevertheless, caches have proven themselves in many areas of computing, because typical computer applications access data with a high degree of locality of reference. Such access patterns exhibit temporal locality, where data is requested that has been recently requested already, and spatial locality, where data is requested that is stored physically close to data that has already been requested.