Patent ID: 8683118

Claim:
A method for writing to flash memory, comprising: obtaining, for each of a plurality of locations in flash memory, a number of pulses to modify information stored in a given location in the plurality of locations, wherein: the number of pulses includes a number of write pulses; and obtaining includes: receiving one or more write instructions to write to the plurality of locations; and in response to receiving the one or more write instructions, for each of the plurality of locations: writing a write pattern to a given location in the plurality of locations to obtain a number of write pulses; determining if the write pattern includes a highest possible voltage level; in the event the write pattern includes the highest possible voltage level, storing the number of write pulses obtained from writing the write pattern; and in the event the write pattern does not include the highest possible voltage level, discarding the number of write pulses obtained from writing the write pattern; using a processor to select, from the plurality of locations, a location having the largest number of pulses; and writing to the selected location.