What enables flash memory to be used for the OS in computers such as tablets?

Ever since flash drives (USB sticks) were invented, people wondered if they could run their OS on them. The answer was "no" because the number of writes required by an OS would quickly wear out the flash drive.

As SSD's became popular, wear-leveling technologies were improved in order to allow operating systems to run on them.

Various tablets, netbooks, and other slim computers use flash memory instead of a hard drive or SSD, and the OS is stored on it. How did this suddenly become practical? For example, do they typically implement wear-leveling technologies?


Solution 1:

"The answer was "no" because the number of writes required by an OS would quickly wear out the flash drive."

TLDR: They finally became cost effective for mainstream use.

That wear's the only concern is a bit of an assumption. There have been systems running off solid state memory for a considerable period of time - many folks who built car-puters booted off CF cards (which were electrically compatible with PATA - and trivial to install instead of a PATA hard drive), and industrial PCs have had small, rugged, flash based storage. That said, there wasn't many options for the average person. You could buy a pricy CF card and an adaptor for a laptop, or find a tiny, very pricy industrial disk on module unit for a desktop. They weren't very large compared to contemporary hard drives (modern IDE DOMs top out at 8gb or 16gb I think). Pretty sure you could have gotten solid state system drives set up way before 'standard' SSDs became common

There have not really been any universal/magical improvements in wear levelling as far as I know. There have been incremental improvements (while we've been moving away from pricy SLC to MLC, TLC and even QLC, and smaller process sizes, all of which lower cost, at some higher risk of wearing out). Flash has gotten a lot cheaper.

There were also a few alternatives that didn't have wear issues - for example running the entire system off a ROM (which arguably is solid state storage ), battery backed ram, which many early SSDs and portable devices like the palm pilot used. None of these are common today. Hard drives rocked compared to say, battery backed ram (too expensive), early solid state devices (somewhat pricy), or peasants with flags (never caught on, terrible data density). Even modern flash memory is a descendant of fast-erasing eeproms), and eeproms have been used in electronic devices for storage of things like firmware for ages.

Hard drives simply were at a nice intersection of high volume (which is important!), low(ish) cost and relatively sufficient storage.

The reason you find emmcs in modern, low end PCs is the components are relatively cheap, large enough (for desktop OSes) at that cost, and share commonality with cellphone components, so are produced in bulk with a standard interface. They also give great density of storage for their volume. Considering many of these machines have a paltry 32 or 64gb drive, on par with hard drives from the better part of a decade ago, they're a sensible option in this role.

We're finally reaching the point where you can store a reasonable amount of memory affordably and with reasonable speeds on emmcs and flash, which is why people go for them.

Solution 2:

All flash memory devices, from tablets to phones to smart watches, to SSDs and even the SDcards in cameras and USB thumb drives use NVRAM technology. The difference is in the architecture of the NVRAM, and in how the operating system mounts the filesystem on whatever storage medium.

For Android tablets and phones, the NVRAM technology is eMMC based. The data I can find on this technology suggests between 3k to 10k write cycles. Unfortunately, none of what I have found so far is definitive, as Wikipedia is blank on this technology's write cycles. All other places that I've looked at just happened to be various forums, so hardly what I would call a reliable source.

For comparison's sake, other NVRAM technology such as SSDs which use NAND or NOR technology, the write cycles are between 10k and 30k.

Now, regarding the OS's choice of how to mount the filesystem.... I can't speak for how Apple does it, but for Android, the chip is partitioned out like a hard drive would be. You have an OS partition, and a data partition, along with several other proprietary partitions depending on the device manufacturer. The real root partition lives inside the bootloader, which is bundled as a compressed file (jffs2, cramfs, etc) together with the kernel, so that when the device's stage 1 boot is complete (the manufacturer's logo screen usually), then the kernel booted and the root partition is simultaneously mounted as a ram disk.

As the OS boots up, it mounts the primary partition's filesystem (/system, which is jffs2 on devices before Android 4.0 and ext2/3/4 on devices since Android 4.0, and xfs on the latest devices) as read-only so that no data can be written to it. This can, of course, be worked around by so-called "rooting" of your device, which gives you access as the superuser, and allows you to remount the partition as read/write. Your "user" data is written to a different partition on the chip (/data, which follows the same convention as above based on the Android version).

With more and more phones ditching the sdcard slot, you might think that you'll hit the write cap sooner because all of your data is now being saved to the eMMC storage instead of the sdcard. Fortunately, most filesystems detect a failed write to a given area of storage. If a write fails, then the data is silently saved to a new area of the storage, and the bad area (known as a bad block) is cordoned off by the filesystem driver so that data is no longer written there in the future. If a read fails, then the data is marked as corrupt and either the user is told to run a filesystem check or check disk, or the device automatically checks the filesystem during the next boot.

As a matter of fact, Google has a patent for automatically detecting and handling bad blocks.

https://www.google.com/patents/US7690031

To get more to the point, your question "how did this suddenly become practical?" is not the right question to be asking. Rather, it was never impractical, in the first place. It was strongly advised against to install the OS (Windows) on an SSD (presumably) because of the number of writes that OS does to the disk.

For example, the registry receives literally hundreds of reads and writes per second, which can be seen with the Microsoft/SysInternals tool Regmon (https://technet.microsoft.com/en-us/sysinternals/regmon.aspx)

Installing the (Windows) OS was advised against on first generation SSD drives because, with the lack of wear leveling, the data written to the registry every second likely eventually caught up to the early adopters and resulted in unbootable systems due to registry corruption.

With tablets and phones, and pretty much any other embedded device, there is no registry (Windows Embedded devices being exceptions of course) and thus, there is no worry of data constantly being written to the same parts of the flash medium.

For Windows Embedded devices, such as many of the kiosks (including Walmart and Kroger self checkout kiosks) out in the public -- you know, the ones where you may see a random BSOD from time to time -- there is not a whole lot of configuration that can be done, as they are pre-designed with configurations that are intended to never change. The only time changes take place are before the chip is written in most cases. Anything that needs to be saved (such as your payment to the grocery store) is done over the network to the store's databases on a server.

Solution 3:

Your question is premised on an assumption that flash memory write limits, without extensive wear leveling, make it unsuitable for the primary storage of any computing device. There is a range of computing devices, including tablets, netbooks, smart phones, etc., that use flash memory for this purpose, without the wear leveling found in SSDs.

Memory Life

I couldn't find evidence that in general, the memory used in these devices has a longer life than flash drives or SD cards.

Although flash memory is used, there are some differences from what's in a pen drive or SD card. These computers typically use eMMC, which contains the controller and flash memory on a single chip, with a different architecture than an SD card or flash drive. One difference for the eMMC controller is that it emulates a hard drive, so the computer sees it as a bootable device. That's a design convenience.

Some of the manufacturers claim that their eMMC controller does better wear leveling and has more robust error correction than what you find in a typical SD card or flash drive. The implication of the improved ECC is that it can tolerate more degradation and still work, so it has a longer effective life.

Since all of this is proprietary, it's difficult to find hard data to support it. Even if there are high-end eMMCs that last longer, that isn't necessarily what's used in the majority of these devices. The miscellaneous information I could find about eMMC write limits seems to place it in the same general ballpark as SD cards and pen drives.

It would appear that, in general, longer-life memory isn't the basis for using flash memory as the primary storage in these devices. Everyone wasn't wrong about the write limits; the usage can be explained by the fact that the requirements are different.

Platform Differences

PCs and laptops are general purpose computers that people expect to use for a long time. Flash drives and memory cards are not a great fit as their primary storage device given the typical amount of writing they're designed to handle and their expected service life. That's reflected in the guidance you described in the question, and that hasn't changed (at least for the current generation of flash memory).

Tablets, netbooks, smart phones, and the like are a different situation. The ones using flash memory as their primary storage are limited purpose devices. The tasks they're designed to handle, their minimal hardware resources available for supporting other uses, their basic design, and their OS and software, result in less writing compared to a PC. Given that these devices rely on flash memory (in a format that is not replaceable), the write limits are a consideration in what runs on them.

They also have a shorter life expectancy. The devices using flash memory as their primary storage are inexpensive, designed for a market where people upgrade often. The devices provide certain features and capabilities in a tiny form factor, and they last as long as they last based on the components they are built from. The battery is likely to fail before the flash memory, or parts may break. And there's constant marketing to convince you that your device is obsolete and needs to be replaced by the latest model.

There's a story that Henry Ford used to send his engineers to junk yards looking for components of dead cars that were still good. The idea was that those parts could be made more cheaply because they didn't need to last as long as they did. That logic applies to the flash memory in these devices. It just needs to last long enough, it doesn't need to long outlast the device.

Bottom Line

There are market niches for cheap, tiny, computing devices that don't do as much writing to primary storage as a PC is designed to handle, and that don't have the same service life expectations. Memory in the form of eMMC is cheap, tiny, bootable, and good enough for that application.