Intro to Computer Systems

Chapter 8: Mass Storage

Solid-State Media

There are two problems with magnetic storage:

One solution is solid state storage. This uses non-volatile memory chips (Flash EEPROMs, also known as "Flash Memory") as a storage medium. These have no moving parts, and being memory chips, are compact and can be put into products of virtually any shape.

"USB key" portable drives use solid-state Flash chips for storage.
"USB key" portable drives use solid-state Flash chips for storage.

Despite their relative expense, solid state storage has become very popular because of its convenience. Just about all computers today have a USB port to plug into, and the drives themselves are so small they can be put in pocket or hung on a keychain with ease.

Solid state storage is also a popular choice for products that expect to deal with some level of physical abuse; digital cameras, music players, and many other personal electronic devices.

The Rise of Solid State Storage

The economics, size and robustness of flash memory production are at a stage where it is now feasible to build solid state disks with high data capacities, high enough that they can replace a hard disk. This means that notebook computers can replace the rotating magnetic-platter hard disks with storage systems with no moving parts, with a great benefit to power consumption, noise levels, shock-proofing and access speed.

A notebook Solid State Disk, with Serial ATA connector.
A notebook Solid State Disk, with Serial ATA connector. Photo: SanDisk

No longer tied to conventional hard disk sizes (as conventional hard disks are made physically smaller, they are much slower), new form factors in notebook computer design can be explored, such as the Ultrabook form factor pioneered by Apple's MacBook Air.

Performance Considerations

Solid state disks are fundamentally different from magnetic or optical media, and thus there are completely different circumstances which dictate their performance.

Seek Time

Without any mechanical parts or rotational storage media, access and seek times are purely a matter of electronics: it is down to the quality of flash memory chips, flash memory controller, and the mass storage interface.

Thus, a solid state disk is unmatched when it comes to random data operations.

Flash Memory Maintenance

A flash memory cell does not last forever - it only has a certain number of guaranteed write operations until that circuit 'wears out' and is no longer useful. This limitation is is typically around the several hundred thousand writes mark, so is not an immediate short (or even medium, for most people) term concern.

Solid state disks typically have more memory in them, than they are rated for on the sticker - and when individual memory cells wear out, those parts are no longer used, and "replaced" by some of this spare memory. As there is no seek time penalty in doing this, a partially worn solid state disk does not suffer a performance decrease.

Wear can also be minimised by the flash memory controller avoiding "hot spots" of heavy use amongst the chips under its control, and spreading out writing operations across all the chips as evenly as possible. This is called wear levelling.

TRIM and Garbage Collection

As the allocation of data on a solid state disk has no direct correlation with the underlying file system (in terms of sectors and tracks of a conventional spinning disk), the flash controller has no knowledge of what areas of files may be from deleted files, and as such considered 're-usable'. As such, without any cleaning of the underlying flash storage, future write operations to the disk may involve re-writing old data, which comes at an additional performance penalty. Early flash controllers had no such 'garbage collection' mechanism, and as such their performance deteriorated as the disk was used.

This type of garbage collection relies on cooperation between the operating system's file system and the flash controller - and it was implemented with what is known as the TRIM command. This is a method by which the operating system can tell the flash controller which blocks of data are no longer in use, so that it can confidently clear the respective flash memory cells ("garbage collection") during idle periods. This means that future write operations to the cells does not involve an overwrite, and as-new performance can be restored.

The first generation of Google's Nexus 7 tablet was significantly affected by this issue - a combination of low-cost (low-performance) flash memory, and a bundled operating system that did not properly support garbage collection.

The issue was resolved in the Android 4.3 update to the device, which enabled the TRIM function.

Memory System

There are two kinds of flash memory cells used in solid state disks:

Single-Level Cell (SLC) memory stores data traditionally; that is, a memory cell stores only one state (0 or 1). This improves their performance, endurance and power conumption, but limits its ultimate capacity per chip. SLC-based SSDs are usually more expensive for this reason.

Multi-Level Cell (MLC) memory can store multiple bits of data in each memory cell. This improves the storage density, however has a negative effect on performance and endurance. That said, many of the drawbacks of MLC flash memory can be worked around through smarter flash memory controllers. These may include techniques such as:

Write Performance

Flash memory has memory-like read speeds, however it takes a lot longer to write, compared to traditional forms of memory. Furthermore, it cannot be reprogrammed at the byte level, but only a block (which may be several kilobytes).

This adds some complication to the task of writing bytes to an SSD. Instead, the disk controller must read an entire block, modify the content, and re-write the entire block. This takes time, and in a slow or poorly-implemented controller, this can cause noticeable pauses to data transfers to and from the disk.

Early solid state disk controllers had a poor algorithm for managing writes; coupled with insufficiently sized cache, this meant an entire generation of solid state disks could not reliably keep up with the demands of computer "power users".

One example of such a compromised SSD controller is the JMicron JMF602.

Transfer Rate

Cheap flash memory, common in bargain basement keychain drives, is actually significantly slower than a hard disk - perhaps as slow as 4 or 5 MB/sec. This works well for occasional data storage, but is highly inappropriate for internal mass storage.

This is why a 32GB keychain USB drive is far less than a quarter the price of a decent 128GB Serial ATA solid state disk.

Much like the difference between cache SRAM and main memory DRAM, faster flash memory is possible, but more expensive to produce. High performance flash memory can potentially saturate even modern mass storage interfaces like Serial ATA - but a customer would pay for the privilege.