Tech, ExplainedSemiconductors and devices
Part

SSD controller

Stops flash cells wearing out early.

INSIDE: NAND FLASH MEMORY AND SSDSHOW IT WORKS · SAVING A 2 MB SPREADSHEET ON A 1 TB SSD IN NAGPURThe laptop asksthe SSD to write2 MB at a set oflogicaladdressesThe controllersplits the fileinto 128 pagesof 16 KB eachIt writes themto free pages inthe least-wornblocks, addingerror-correctingbitsIt updates its 1GB mapping tableto point eachaddress to itsnew pageThe 128 pagesthat held theold version aremarked invalidLater, garbagecollectioncopies thevalid pagesout of a mostlyinvalid blockand erases itALSO TALKS TOEnterprise storage systems↗ DATA CENTRESSoftware-defined storage↗ DATA STORAGE AND BACKUPINSIDE: NAND FLASH MEMORY AND SSDSHOW IT WORKS · SAVING A 2 MB SPREADSHEET ON A 1 TBSSD IN NAGPURThe laptop asks the SSDto write 2 MB at a set oflogical addressesThe controller splits thefile into 128 pages of 16KB eachIt writes them to freepages in the least-wornblocks, addingerror-correcting bitsIt updates its 1GB mapping table topoint each addressto its new pageThe 128 pages that heldthe old version aremarked invalidLater, garbage collectioncopies the valid pagesout of a mostly invalidblock and erases itALSO TALKS TOEnterprise storage systems↗ DATA CENTRESSoftware-defined storage↗ DATA STORAGE AND BACKUPINSIDE: NAND FLASH MEMORY AND SSDS · SAVING A 2MB SPREADSHEET ON A 1 TB SSD IN NAGPURThe laptop asks the SSD to write 2 MB ata set of logical addresses↓The controller splits the file into 128pages of 16 KB each↓It writes them to free pages in theleast-worn blocks, addingerror-correcting bits↓It updates its 1 GB mapping table topoint each address to its new page↓The 128 pages that held the old versionare marked invalid↓Later, garbage collection copies thevalid pages out of a mostly invalid blockand erases itALSO TALKS TOEnterprise storage systems↗ DATA CENTRESSoftware-defined storage↗ DATA STORAGE AND BACKUP
The SSD controller splits a 2 MB file into 128 pages, writes them to its least-worn blocks with error-correcting bits, updates its mapping table and later erases the blocks that hold old copies.
opens a page inside this one a page in the same scene a page in another scene a concept page a label only, with no page

An SSD controller is the chip inside every solid-state drive (SSD), together with its firmware, that manages the drive's flash memory. It spreads writing evenly, so that no flash cell wears out early. It finds and fixes errors. And it keeps track of where each piece of data is actually stored. Firmware is the software that runs on a device's own chip.

Why does flash need a manager? NAND flash memory follows three awkward rules. It is written in small pages, about 16 KB each, but it can be erased only in large blocks of several megabytes. A page cannot be overwritten in place: it must first be erased with the rest of its block. Each block wears out after a limited number of erases, about 1,000 to 3,000 for common flash. And cells make occasional errors, more often as they wear.

The controller hides all of this from the computer. The computer asks to read or write data at an address, called a logical address, as if the drive were one simple list of places. The controller writes each piece of new data to a fresh page, wherever it chooses. It then records, in a mapping table, which physical page now holds each logical address. On a 1 TB drive, this table takes about 1 GB, and it is kept in a small DRAM chip inside the SSD. The old copy is marked invalid. Later, when a block is mostly invalid, the controller copies its few valid pages elsewhere and erases the whole block. This is called garbage collection. The controller also counts the erases of every block, and sends new data to the least-worn blocks. This is called wear levelling. Every page is stored with extra error-correcting bits, from which the controller can rebuild bits that the flash got wrong.

Consider an employee in the accounts team at a firm in Nagpur, who saves a 2 MB spreadsheet on her laptop's 1 TB SSD. The controller splits the file into 128 pages of 16 KB each. It writes them to free pages in its least-worn blocks, with error-correcting bits added to each. It updates the mapping table, so that the file's logical addresses now point to the 128 new pages. The 128 pages that held the previous version of the file are marked invalid. Hours later, while the laptop is idle, garbage collection copies the valid pages out of one mostly invalid block and erases it, ready for new data.

Because the controller writes evenly across all the blocks, a drive rated for 600 full rewrites can usually last for years of office work. Large companies use the same kind of controller in the flash drives of enterprise storage systems and software-defined storage, where the controller also reports how worn each drive is, so that it can be replaced in time. Some of the world's SSD controllers and their firmware are designed in Bengaluru.

Tech, Explained is a part of ingrid.fyi. Every page explains one piece of technology in plain words.