Wear leveling for non-volatile memory using data write counters
A memory system has a controller (e.g., CPU, FPGA, or GPU) and recording segments in a non-volatile memory (e.g., a flash memory device) used by the controller to store data. The controller is configured to: maintain data write counters for the recording segments; select a first segment of the recording segments for recording data from a host system, wherein selecting the first segment comprises scanning the data write counters to identify a first data write counter corresponding to the first segment; receive, from the host system, data to be recorded by the non-volatile memory; and write the received data to the selected first segment.
1 . A system comprising:
a black box recorder; and
non-volatile memory;
wherein the system is configured to partition the non-volatile memory into a plurality of recording segments;
wherein the system is configured to record a data stream in a cyclic mode within a currently selected recording segment among the plurality of recording segments until a next recording segment is selected;
wherein the system is configured to maintain a plurality of data write counters for the plurality of recording segments respectively, each respective data write counter among the plurality of data write counters configured to identify a quantity of data having been written to a respective recording segment among the plurality of recording segments; and
wherein the system is configured to select the currently selected recording segment and the next recording segment based on values of the data write counters.
2 . The system of claim 1 , wherein the non-volatile memory is further configured to select the next recording segment in response to the black box recorder receiving a command.
3 . The system of claim 1 , further comprising data write counters, wherein the system is configured to scan the plurality of data write counters in selecting the currently selected recording segment.
4 . The system of claim 1 , further comprising a sensor, wherein the system is configured to select the currently selected recording segment based at least in part on data from the sensor.
5 . The system of claim 1 , wherein the system is further configured to update the respective data write counter based on a portion of the data stream being stored cyclically into the respective recording segment.
6 . An apparatus comprising:
a sensor configured to provide sensor data as a data stream;
memory partitioned into a plurality of memory regions and configured to store, in a cyclic mode, the data stream in a currently selected memory region, among the plurality of memory regions, until a next memory region is selected to record the data stream;
a neural network configured to use the sensor data as input;
a controller configured to use the neural network to select the currently selected memory region, and to navigate a vehicle; and
a plurality of write counters maintained for the plurality of memory regions respectively, each respective write counter among the plurality of write counters configured to identify a quantity of data having been written to a respective memory region among the plurality of memory regions, wherein the controller is further configured to select, based on values of the write counters, the currently selected memory region and the next memory region.
7 . The apparatus of claim 6 , wherein the controller is further configured to write the sensor data to the currently selected memory region in response to selecting the currently selected memory region.
8 . The apparatus of claim 6 , wherein the controller is further configured to select the currently selected memory region based in part on at least one software process executing on an autonomous vehicle.
9 . The apparatus of claim 6 , the write counters each configured to indicate a quantity of data programmed to a respective memory region, wherein the controller is further configured to determine which of the write counters indicates a lowest quantity of data.
10 . The apparatus of claim 6 , wherein the currently selected memory region is selected based on a type of data to be stored in the currently selected memory region.
11 . The apparatus of claim 6 , wherein the currently selected memory region is selected based on a type of storage cell used in the currently selected memory region.
12 . A method comprising:
dividing a memory space into a plurality of recording segments;
writing, in a cyclic mode, a data stream to an active recording segment, selected from the plurality of recording segments, until a next recording segment is selected;
maintaining a plurality of write counters for the plurality of recording segments respectively, each respective write counter among the plurality of write counters configured to identify a quantity of data having been written to a respective recording segment among the plurality of recording segments, including incrementing a first write counter pre-associated with the active recording segment as the data is written to the active recording segment; and
selecting the active recording segment and the next recording segment based at least in part on values of the write counters.
13 . The method of claim 12 , further comprising selecting a respective size for each recording segment, among the plurality of recording segments, based on context data received from a host system.
14 . The method of claim 13 , wherein the context data comprises data from sensors of a vehicle.
15 . The method of claim 13 , wherein the respective size is selected based at least in part on a type of data being recorded.
16 . The method of claim 12 , further comprising comparing values of write counters to select the active recording segment.
17 . The method of claim 12 , wherein the first write counter is incremented based on a quantity of data written to the active recording segment.