Flash WhitePaper Final

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

WHITE PAPER

FLASH TYPE AND USE CASES

Scope

The purpose of this white paper is to highlight the different kinds of flash storage, provide awareness of
flash operation, describe the advantages/disadvantages of each flash type, and their use in different
environments.

Background
Flash memory is a solid state, non-volatile, computer storage medium that can be electrically erased and
reprogrammed. Flash memory differs from typical spinning platter Hard Disk Drives (HDDs), in that flash
does not have mechanical reliability limitations and read/seek latencies that HDDs typically face. This is
due to the fact that flash is a solid state medium that does not rely on mechanical technology to
operate. This makes Solid-State Drives (SSD) attractive when considering speed, noise, power
consumption, and reliability.

Differences between NAND and NOR Flash


There are two kinds of flash memory, NOR-type flash and NAND-type flash, which differ in the way the
internal memory cells are connected as well as the interface for reading and writing data. The memory
cells of NOR flash are connected in parallel, whereas the connections of NAND flash are in serial. The
theory of operation is beyond the scope of this white paper, but the critical difference is NOR flash
allows random-access reading of the drive, while NAND flash allows page access only.

Reading from NOR flash is similar to reading from random-access memory (RAM), and because of this,
most microprocessors can use NOR flash memory as execute in place (XIP) memory. This means
programs stored in NOR flash can be executed directly from the drive without needing to be copied into
RAM first. This makes NOR flash ideal for code based storage and read only applications, but NOR is
hindered by smaller capacities, cost effectiveness, and slow write/erase speeds. NAND flash on the
other hand, offers extremely high cell densities and high capacity, combined with fast write and erase
rates. For these reasons, NAND-type flash is the choice for mobile computing and enterprise products.
For the remainder of this paper, any mention of “flash” will refer to NAND Flash.
What is NAND Flash?
NAND memory stores information or data to discrete locations or “blocks” within the flash device. Each
block consists of a number of pages (typically 32, 64, or 128). The number of pages and their size differ
from one manufacturer to the next, but typical block sizes are as follows:

 32 pages of 512 bytes for a single block size of 16 kB


 64 pages of 2,048 bytes for a single block size of 128 kB
 64 pages of 4,096 bytes for a single block size of 256 kB
 128 pages of 4,096 bytes for a single block size of 512 kB

Data is written to individual pages. If the data to be written is larger than a single page, pages within a
single block are written to until the block is full. In operation, flash does not constantly write to the
same block, rather, data is distributed over many blocks to prevent any single block from being
continuously worn. This concept is called wear leveling and will be covered in another section.

Although reading and writing to flash is performed on a page basis, erasure can ONLY BE PERFORMED
ON A BLOCK BASIS. This last distinction is important as it lays the foundation to NAND flash’s critical
drawback; it has a limited number of Program/Erase cycles (P/E cycles). This means there is a finite
number of times data can be written to the flash, after which, the drive will not function correctly.

Figure 1 Page Writes vs. Block Erase

Assume each page of memory within the block holds 16kb worth of data. It does not matter if 1kb of
data or 16kb is written to the page, the flash will erase the entire block and use the entire 16kb per page
for data. If only 1kb is written to the page, essentially 15kb of space on that page is “wasted”. This is
detrimental due to the fact that every flash is limited in the number of Program/Erase cycles it can
undergo. One P/E cycle translates into 1 Program (page level) and 1 Erasure (block level). Because of
this, the frequency of writes to the drive plays a large part in the number of P/E cycles consumed, and
directly impacts the life of the flash. If you had the option of writing ten files of 5kb in size, or one file
that was 50kb in size, it would be better to write the single 50kb file. In both cases, a total of 50kB has
been written to flash, but more P/E cycles would be consumed in the first case. This is why many flash
file systems will compile data in a buffer/cache, instead of continually writing small chunks of data.
Types of NAND Flash
There are primarily three kinds of NAND flash: Single-level cell (SLC), multilevel cell (MLC), and triple-
level cell (TLC). As with any technology, there are trade-offs between them. SLC, MLC, and TLC flash
NAND flash storage are designed to store 1, 2, or 3 bits in one cell, respectively. Multi-level Cell (MLC)
flash is the most common flash type, and is often found in consumer-grade products such as cameras,
phones, and USB thumb drives. The main appeal of MLC flash is its low price point, but it suffers from
higher wear rates and lower write performance when compared to Single-level Cell (SLC) flash. SLC has
the lowest capacity per given cell size, but its write speed and durability are better. SLC flash is used for
applications where data is written often, such as server database applications, where cost is typically
less important than disk lifetime. MLC has become the dominant NAND flash storage system because it
provides twice the capacity of SLC, and is significantly cheaper. The tradeoff is cell lifetime, but MLC is
sufficient for many applications including enterprise storage environments. TLC is at the other end of
the spectrum with higher capacity but an even shorter lifetime. It currently targets consumer
applications where capacity trumps storage lifetime. It is good for applications where reads, not writes,
dominate the majority of activity. A variant of MLC, called pseudo-SLC (pSLC), comes close to SLC’s
speed and durability while providing a lower price point.

SLC flash uses a single cell to store one bit of data, whereas MLC memory is more complex, and can
interpret four digital states within a single cell. This makes MLC denser for a given area, which makes it
cheaper to produce, but it also wears out faster. For the sake of comparison, MLC flash might have
around 10,000 P/E cycles, where SLC would have around 100,000 cycles or 10 times that of MLC. It is
this reason that MLC is typically found in consumer-grade products, whereas SLC is more suited for
enterprise-grade environments. We will dive deeper into the use cases in the next section.

NAND Flash Use Cases


MLC and SLC tend to find themselves used for different applications, with price-per-gigabyte largely
being the determining factor. Although MLC and SLC are the primary flash type, there are nuances
within each category (ie. eMLC, pseudo SLC, TLC, etc).
The advantages/disadvantages of various flash types are outlined in the following table:

Type of Flash Pro's Con's Uses

• Has the longest lifespan and • The most expensive type of NAND • Industrial use and workloads that
charge cycles over any other type flash on the market require heavy read/write cycles
of flash such as servers.
SLC • Occassionally only available in
(Single Level • More reliable due to smaller smaller capacities
Cell) room for read/write error

• Can operate in a broader


temperature range.

MLC • Relatively inexpensive • Not as durable and reliable as • Everyday consumer use, PC's,
(Multi Level SLC or enterprise grade solid state enthusiasts
Cell) • More reliable than TLC flash drives

 Cheaper alternative than SLC  Does not match SLC flash in  Industrial use and workloads
eMLC for use in enterprise grade Solid performance. that require heavy read/write
(enterpise State Drives cycles such as servers
grade Multi
Level Cell)  Has better performance and
endurance over standard MLC

 Cheapest to manufacture which • Blocks will survive considerably • Low grade computing products
TLC (Triple
in turn leads to cheaper to market less read/write cycles compared such as netbooks
Level Cell)
SSDs. to MLC/SLC

Flash Wear and Wear Leveling


The reliability and performance of the flash is not only dictated by the type of flash and
frequency/amount of data written, but also HOW the data is written to flash. The Flash File System
(FFS), sometimes referred to as a flash controller, carries out this function. The FFS dictates where and
how data is mapped to the drive, and also performs error corrections on the drive to ensure data does
not become corrupted.

All flash memory suffers from wear, which occurs because programming/erasing a memory cell applies a
voltage to the cell. Each time voltage is applied, a charge is trapped within the cell’s dielectric and
causes a permanent shift in the cells characteristic and performance. If data is continuously written to
the same block, it would eventually wear out and no longer be capable of storing data. It is for this
reason that data is distributed over many blocks, which is known as wear leveling.

Without wear leveling, the underlying flash controller must permanently assign data writes or “logical
block addresses (LBAs)” from the Operating System to the physical addresses of the flash memory.
Under such a system, data will be written to the same location over and over again. For this to occur,
the block must first be read, erased, modified, and re-written to the same location. This approach is
very time-consuming and frequently written locations will wear out quickly, while other locations will
not be used at all. Once a few blocks reach the end of their life, the device itself will no longer be able to
operate correctly. Although each FFS handles flash wear differently, there are two basic types of wear
leveling, dynamic and static, described below:

Dynamic Wear Leveling – With Dynamic Wear Leveling, each time a block of data is written to the flash
memory, it is written to a new location. Every time the OS writes replacement data, the map is updated
so the original physical block is marked as invalid data, and the replacement data is linked to a new block
in the map entry. However, in such a system, there exist flash memory blocks that never get
replacement data and would not sustain additional wear. The name “dynamic” refers to the dynamic
data, or replacement data, being recycled. Such a device may last longer than one without wear
leveling, but it is not as efficient, since there are blocks that will go unused.

Static Wear Leveling - Static wear leveling works the same as dynamic wear leveling except the static
blocks that do not change are periodically moved so that these low usage cells are able to be used by
other data. This rotational effect enables an SSD to continue to operate until most of the blocks are near
their end of life. This is also sometimes referred to as global wear leveling, as the entire image is
leveled.

What Can Be Done?

Drive Capacity

To reduce the amount of flash wear, the FFS will distribute data over the entire flash drive, to prevent
particular blocks from being used or exercised more than others. Think about it this way: If a single
block was erased and reprogrammed every minute (1 P/E a minute), you would hit 10,000 write cycles
on that block in just 7 days: 60 min in an hour x 24 hours a day x 7 days = 10,080 cycles!!

An 8GB MLC device contains 4,096 independent blocks. Using the same example, if the 10,000 write
cycles were distributed over the 4,096 blocks, each block would be programmed less than 3 times
(compared to 10,080 for a single block). If absolutely perfect wear leveling on this device occurred, a
single block could be erased and programmed every minute for 77 years! This is why it is imperative
that data is written to different blocks, and distributed over the entire capacity of the drive.

It stands that for a given Flash File System, a drive with higher capacity will wear better than the same
drive with a lower capacity (i.e. 16GB drive versus the same drive at 8GB capacity). This is the easiest
solution, however, a higher capacity comes at a higher cost, which may preclude this strategy as a
feasible solution.
Flash Modes

As stated above, there are many types of flash as well as different modes that the flash can be set to.
MLC flash can be set to a pseudo-SLC mode which brings SLC’s speed and durability to MLC flash, which
is a huge performance boost. If MLC gives a relatively low number of P/E cycles and SLC provides the
best performance at a cost, why not use pSLC instead of SLC all the time? Although SLC and pSLC are
similar, they are not the same thing. SLC has been designed for single-bit operation while MLC flash has
been designed for storing 2 bits (even in pSLC mode). The performance characteristics of pSLC are much
better than MLC but less than SLC. The actual numbers vary depending upon the vendor and
implementation, but typical write endurance of pSLC is 30k P/E cycles, compared to 60k-100k P/E cycles
for SLC, and 3,000 P/E cycles for MLC flash.

Software Optimization

The best and most effective way to extend the life of flash memory is through Software Optimization
and improved Error Correction Codes (ECC). When digital data is stored in flash memory, it is crucial to
have a mechanism that can detect and correct errors within the flash. Data is encoded by Error
Correction Codes in such a way that a decoder can identify read/write errors and correct them within
the data.

Decreasing the number of writes, reduces the amount of wear, which effectively extends the life of the
flash. Although this is the primary job of the Flash File System, the way data is packaged and written to
flash, directly correlates in the number of P/E cycles that are consumed. It is due to this reason that file
systems will typically accumulate data and write to flash periodically, instead of writing each file to flash
immediately. Applications and software in general can be streamlined to aid in this type of
consolidation.

The process of optimizing software and ECC algorithms are outside the scope of this paper, but Zebra
Technologies Solution Center provides these type of services. There are two Solution Center locations,
one in Holtsville, NY and one in Brno, Czech Republic. Both locations are experts in software
applications and optimizing them for Zebra devices.

You might also like