# US 2008/0307164 A1 · Method And System For Memory Block Flushing

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2008/0307164 A1
- Document ID: US20080307164A1
- Status: Published application
- Kind: A1
- Application number: 12/036,023
- Filed: 2008-02-22
- Published: 2008-12-11
- Earliest claimed: 2007-06-08
- Assignees: SanDisk Technologies LLC
- Inventors: Alan W. Sinclair
- Web page: https://patentgrep.com/patent/US20080307164A1

## CPC

- G06F 12/0246: {in block erasable memory, e.g. flash memory}
- G06F 12/0607: {Interleaved addressing}
- G06F 2212/1016: Performance improvement
- G06F 2212/7202: Allocation control and policies
- G06F 2212/7205: Cleaning, compaction, garbage collection, erase control
- G06F 2212/7208: Multiple device management, e.g. distributing data over multiple flash devices
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and system for flushing physical memory blocks in a memory device is disclosed. The method includes detecting a quantity of available memory, background flushing partially obsolete memory blocks if the quantity decreases to a background activation threshold, disabling the background flushing if the quantity increases to a background deactivation threshold, foreground flushing the partially obsolete memory blocks if the quantity decreases to a foreground activation threshold, and disabling the foreground flushing if the quantity increases to a foreground deactivation threshold. The thresholds may be adaptively defined. The background flushing may occur when the host interface is idle. The foreground flushing may interleave writing operations with flushing operations while a write command is unfinished. The system includes a memory for receiving data with a host write command, and a controller for detecting a quantity of available memory and enabling and disabling background and foreground flushing depending on adaptive thresholds.

## Claims

### Claim 1

A method of flushing memory blocks in a memory device in communication with a host, comprising:
detecting a quantity of available memory in the memory device, wherein the available memory comprises unwritten capacity in memory blocks;
background flushing partially obsolete memory blocks if the quantity of available memory decreases to a background activation threshold, wherein the partially obsolete memory blocks comprise memory blocks having only obsolete data and valid data and background flushing comprises relocating valid data from the partially obsolete memory blocks to the available memory when a host interface is idle;
disabling the background flushing if the quantity of available memory increases to a background deactivation threshold that is greater than the background activation threshold;
foreground flushing the partially obsolete memory blocks if the quantity of available memory decreases to a foreground activation threshold, wherein foreground flushing comprises after a host write command is received, interleaving host writing operations and flushing operations while the host write command is unfinished, the host writing operations comprising steps of storing data received with the host write command to the available memory and the flushing operations comprising steps of relocating valid data from the partially obsolete memory blocks to the available memory; and
disabling the foreground flushing if the quantity of available memory increases to a foreground deactivation threshold that is greater than the foreground activation threshold.

### Claim 2 (depends on 1)

The method of claim 1, wherein relocating valid data from the partially obsolete memory blocks to the available memory comprises:
selecting one of the partially obsolete memory blocks with a smallest quantity of valid data; and
copying the valid data from the one of the partially obsolete memory blocks to the available memory.

### Claim 3 (depends on 1)

The method of claim 1, wherein the host interface is idle when the memory device is not receiving a command from the host.

### Claim 4 (depends on 1)

The method of claim 1, wherein foreground flushing further comprises:
determining a ratio of storing data steps and relocating valid data steps; and
interleaving the host writing operations and the flushing operations to achieve the determined ratio.

### Claim 5 (depends on 4)

The method of claim 4, wherein the ratio is approximately 1:1.

### Claim 6 (depends on 4)

The method of claim 4, wherein determining the ratio is based on a balancing factor, the balancing factor comprising at least one of a length of data received with the host write command or a desired write speed.

### Claim 7 (depends on 6)

The method of claim 6, wherein the balancing factor is based on at least one of historical operational statistics of the memory device, data tags, file tags, or distribution of logical block addresses allocated by the host.

### Claim 8 (depends on 1)

The method of claim 1, further comprising relocating valid data from a selected partially obsolete memory block to the available memory when the host interface is idle, even if the background flushing is disabled, when a quantity of valid data in the selected partially obsolete memory block is less than an override threshold, wherein the override threshold comprises an average quantity of valid data in the partially obsolete memory blocks during the background flushing.

### Claim 9 (depends on 1)

The method of claim 1, wherein the background activation threshold, the background deactivation threshold, the foreground activation threshold, and the foreground deactivation threshold are based on a threshold factor, the threshold factor comprising at least one of a length of data received with the host write command, a desired write speed, or an average quantity of valid data in the partially obsolete memory blocks during the background flushing.

### Claim 10 (depends on 9)

The method of claim 9, wherein the threshold factor is based on at least one of historical operational statistics of the memory device, data tags, file tags, or distribution of logical block addresses allocated by the host.

### Claim 11 (depends on 1)

The method of claim 1, wherein the background activation threshold is greater than or equal to a predetermined maximum length of data received with the host write command at a predetermined maximum write speed.

### Claim 12 (depends on 1)

The method of claim 1, wherein the foreground activation threshold is greater than or equal to a predetermined length of data received with the host write command at a predetermined write speed.

### Claim 13 (depends on 1)

The method of claim 1, wherein the foreground activation threshold is less than the background activation threshold.

### Claim 14 (depends on 1)

The method of claim 1, wherein the foreground deactivation threshold is less than or equal to the background activation threshold.

### Claim 15 (depends on 1)

The method of claim 1, wherein the available memory comprises unwritten capacity in blocks having at least a portion of unwritten capacity and at least one of valid data or obsolete data, and unwritten capacity in blocks having only unwritten capacity.

### Claim 16

A method of flushing memory blocks in a memory device in communication with a host, comprising:
detecting a quantity of available memory in the memory device, wherein the available memory comprises unwritten capacity in memory blocks;
if the quantity of available memory reaches a background activation threshold, then relocating valid data from partially obsolete memory blocks to the available memory when no host write command is received, wherein the partially obsolete memory blocks comprise memory blocks having only obsolete data and valid data; and
if the quantity of available memory reaches a foreground activation threshold that is less than the background activation threshold, then after receiving the host write command, interleaving between steps of storing data received with the host write command to the available memory and steps of relocating valid data from the partially obsolete memory blocks to the available memory, while the host write command is unfinished.

### Claim 17 (depends on 16)

The method of claim 16, wherein relocating valid data from the partially obsolete memory blocks to the available memory comprises:
selecting one of the partially obsolete memory blocks with a smallest quantity of valid data; and
copying the valid data from the one of the partially obsolete memory blocks to the available memory.

### Claim 18 (depends on 16)

The method of claim 16, further comprising if the quantity of available memory reaches the foreground activation threshold, balancing the interleaving of relocating valid data steps and storing data steps such that the quantity of available memory remains substantially constant.

### Claim 19 (depends on 16)

The method of claim 16, further comprising if the quantity of available memory reaches the foreground activation threshold, interleaving a greater number of the storing data steps than the relocating valid data steps such that the quantity of available memory decreases and a write speed of the memory device increases.

### Claim 20 (depends on 16)

The method of claim 16, further comprising if the quantity of available memory reaches the foreground activation threshold, interleaving a greater number of the relocating valid data steps than the storing data steps such that the quantity of available memory increases and a write speed of the memory device decreases.

### Claim 21 (depends on 16)

The method of claim 16, wherein the foreground activation threshold is greater than or equal to a predetermined length of data received with the host write command at a predetermined write speed.

### Claim 22 (depends on 16)

The method of claim 16, wherein the background activation threshold is greater than or equal to a predetermined maximum length of data received with the host write command at a predetermined maximum write speed.

### Claim 23 (depends on 16)

The method of claim 16, further comprising if the quantity of available memory reaches a background deactivation threshold that is greater than the background activation threshold, accumulating obsolete data in the partially obsolete memory blocks.

### Claim 24 (depends on 16)

The method of claim 16, wherein the available memory comprises unwritten capacity in blocks having at least a portion of unwritten capacity and at least one of valid data or obsolete data, and unwritten capacity in blocks having only unwritten capacity.

### Claim at position 25

25-40. (canceled)
