overview of flash and ssdsocw.snu.ac.kr/sites/default/files/note/week2_2.pdf · 2019. 9. 6. · new...

52
Overview of Flash and SSDs Jihong Kim Dept. of CSE, SNU Based on: M. Cornwell. Anatomy of a solid-state drive, ACM Queue 10(10), 2012.

Upload: others

Post on 02-Feb-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

  • Overview of Flash and SSDs

    Jihong KimDept. of CSE, SNU

    Based on: M. Cornwell. Anatomy of a solid-state drive, ACM Queue 10(10), 2012.

  • Solid-State Drives (SSDs)• A Solid-State Drive (SSD) is a data storage device that emulates a hard disk drive (HDD)

    • Block devices – Small fixed contiguous segments of bytes as the addressable unit– Logical addressing to access data and abstract the physical media

    • NAND Flash SSD’s are essentially arrays of flash memory devices which include a controller that electrically and mechanically emulate, and are software compatible with magnetic HDD’s

    2Overview of Flash and SSDs

  • SSD over HDD

    • No mechanical latency • Erase-before-overwrite

    – Out-place update• Asymmetric speed

    – Program: ~ 300 μs (100s of μs)– Read: ~ 25 μs (10s of μs)– Erase: ~ 2ms (a few ms)

    • Asymmetric unit– Program & Read: page– Erase: block

    • Limited lifetime

    Overview of Flash and SSDs3

  • Magnetic Disks

    Arm

    Head

    : the smallestunit that can beread/written(~ 512 bytes)

  • Key Components of SSDs

    • Three Components– Storage media– Controller– Host interface

    Overview of Flash and SSDs5

  • Storage Media: NAND Flash Memory

  • NAND Flash Memory

    • Flash memory is a non-volatile computer storage chip that can be electrically erased and reprogrammed

    7Overview of Flash and SSDs

  • Transistor as an Electrical Switch• Control gate voltage to turn on/off the switch.

    • Turn on Current flow

    • Turn off No current flow

    8

    XVgs < Vth

    G

    D S

    OFF

    Vgs > Vth

    G

    D S

    ON

  • Q: Switch는메모리는아니나… 만약… 만약….

    • 두개의상태를구분은하나 switch만으로는새로운데이터를쓸수가없다.

    • 해결책은?– 고정된Vth 값에대해Vgs를조정하니…. On/Off 구분이가능…

    – 만약Vth값을변화시킬수있으면… 같은Vgs에대해서… On/Off 구분이가능…

    – 만약다른상태가다른Vth값을가지도록할수있다면….

    9

  • Transistor as an Electrical Switch• Control gate voltage to turn on/off the switch.

    • Turn on Current flow State 1

    • Turn off No current flow State 0

    10

    XVgs < Vth

    G

    D S

    State “0”

    Vgs > Vth

    G

    D S

    State “1”Id

    s

    Vgs

    V1

    ※ When V1 is applied to gate,

    ⓐ: Vth is low High current State “1”

    ⓑ: Vth is high No current State “0”

  • Floating Gate Transistor

    • VT is shifted by injecting electrons into the floating gate;• It is shifted back by removing these electrons again.

    • CMOS compatible technology!

    Control gateFloating gate

    11Overview of Flash and SSDs

  • Channel Charge in Floating Gate Transistors

    Control gate

    Floating gate

    silicon

    Control gate

    Floating gate

    Unprogrammed (1) Programmed (0)

    To obtain the same channel charge, the programmed gate needs a higher control-gate voltage than the unprogrammed gate

    12Overview of Flash and SSDs

  • If we can control the Vth?– Increase Vth : Program– Decrease Vth : Erase– Determine Vth : Read

    13

    Vcg (>20V)

    e- e- e- e- e-e-0V 0V

    CG

    Vsub (0V)

    Program : FN tunneling

    Vcg (0V)

    float float

    CG

    Vsub (>20V)

    Erase : FN tunneling

    e- e- e- e- e-e-

    FG

  • Overview of Flash and SSDs

    NAND Operation – Overview

    Write & Read binary data to a NAND flash cell

    Data “0” Program Shift cell Vth to high Off state No current flow

    Data “1” Erase Shift cell Vth to low On State Current flow

    Vth

    # of

    cel

    ls

    OffOn

    Program

    Erase

    Read

    Read : Check the current flow

  • Layout of Block & Page

    Cells form blocks. Every block is an array.Every row is a page.

    Block

    page

    page

    page

    page

    Typically: 512 to 2048 cellsin a row (page)

    Typically: 32 to 128 rows (pages)

    Block erasure!!!!!!

    Read and write: A page as a unit.

    15Overview of Flash and SSDs

  • Organization of NAND Flash Memory

    Page 0

    Block 1

    Page 1

    Page m-1

    Block n-1Block 0

    chip

    Page 2

    Page 3

    16Overview of Flash and SSDs

  • NAND Flash Operations

    Source: Micron Technology, Inc.

    17Overview of Flash and SSDs

  • Write & Erase

    Overview of Flash and SSDs18

    1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 0Write (program)

    Page #0

    erase

    1 1 1 1 1 1 1 1

    1 1 1 1 1 1 1 1

    1 1 1 1 1 1 1 1

    1 1 1 1 1 1 1 1

    1 1 1 1 1 1 1 1

    1 1 1 1 1 1 1 1

    1 1 0 1 1 0 1 0Write (program)

    Page #1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1

    1 1 0 1 1 0 1 0

    1 1 1 1 1 1 1 11 1 1 1 1 1 1 1

    1 1 1 1 1 1 1 1

    1 1 1 1 1 1 1 1

    • Basic Unit– READ & WRITE: Page– EREASE: Block

    • Program changes bit from ‘1’ to ‘0’

  • / 36

    NAND Flash Memory is like Sheets of Paper

    19

    Writing

    Erasing

    FlashMan

    Illustrated by Jisung Park, Seoul National University

  • Writing Letters and Erasing Paper

    Out-Place UpdateErase before Program

    (vs. In-Place Update)

  • NAND Flash Memory: Grid Paper

    21

    0: Erased

    Flash Cell

    1: Programmed

  • NAND Flash Architecture

    22

    Flash Cell

    NAND Block

    NAND Page

  • NAND Flash Architecture (Cont’d)

    23

    Block #0 Block #1 Block #n

    NAND Chip

    Write unit: a page

    Erase unit: a block

  • Unique Properties of NAND Flash Memory

    • No support for in-place update• Erase-before-program operation

    • Asymmetric operation unit/performance

    • Limited Endurance• A block becomes unreliable after a certain number of

    program/erase (P/E) cycles

    NAND flash memory organization

  • Limited NAND Endurance

    04008001200160020002400260028003000

    “The maximum number of write and erase cyclesuntil a NAND cell is worn-out.”

  • 400800120016002000

    “Because thin paper wears downmore easily than thick paper.”

    Why is the NAND Endurance Decreased ?

    Thin paper

    Thick Paper

    Thin Paper

    Old technology

    AdvancedSemiconductor

    technology

  • Unique Properties of NAND Flash Memory

    • Asymmetric operation unit/performance

    • No support for in-place update• Erase-before-program operation

    • Limited Endurance• A block becomes unreliable after a certain number of

    program/erase (P/E) cycles

    NAND flash memory organization

  • / 36

    Like Papers …

    • Data stored in NAND flash FADES!!• Not ideal for storage systems

    • The data dissipation speed depends on• The number of program/erase cycles• Exposure to high temperatures• The number of reads• Process technology

    • Solution: • move data to a new location by a flash controller

    28

  • Data Retention

    1 Year at 30 °C?

  • Flash Controllerfor Performance and Reliability

  • Overview of Controller

    Overview of Flash and SSDs31

  • Flash Controller Diagram

    Parallelism / Interleavingfor Large Bandwidth

    SATA/SAS/PCIe….

    MorePowerfulCPU, Bigger SDRAM

    32Overview of Flash and SSDs

  • Flash Controller

    • Make imperfect NAND flash robust and reliable• Based on a single ASIC die

    – SRAM for firmware– DRAM for caching/buffering– Backup power system (e.g., batteries, capacitors) for

    sudden power off

    • Parallelism support for high performance• Various reliability functions for flash memory

    Overview of Flash and SSDs33

  • Error Correction

    • For all reads and writes from/to flash, error-correcting code is used.

    • BCH• LDPC• XOR/Scramblers

    Overview of Flash and SSDs34

  • SSD Software• Overcome the physical restrictions by employing system

    software called a flash translation layer (FTL)• Asymmetric operation unit/performance

    • No support for in-place update

    • Limited Endurance

    Applications

    File System

    Operating Systems

    NAND Flash Memory

    Flash Translation Layer (FTL)(Address mapping/Garbage Collection/

    Wear-leveling)

    Host System

    SSD

    Address mapping/Garbage collection

    Wear-leveling

    Flash controller

  • / 36

    NAND Flash-Based SSD

    Flash Translation Layer (FTL)

    36

    Host SystemHost system view:

    A flat storage Data block

    NAND Chip

    NAND Chip

    NAND Chip

    NAND Chip

    NAND Chip

    NAND Chip

    NAND Chip

    NAND Chip

    NAND Chip

    NAND Chip

    NAND Chip

    NAND Chip

    Channels

    …• Parallelism• Out-place-update• Limited lifetime

    Flash Translation Layer

  • / 36

    Address Translation

    37

    Write Request @ (logical) page 0Read Request @ (logical) page 0

    Page 10

    Host system

    Flash-based SSD

    logical page address (lpa)

    physical page address (ppa)

    0 10

    1 11

    2

    3

    4

    5

    … … Mapping table

    Page 11

    Page 12

    Page 13

    Page 14

    No In-Place-Update

    Write Request @ (logical) page 1

    Write Request @ (logical) page 0

    12

    Invalidation

  • / 36

    Garbage Collection

    38

    NAND Block Invalid page

    #InvalidPages: 6 #InvalidPages: 13 #InvalidPages: 2

    1) Choose a victim block2) Copy valid pages and update mappings3) Erase the victim block

  • / 36

    Wear Leveling

    39

    Data Migration Department

    Block 0 Block 1 Block 2 Block 3 Block 4 Block 5

    Invalid Hot (frequently updated) Cold (rarely updated)

    Skewed block usage!

    Block #2 3 4

    # of

    blo

    ck e

    rasu

    res

    0 1

    P/E Limitation

    Block #2 3 4

    # of

    blo

    ck e

    rasu

    res

    0 1

    P/E Limitation

    Short device lifetime!Hot-cold swapping

  • Controller Firmware

    • Flash Translation Layer (FTL)– Mapping blocks– Garbage Collection– Wear Leveling

    Overview of Flash and SSDs40

  • HOST

    SSD

    Flash Translation Layer

    • A software layer to make NAND flash emulate traditional block devices (or disks)

    41

    File System

    Block device driver

    FTL

    NAND Flash

    Flash I/F

    Block I/F

  • Flash Management Tasks

    • Essential – Address Translation

    • Avoid in-place update• Logical Block Address (LBA) -> Physical Block Address (PBA)

    – Garbage Collection • Reclaim invalid blocks -> Get new free blocks

    • Optimization– Wear Leveling

    • Erase all blocks evenly -> Extend life time

    NAND-Specific Operations 42

  • Out-place Update

    43

    A Valid pageFree page

    Write(‘A’, Block 0, Page 0)

    A

    Block 0 Block 1

    Overwrite X

    Page 0

    Page 1

    Page 2

    Page 3

    File Systems

  • Address Translation

    44

    A Valid pageFree page

    Read (‘A’, Block 0, Page 0)

    A

    Block 0 Block 1

    Page 0

    Page 1

    Page 2

    Page 3

    Address Translation Table

    File Systems

  • Garbage Collection

    • NAND flash memory does not allow in-place update

    45

    • NAND flash memory will be full of invalid data…

    A Valid pageFree page

    Write(‘A’, Block 0, Page 0) X4

    A

    Block 0 Free Block

    Overwrite X

    Page 0

    Page 1

    Page 2

    Page 3

    File Systems

    AAA Invalid page

  • Garbage Collection

    46

    Valid page

    Invalid page

    Free page

    Block 0 Block 1

    Page 0

    Page 1

    Page 2

    Page 3

    Block 2 Block 3

    • Gather valid data -> Erase invalid data

  • Flash Management Tasks

    • Essential – Address Translation

    • Avoid in-place update• Logical Block Address (LBA) -> Physical Block Address (PBA)

    – Garbage Collection • Reclaim invalid blocks -> Get new free blocks

    • Optimization– Wear Leveling

    • Erase all blocks evenly -> Extend life time

    NAND-Specific Operations 47

  • Spatial Locality of Write Request

    NAND-Specific Operations 48

    HOT

    HOT

  • Wearing of Flash Memory Blocks

    NAND-Specific Operations 49

    COLD COLD COLD COLD

    Valid page

    Invalid page

    Free page

    HOT HOT

    • Blocks with hot data are likely to be erased more

  • Wear Leveling

    • Erase evenly all blocks

    NAND-Specific Operations 50

  • New Interface for SSDs

    • TRIM/UNMAP– Let the SSD clear the LBA entries in the FTL, giving

    more fee space to use

    • Scatter Gather– Reduce command overhead of one command at a

    time

    – Gathers multiple noncontiguous requests into a single command, reducing overhead

    Overview of Flash and SSDs51

  • Host Interface

    Existing Interface: SATA, SAS

    New interface: PCIe

    Overview of Flash and SSDs���Jihong Kim�Dept. of CSE, SNUSolid-State Drives (SSDs)SSD over HDDMagnetic DisksKey Components of SSDs Storage Media: �NAND Flash MemoryNAND Flash MemoryTransistor as an Electrical SwitchQ: Switch는 메모리는 아니나… 만약… 만약….Transistor as an Electrical SwitchFloating Gate TransistorChannel Charge in Floating Gate TransistorsIf we can control the Vth?�NAND Operation – Overview Layout of Block & PageOrganization of NAND Flash MemoryNAND Flash OperationsWrite & EraseNAND Flash Memory is like Sheets of PaperWriting Letters and Erasing PaperNAND Flash Memory: Grid PaperNAND Flash ArchitectureNAND Flash Architecture (Cont’d)Unique Properties of NAND Flash MemoryLimited NAND EnduranceWhy is the NAND Endurance Decreased ?Unique Properties of NAND Flash MemoryLike Papers …Data RetentionFlash Controller�for Performance and ReliabilityOverview of ControllerFlash Controller DiagramFlash ControllerError CorrectionSSD SoftwareFlash Translation Layer (FTL)Address TranslationGarbage CollectionWear LevelingController FirmwareFlash Translation LayerFlash Management TasksOut-place UpdateAddress TranslationGarbage CollectionGarbage CollectionFlash Management TasksSpatial Locality of Write RequestWearing of Flash Memory BlocksWear LevelingNew Interface for SSDs �Host Interface