-2

Why are FLASH memories considered to be EEPROMS? EEPROM has "Read Only" in its name, so by definition you cannot rewrite it, yet FLASH memories are used for USBs and many other technologies which are constantly rewritten.

I understand that EEPROMS are "Erasable" which means I can modify their contents by erasing and re-writing entire blocks but how come a USB works exactly like an HDD when I read and write things?

Also, what is the point in calling it Read-Only and at the same time Erasable? Isn't it like saying "This is unbreakable metal that can be broken"?

1
9

In order to understand the nomenclature, you have to compare it to the extreme ends end of the spectrum:

  • RAM (Random Access Memory) allows you to randomly read and write individual units (usually bytes or words, or some internal organizational unit), and it doesn't really matter whether you are reading or writing.
  • ROM (Read-Only Memory) allows you to only read. The contents of a ROM are put there as part of the manufacturing process. (This is also called Mask ROM.)

In-between, we have then a continuum of other stuff:

  • PROM (Programmable ROM) can only be written once, using a special device called a programmer. However, unlike a ROM, it can be generically manufactured and then programmed after manufacture.
  • WORM (Write-Once Read-Many) can be written once, but the difference to a ROM is that the programming doesn't use special equipment. It can be done using the same equipment that is used for reading. (Think of a CD-R writer.)
  • EPROM (Erasable PROM) can be erased using UV light in a special eraser, then be programmed again in the programmer.
  • EEPROM (Electrically-Erasable PROM) is an EPROM that doesn't require UV light to erase, it can be erased electrically. Also, it can be erased per-byte (or sometimes per-word or per-block), i.e. at the same granularity as it can be programmed and read.
  • Flash-EEPROM is an EEPROM that can only be erased in (much larger) erase blocks. So, the main difference to an EEPROM is that the granularity at which Flash-EEPROM can be erased is both much larger than an EEPROM can be erased and also much larger than the granularity at which the Flash-EEPROM can be programmed and/or read. What this means is that if you want to change one byte in an EEPROM, you can erase and program just that one byte. In a Flash-EEPROM, you have to first read the entire erase block, then erase the block, and then program the erase block again with the original data except that one byte changed. This makes writing to Flash-EEPROM much more complex than writing to EEPROM.

So, why use Flash-EEPROM at all? Well, it uses fewer transistors per bit, which makes it smaller, denser, and cheaper than EEPROM.

how come a USB works exactly like an HDD when I read and write things?

It doesn't. It works completely different. There is a sophisticated firmware running on the Flash storage device which makes it look like a SCSI / SATA / USB / Firewire storage device. (They all use basically the same command API.) The quality of this firmware is in fact one of the major distinguishing (performance) factors between SSDs. For example, an SSD will typically contain more Flash-EEPROM memory than the controller firmware exposes externally, and it is part of the cleverness of the controller firmware to decide whether to erase and re-write a block or to mark the block unused and re-map the block ID to a block from the pre-erased spare portion that it "keeps up its sleeve".

Furthermore, especially SSDs employ large RAM caches that are used to (among other things) "collect" multiple writes to the same erase block together so that the block only has to be erased and re-written once in one go.

Note also that NVMe was developed specifically because Non-Volatile Memory (the vast majority of which is Flash-EEPROM-based) does not behave like the currently existing dominant storage solutions for which the existing protocols were designed.

4
  • Thank you for this very exhaustive answer! You did clear up some doubts but my main question was perhaps more on semantics and vocabulary: why is it "read only" when it... isn't read-only? I mean, it is clearly writable right? Does read-only mean per BIT maybe? Thanks again! – Thanaphon Leonardi Jan 5 '20 at 18:01
  • 2
    @ThanaphonLeonardi words can be bent... The original meaning of a word is often overridden by actual usage, especially when there is a continuum of usages that were not covered by the original meaning, like Jörg explained. – Hans-Martin Mosner Jan 5 '20 at 18:32
  • There is a difference between writing and programming. Writing is considered an operation equal to reading, i.e. it should take (roughly) the same time, have (roughly) the same cost, the same complexity, etc. Programming is generally slower, more expensive, more complex, and most importantly, it is physically destructive. This is most obvious with PROMs, where it is typically implemented by literally blowing fuses. But it is even true for EPROMs, EEPROMs, and Flash-EEPROMs. Once programmed, you cannot change them. You need to first erase them, and that does physically stress the medium – Jörg W Mittag Jan 5 '20 at 18:37
  • … so that you only have a limited amount of erase/program cycles. (Intelligently dealing with this limit is another thing SSD controller firmware does.) So, Flash-EEPROM is not "writable" in the sense that RAM is: RAM is read/writable because you can write just as easily as you can read. Flash-EEPROM is not writable in the same sense, because you cannot "just write" in the same way that you can "just read". You have to first erase, then program, which is more complicated, slower, and more expensive than "just writing" a RAM or "just reading" a Flash-EEPROM. – Jörg W Mittag Jan 5 '20 at 18:39
-1

The confusion comes from the fact flash memory cannot replace content directly once it is written. One cannot write 'beer' into a flash cell and then execute an operation that writes 'water' into the same cell.

One can, however, return a flash cell into an unwritten state, and then write it again. This process is hidden by hardware and/or software on the flash medium and the host. The flash drive will hide this read/modify/write cycle by taking a fresh block from the free blocks list, reading the old content, making the changes, and writing the data back to that fresh block. The old data then gets erased and returned to the fresh blocks list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.