Analytical View Of Garbage Collection In Solid State Media File Systems
- Length: 1886 words (5.4 double-spaced pages)
- Rating: Excellent
Solid State media's such as flash memory are non-volatile computer memory that can be electrically erased and reprogrammed. These are specific types of EEPROM's that are erased and programmed in large blocks.
Flash memory is non-volatile, which means that it does not need power to maintain the information stored in the chip. In addition, flash memory offers fast read access times and better kinetic shock resistance than hard disks (Table 1).
Though flash memory has many advantages, its special hardware characteristics impose design challenges on storage systems.
Media Access Time
Read (512B) Write (512B) Erase
DRAM 2.56µs 2.56µs -
NOR Flash 14.4µs 3.53ms 1.2s (128kB)
NAND Flash 135.9µs 226µs 2-3ms (16kB)
Disk 12.4ms 12.4ms -
Table 1. Characteristics of different storage media. (NOR Flash: Intel 28F128JF3A-150, NAND Flash: K9F5608U0M)
Flash memory is divided into one or many sections of memory called partitions. A multi-partition architecture allows system processor to multi-task the I/O operations with the flash memory. While the processor can read from one partition, it can write/erase in another.
Figure 1. Partitions, Blocks and Pages
In addition to partitions, flash memory is further divided into sections of memory called blocks (Figure 1). Flash memory devices in which all blocks are of the same size are symmetrically-blocked, while devices which are asymmetrically-blocked generally have several blocks that are significantly smaller than main array of flash blocks. Small blocks are typically used for storing small data or boot code. Block sizes vary 64kB to 256kB.
Each block in flash memory comprises of fixed number of pages (Figure 1). A page is typically of size 512B to 2kB. While erase operations can be done only on blocks, I/O operations can be done on every page.
1.2 Programming Data
Flash devices allow programming values from logical "1" to "0", but not from "0" to "1" (Figure 2). To program values back to "1"s requires erasing a full block. In most cases when data is data edited, it can either be re-written to the same block by caching the original, erasing the block and re-writing over it, or by writing the edited file to a new location in flash and the old one invalidated. Eventually, invalid data needs to be reclaimed which is usually done as a background process.
1 1 1 1 1 1 1 1 1 1
1 0 1 0 0 1 1 0 1 0
1 1 1 1 1 1 1 1 1 1
Figure 2. Flash Programming Limitations
2.0 Flash File System Functions
While flash file systems have many functions in common with file systems for other media, there are many that are unique to file systems for flash devices.
2.1 Wear Leveling
Each block in a flash memory device has a finite number of erase-write cycles (~ 10,000 to 100,000).
To increase the life of the flash device, writes and erases should be spread as evenly as possible over all the blocks of the device. This is called wear leveling. Care needs to be taken in the software to balance performance with evenly spread wear leveling of blocks.
2.2 Garbage Collection
As mentioned previously, edits to files are usually not done "in place", rather data is written to a new location and the old data is invalidated. Since blocks should be erased in advance before updating, updates in place are not efficient.
The invalid data needs to be cleaned up at regular intervals and this process is called garbage collection or reclaim. When a block is reclaimed the valid data in the block is migrated to a clean (erased) block of data called the spare block. When the reclaim process is completed the old block is erased and it becomes the new spare block.
There have been many researches on garbage collection algorithms (or cleaning policies) for log-structured file systems used on disk-based storages. Garbage collection algorithms should deal with some issues such as how many blocks to erase, which blocks to erase, and where to migrate valid data from erased block. The primary concern of garbage collection algorithms has been to reduce the cleaning cost. But, the number of victim blocks is also a problem for garbage collection policy of flash memory file system. This is because the costs of erase operations are much higher than read/write operations and thus garbage collection could disturb normal I/O operations to the device.
3.0 Garbage Collection in Detail
Data on flash memory cannot be over-written unless the blocks are erased in advanced. Also, erase operations can occur only in larger units than write operations and hence it takes an order of magnitude longer than the write operations. The erase operation is hence slow that usually decreases the system performance and consumes more power.
Therefore, if every update operation is performed in place, then system performance will be poor since updating even one byte requires one erase and several write operations. In order to avoid having to erase during every update, a logging approach can be used since it is quite effective in several ways.
First, logging solves the inability to update in place, since an update results in a new write at the end of the log and invalidation of the old. The natural separation of asynchronous erases from writes allows write operations to fully utilize the fixed I/O bandwidth, and thus prevents performance degradation that may occur when writes and erases are performed simultaneously.
When valid data are updated to empty spaces at the end of the log, obsolete data are left at the same place as garbage, which a garbage collector process can later reclaim. Garbage collection operation can be run as background process so that update operation can be performed efficiently.
3.1 Steps to Collecting Garbage!
The process of garbage collection can be performed in three stages:
1. Select the victim block to be erased.
2. Identify valid pages and copy them to the end of log.
3. Erase the victim block.
Figure 3. Three steps of garbage collection.
The cleaning cost and the degree of wear-leveling are two primary concerns of garbage collector. The garbage collector tries to minimize cleaning cost and wear down all blocks as evenly as possible. Sometimes the objective of minimizing cleaning cost conflicts with that of wear-leveling. For example, excessive wear leveling generates a large number of invalidated blocks, which degrades cleaning performance.
3.2 Garbage Collection Issues
There are some issues of garbage collection:
1. When: When should garbage collection be started or stopped? It executes for defined periods indefinitely or is triggered until the value of free blocks gets below the defined threshold.
2. How Many: How many blocks are cleaned at once? The more blocks are cleaned at once; the more valid data can be reorganized. However, cleaning several blocks needs much time, which can disturb normal I/O execution. Thus, garbage collection algorithms should select only one block at a time.
3. Which: Which block should exactly be taken for erasing first? This can be done by various ways by considering the one with maximum amount of garbage in it or choose them by retrieving details such as age, update time etc. Also garbage blocks containing greater number of valid data need more time to erase as migrating times are high. This can be done using Victim Selection Algorithm.
4. Where: We need know exactly where the valid data goes. This can be done using data migration algorithms. There are different ways of enhancing reorganization of valid data like putting them together according to their age or their types etc.
4.0 Garbage Collection Algorithms
There are mainly two algorithms that help us in the cleansing effect.
1. Greedy Algorithm: It selects blocks with maximum amount of garbage in it, and then hopes to reclaim it with minimum amount of cleansing work. It doesn't take into consideration the data access patterns, and rather selects a block in FIFO style.
2. Cost-Benefit Algorithm: It is an algorithm that selects a block considering the age and utilization of data in it.
Garbage collection performance depends on the combination of victim selection
policy and data migration policy. The cost-benefit policy generally performs better than the greedy policy.
However, it does not perform well for high localities of access without combining efficient
data migration policy. After a large number of logging and cleaning operations under high localities of access, cold data mixes with hot data within each block. Afterwards, cold data
moves uselessly with hot data. For this reason, the utilization of cleaned blocks remains stable at a high value and the amount of free space collected becomes small. In simpler words, migration cost and erasure cost could be increased. For overcoming this problem, the cost-benefit policy has to combine with data migration policy that separates cold data and hot data when migrating valid data.
The Separate Block Cleaning Algorithm uses separate blocks in cleaning: one for cleaning not-cold blocks and writing new data, the other for cleaning cold segments. The separate segment cleaning was show to perform better than when only one segment is used in leaning, since hot data are less likely to mix with cold data. The Dynamic Data Clustering Algorithm clusters data according to their update frequencies by active data migration. As many flash memory file systems are based on Log-Structured File system, the separate block cleaning policy and the dynamic data clustering policy cannot be used for it.
The Age-Sort Policy is used in Log-Structured File system. It sorts the valid pages in victim blocks by the time they were last modified and migrates them at the end of log. For example,
it migrates the oldest pages first at the end of log. We use the cost-benefit with age-sort algorithm like Log-Structured File system. If we can predict the I/O workload like the number of I/O request arrivals during the next garbage collection execution, we can control the number of victim blocks to be erased according to the estimated I/O workload. If it is high, garbage collector selects at most one victim block. Otherwise, garbage collector can select many different victim blocks and thus improve its performance.
The proposed garbage collection module consists of three components (Figure 4):
1. Monitor: It measures the request arrival rate
2. Predictor - It uses the measurements from the monitor module to estimate the workload characteristics in the near future
3. Garbage Collector - It performs garbage collection task.
The monitor tracks the number of request arrivals in each measurement interval and records this value. The monitor maintains a finite history consisting of the most recent values of the number of arrivals.
The garbage collector uses the cost-benefit with age-sort algorithm. It uses the predicted workload to determine the number of victim blocks.
Figure 4. Proposed Garbage Collector Architecture
In this paper, we studied an intelligent garbage collection algorithm, which predicts I/O workload of the near future and determines the number of victim blocks according to the predicted I/O workload. If we can predict the number of I/O request arrivals during the next garbage collection execution, we use this information to control the number of victim blocks so that garbage collector can gather valid data from several victim blocks as much as possible. Proposed garbage collection scheme can reduce the cleaning cost by performing data migration efficiently.
A Flash-Memory Based File System
A Space-Efficient Flash Memory Software For Mobile Devices
An Efficient NAND Flash File System For Flash Memory Storage
An Intelligent Garbage Collection Algorithm For Flash Memory Storages
Efficient Allocation Algorithms For Flash File Systems
Fast Initialization And Memory Management Techniques For Log-Based Flash Memory File Systems
Flash File System
Flash File Systems Overview
Flash Memory File Caching For Mobile Computers
JFFS: The Journaling Flash File System
Memory-Efficient Compressed File system Architecture For NAND Flash-Based Embedded Systems
Reverse Indirect Flash File System
The Design And Implementation Of A Log-Structured File System