Why can NAND flash memory cells only be directly written to when they are empty?
I'm trying to understand why you have to erase cells before writing to them with respect to SSDs and ho开发者_JAVA百科w they slow down over time.
Here is how writing to NAND and erasing works:
When a block is erased, all the bits are set to 1. To change bits from 1 to 0, bits are programmed (written to). Programming cannot change bits from 0 to 1.
Let's suppose you have to store the value 11001100. First, the block needs to erased to represent all 1s (11111111). Then, the particular bits are programmed (11001100). Now, the same memory location cannot be programmed to 11111100, because programming cannot change a 0 to 1.
This is the reason NAND finds a free/empty page with all 1s and then changes the specific bits from 1 to 0. The conventional idea that writing can change 1s to 0s and 0s to 1s is not true for NAND flash. The fact that the NAND programming operation can only change bits from 1 to 0, means that we need an erased page before we start writing.
The following figure shows the relationship between pages and blocks, from an article on flashdba.com:
For more, consult this introduction to NAND flash by Micron.
Why erasure before write?
Erasing a cell means removing most electrons from its floating gate. No electrons in the floating gate commonly represents binary 1:
This and the next illustration are from "How Does Flash Memory Work? (SSD)" by BLITZ.
Assuming one cell represents one bit (that's called single-level cell, or SLC for short), you could informally say that erasing is the write operation: You set the cell/bit to 1 by erasing the cell which means removing most electrons from the floating gate. On the other hand, filling the floating gate with electrons is how setting the bit to 0 is physically implemented:
A non-empty cell with a valid amount of electrons—representing a zero for SLC—is referred to as a programmed cell.
Of significance here is that erasure (setting bits to 1) is rather coarse-grained in flash memory: You erase whole blocks which typically consist of about 40.000 cells. Erasing cells in bulk is faster than erasing individual cells. This whole-block-erasing strategy is what differentiates EEPROM from flash memory. Tangentially, that's also what gave flash memory its name:
According to Toshiba, the name "flash" was suggested by Masuoka's [the inventor of flash] colleague, Shōji Ariizumi, because the erasure process of the memory contents reminded him of the flash of a camera. — From Wikipedia
When one cell represents multiple bits via the amount of electrons it contains, I can think of two reasons why you'd want to empty the cell before putting electrons into it:
- You can only increase the amount of electrons for individual cells. The sole way of lowering the electron count is by erasing and that means removing (nearly) all electrons from the whole block of cells. I'm not aware if any SSD takes this shortcut to represent a different state: "just" increasing the amount of electrons in a cell without emptying it first.
- As described in this video lecture by Jisung Park of ETH Zürich: Writing to cells is unreliable, getting in the right amount of electrons is difficult and takes multiple tries (see also incremental step-pulse programming). Starting with an empty cell and filling it gradually until it has the right amount of electrons is more reliable than trying to add the correct amount of electrons with other electrons already present in the cell. And, as mentioned above, you'd only be able to increase, not decrease, the electrons for individual cells.
Slowdown of cells over time
Moving electrons in and out of the floating gate physically damages the insulating barriers around the floating gate. The silicon dioxide, SiO₂, starts leaking the electrons stored in the floating gate after enough writes and erasures. If untreated, those leaks cause data corruption. For example, the cell's value changes from 101
to 011
by itself due to lost electrons. To avoid data corruption, the SSD regularly refreshes those cells.
Another problem in aging cells is that reading from or writing to them might take longer since they got more unreliable after too many electrons have been shot through the silicon dioxide insulators around the floating gate.
As shown in the following annotated screenshot from an excellent video by Branch Education, those silicon dioxide (SiO₂) insulators can be fewer than 100 atoms, about 8 nanometres, wide:
The Wikipedia article seems to at least hint at the answer. It appears that "tunnel injection" is used for writing and "tunnel release" for erasing. I'll leave it to the physicists to explain exactly what the implications of that are.
I'm trying to understand why you have to erase cells before writing to them
You don't have to erase a flash memory cell before writing to it. However, you can only write to one entire block of cells at a time. Typically these blocks of cells are at least 128KB in size.
So suppose you are writing a 4KB file to your SSD. Well, you have to write one 128KB block at a time. If there is already data in that 128KB block, the drive firmware has to read the 128KB block into its memory, modify the 4KB section you are writing to, and then write the entire 128KB block back out to the flash memory.
The way modern flash chips are designed, it's easier to program a cell in one direction than the other. If a chip holding 16,777,216 bytes in 256 blocks of 65,536 bytes each can only be erased as a unit, then it will require ~128 million "little" circuits to allow programming of the individual bits, and 256 "large" circuits to erase those blocks. For the chip to allow pages of 256 bytes to be erased would require 65,536 of those "large" circuits. I'm not sure what fraction of the chip would be used up by that many page-erase circuits, but it would be significant. Using larger erase blocks allows chips to be manufactured more cheaply; for many applications, a cheaper chip with large erase blocks is preferable to a more costly chip with smaller ones.
精彩评论