Let's define a "semi-rewritable" memory device as having the following properties:

  • The initial blank media is initialised with all zeroes.
  • When writing to the media, individual zeroes can be turned into ones.
  • Ones can not be turned back into zeroes.

Making a physical interpretation of this is easy. Consider for instance a punch card where new holes can easily be made, but old holes can not be filled.

What makes this different from a "write once, read many" device is that a used device can be rewritten (multiple times), at the cost of reduced capacity for each rewrite.

Implicit assumptions I would like to make explicit:

  1. The memory reader has no information about what was previously written on the device. It can therefore not be relied upon to use a mechanism such as "which symbols have been changed?" to encode data on a device rewrite. That is, the reader is stateless.
  2. On the other hand, different "generations" of the device may use different encoding schemes as the available capacity shrinks.
  3. The data stored can assumed to be random bits.

Sample storage scheme, to demonstrate rewrite capability:

Information in this scheme is stored on the device as pairs of binary symbols, each pair encoding one of the three states of a ternary symbol, or [DISCARDED] in the case where both symbols have been written.

The first generation thus stores data at a density of $\frac{log_2(3)}{2} \approx 0.79$ times that of simple binary encoding.

When the device is rewritten, the encoder considers each pair of binary symbols in sequence. If the existing state matches the one it desires to write, the encoder considers the data written. If on the other hand the pair doesn't match, it writes the necessary modification to that pair, or in the case where that isn't possible, writes the symbol [DISCARDED] and considers the next pair instead until it has successfully written the ternary symbol.

As such, every rewrite would discard $\frac{1}{2}$ of existing capacity.

For a large number of cycles, the device would in sum have stored $log_2(3) \approx 1.58$ times the data of a simple one-time binary encoding.

(For a variation of the above, one could also encode the first generation in binary and then apply this scheme on every subsequent generation. The loss from the first generation to the second would be larger, and the total life time capacity reduced, but the initial capacity would be larger).


  1. Is it possible to have a better life-time capacity than $log_2(3)$? I suspect the the real asymptotic capacity is 2.

  2. Can a scheme do better than having $\frac{1}{2}$ capacity loss between rewrites?

  • $\begingroup$ Writing the second and subsequent cycles is very similar to adding a bunch of elements to a Bloom filter, though IIUC you do not require the ability to also read back previous-cycle writes correctly with high probability. I suspect you can radically decrease the per-cycle capacity loss with a highly redundant encoding -- although this means you start with a much-reduced capacity. $\endgroup$ – j_random_hacker May 22 at 14:43

In pre-historic times, laser printers stored their page counts in some hardware that only let you set bits. N consecutive bits set from the start followed by a zero would mean the number N. After printing a page, you’d set another bit. You can probably encode an array of small integers to which another is added in a similar way.

| cite | improve this answer | |
  • $\begingroup$ Doesn't this assume a certain data pattern (e.g. an incrementing page counter)? I can't immediately see how this would translate to arbitrary data. $\endgroup$ – SE - stop firing the good guys May 22 at 16:29

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.