How many Program/Erase cycles does the iPhone'

2019-02-17 23:32发布

问题:

Not sure that this is the right site for this question, but since there are many smart people here maybe someone knows.

I'm building an app that needs to capture video continuously, but keep only the last few minutes (say 5~15). It is easy to implement this by splitting the video to 30-seconds files, and delete the least recent ones. However, this means that the app writes and erases large files all the time, and I'm worried that it'll wear the device's flash memory.

I've been trying to find the P/E cycles spec for the iPhone (and for popular Android phones), with no success. Does anybody know the answer?

P.S. Just to alleviate a trivial concern: the device is connected to power during this video capturing, so battery depletion is not an issue.

回答1:

I wouldn't worry about that. Typical NAND flash has 100k+ write cycles

I'm sure iOS has a smart file operating system which distributes writes evenly to reduce wearing out specific locations. I'm also sure that once it starts happening with some sectors it marks them as bad ones and relocates them to healthy locations as it happens with normal HDDs as well.

Also writing on the same location in every 30 sec is not particularly frequent. It would take you 140 years to wear out the same flash location. I is likely that most of your data stays in the cache without actually ever written to the flash.



回答2:

The number of erase cycles very much depends on the type of flash used. Single level NAND typically have 100k+ erase cycles whereas it's ~10k for multi-level NAND. As a rule of thumb, MLC is cheaper and higher density than SLC.

NAND controllers - whether implemented in software or in hardware perform wear-levelling, bad-block management and error correction, and some erase units are held back to replace blocks deemed to be beyond salvage.

There are a number of possible hardware architectures for attaching NAND devices in phones.

Apple is hanging (what I assume are) MLC devices directly off the applications processor.

A more common scenario in Android phones is to use a smallish NOR device for the bootloader and kernel and then an eMMC NAND Flash device with the ext4 filing system for everything else. eMMC is essentially the same silicon as removable media card. but packaged for direct mounting into a device, with embedded NAND array management.

in either case, the underlying NAND performance is considerably abstracted from application space. When you consider that MLC-based SSD devices are marketed at enterprise users who hammer them, any load generated on a smart-phone is unlikely to be a concern.