16SSD Internal 1: Write and EraseDatawritten4KB4KB4KBin4KBPages4KB4KB4KBDataerasedin256KBBlocks64writablePages4KB4KB4KBin1erasableBlockTypicalNANDFlashPagesandBlocksDatawrite:datacannotbeoverwritten(erasebeforewriteDataunittowriteispage(4K-8k),andcanonlywriteinanerasedunitDataErase:toprepareanotherwriteinSsDDataunittoeraseis ablock (e.g.64-128pages)Flashmemorycanbeonlyprogrammedanderasedalimitednumberoftimes(P/Ecycles:e.g.SLCfor100,000,MLCfor10,000)
SSD Internal 1: Write and Erase 16 • Data write: data cannot be overwritten (erase before write) – Data unit to write is page (4K-8K), and can only write in an erased unit • Data Erase: to prepare another write in SSD – Data unit to erase is a block (e.g. 64-128 pages) – Flash memory can be only programmed and erased a limited number of times (P/E cycles: e.g. SLC for 100,000, MLC for 10,000)
17SSD Internal 2: Garbage CollectionAs some pages in block X are no longer needed (stale), GC does(1)validpagesaremovedtofreeblockY,(2)entireblockXiserasedTheprocessisexpensiveandcanbedoneasabackgroundprocessfreefreefreeABCAfreefreefreeDfreeDEXfreeoefreefreefreefreeHAfreefreeG2-D'freefreefreefreefreefreefreefreefreefreefreefreefreefreefreefreefreefreefreefreefreefreeE工ofreefreefreefreefreefreeHA'GfreefreefreefreefreefreeB'CD'1.Fourpages(A-D)arewritten2.Fournewpages(E-H)andfour3.lnordertowriteto the pagestoablock (x).Individualpagesreplacementpages(A'-D')arewithstaledata (A-D)all goodcanbe writtenat anytimeifpages(E-H&A-D')arereadandwrittentotheblock(X).Thethey are currently free (erased).originalA-Dpagesarenowwrittentoanewblock(Y)thenthe old block (X)is erased.Thisinvalid(stale)data,butcannotbeoverwrittenuntil thewholelaststepisgarbagecollection.blockis erased
SSD Internal 2: Garbage Collection 17 • As some pages in block X are no longer needed (stale), GC does – (1) valid pages are moved to free block Y, (2) entire block X is erased – The process is expensive and can be done as a background process
18SSD Internal 3: Write AmplificationMeasurement- (datawrittentotheflashmemory)/ (datawrittenbythehost)Worstcase- To write a 4K page to a 512K block, where only onepage is invalidGarbagecollectionwrites127validpages(508Kdata)toafreeblockandthenerasetheentireblockbefore writingthe4KpagetothenewblockWriteAmplification=512K/4K=128
SSD Internal 3: Write Amplification • Measurement – (data written to the flash memory) / (data written by the host) • Worst case – To write a 4K page to a 512K block, where only one page is invalid – Garbage collection writes 127 valid pages (508K data) to a free block, and then erase the entire block before writing the 4K page to the new block – Write Amplification = 512K / 4K = 128 18
19SSD Internal 4: Wear LevelingBalancethedemandandsupplybetweenusedandfreeblockpools(1)uponanupdaterequest,markthepageinvalid,(2)fetchanemptyblockfromfreepool,(3)updatethepageandreturntheblocktotheusedpoolFreeBlockPool(2)UpdateSSDController(3)UsedBlockPoolEmptyDataPageValidData Page(1)InvalidDataPage
SSD Internal 4: Wear Leveling 19 • Balance the demand and supply between used and free block pools – (1) upon an update request, mark the page invalid, (2) fetch an empty block from free pool, (3) update the page and return the block to the used pool