An Efficient Management Scheme for Large-Scale Flash-Memory ...

254 views
216 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
254
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

An Efficient Management Scheme for Large-Scale Flash-Memory ...

  1. 1. An Efficient Management Scheme for ∗ Large-Scale Flash-Memory Storage Systems † Li-Pin Chang and Tei-Wei Kuo Department of Computer Science and Information Engineering National Taiwan University, Taipei, Taiwan 106, ROC {d6526009,ktw}@csie.ntu.edu.tw ABSTRACT bedded Systems, Consumer Electronics, Portable Devices. Flash memory is among the top choices for storage media in ubiquitous computing. With a strong demand of high- 1. INTRODUCTION capacity storage devices, the usages of flash memory quickly Flash-memory is non-volatile, shock-resistant, and power- grow beyond their original designs. The very distinct char- economic. With recent technology breakthroughs in both acteristics of flash memory introduce serious challenges to capacity and reliability, flash-memory storage systems are engineers in resolving the quick degradation of system per- much more affordable than ever. As a result, flash-memory formance and the huge demand of main-memory space for is now among the top choices for storage media in ubiquitous flash-memory management when high-capacity flash mem- computing. ory is considered. Although some brute-force solutions could Researchers have been investigating how to utilize flash- be taken, such as the enlarging of management granular- memory technology in existing storage systems, especially ity for flash memory, we showed that little advantage is when new challenges are introduced by the characteristics received when system performance is considered. This pa- of flash memory. In particular, Kawaguchi, et al. [1] pro- per proposes a flexible management scheme for large-scale posed a flash-memory translation layer to provide a trans- flash-memory storage systems. The objective is to efficiently parent way to access flash memory through the emulating manage high-capacity flash-memory storage systems based of a block device. Wu, et al. [6], proposed to integrate a vir- on the behaviors of realistic access patterns. The proposed tual memory mechanism with a non-volatile storage system scheme could significantly reduce the main-memory usages based on flash memory. Native flash-memory file systems without noticeable performance degradation. were designed without imposing any disk-aware structures on the management of flash memory [7, 8]. Douglis, et al. Categories and Subject Descriptors [2] evaluated flash memory storage systems under realistic C.3 [Special-Purpose And Application-Based Systems]: workloads for energy consumption considerations. Chang, Real-time and embedded systems; D.4.2 [Operating Sys- et al. focused on performance issues for flash-memory stor- tems]: Garbage collection; B.3.2 [Memory Structures]: age systems by considering an architectural improvement [5], Mass Storage an energy-aware scheduler [4], and a deterministic garbage collection mechanism [3]. Beside research efforts from the academics, many implementation designs and specifications General Terms were proposed from the industry, such as [9, 10, 11, 12]. Design, Performance, Algorithm. While a number of excellent research results have been done on flash-memory storage systems, much work is done Keywords on garbage collection, e.g., [1, 5, 6]. Existing implementa- tions on flash-memory storage systems usually adopt static Flash Memory, Storage Systems, Memory Management, Em- table-driven schemes (with a fixed-sized granularity of flash- ∗Supported in part by a research grant from the ROC Na- memory management, e.g., 16KB.) to manage used and tional Science Council under Grants NSC91-2213-E-002-070. available space of flash-memory [1, 5, 6, 9, 10, 11]. The gran- †Since November 2003, Li-Pin Chang serves at the Judicial ularity size of flash-memory management is a permanent Yuan, Taiwan. and unchangeable system parameter. Such traditional de- sign works pretty well for small-scale flash-memory storage systems. With the rapid growing of the flash-memory ca- pacity, severe challenges on the flash-memory management Permission to make digital or hard copies of all or part of this work for issues might be faced, especially when performance degra- personal or classroom use is granted without fee provided that copies are dation on system start-up and on-line operations would be- not made or distributed for profit or commercial advantage, and that copies come a serious problem. bear this notice and the full citation on the first page. To copy otherwise, to The purpose of this research is on the minimization of the republish, to post on servers or to redistribute to lists, requires prior specific main-memory footprint and the amount of house-keeping permission and/or a fee. SAC ’04, March 14-17, 2004, Nicosia, Cyprus data written for flash-memory management. We investigate Copyright 2004 ACM 1-58113-812-1/03/04...$5.00. the behaviors of access patterns generated by realistic and
  2. 2. typical workloads with the considerations of flash-memory adopted in main memory (RAM). On the other hand, the management issues. Variable granularities of management management of available space (which includes free and dead units are adopted with the issues for address translation, pages) on flash memory must be properly managed as well. space management, and garbage collection are considered. An space management mechanism is adopted to resolve this Significant advantages in resource usages and system per- issue. Such mechanism is important for garbage collection. formance of the proposed scheme are shown by conducting Most of the traditional approaches adopt static tables to a series of experiments. deal with address translation and space management. Be- cause the granularity of the flash-memory management unit is a fixed system parameter, the granularity size would be 2. MOTIVATION an important factor on the trade off between the main- memory overheads and the system performance. For ex- 2.1 Fundamental Management Issues ample, a 20GB flash-memory storage system would need In this section, we shall first summarize the character- roughly 320MB to store the tables in main memory when istics of flash memory and then issues for the logical-to- the granularity is 512B (1 page), and each table entry is of physical address translation and the space management for 4 bytes. A similar phenomenon was reported in [6], where flash memory: 24MB of RAM was needed to manage a 1GB NOR flash A NAND flash memory 1 is organized in terms of blocks, memory when the granularity size is 256B. One brute-force where each block is of a fixed number of pages. A block solution in the minimization of main-memory usage is to en- is the smallest unit for erase operations, while reads and large the granularity size (e.g., 16KB per management unit, writes are processed in terms of pages. The typical block i.e., a block, [10]). However, such a solution could introduce size and the page size of a NAND flash memory are 16KB a significant number of data copyings and result in bad per- and 512B, respectively. There is a 16-byte “spare area” ap- formance because any update of a small piece of data results pended to every page, where out-of-band data (e.g., ECC in the write of all data in the same management unit. and bookkeeping information) could be written to the spare areas. 2.2 Observations When a portion of free space on flash memory is written (/programmed), the space is no longer available unless it is The purpose of this section is to illustrate the motivations erased. Out-place-updating is usually adopted to avoid eras- of this research based on the access patterns of realistic and ing operations on every update. The effective (/latest) copy typical workloads: of data is considered as “live”, and old versions of the data The first observation is on a realistic workload over the are invalidated and considered as “dead”. Pages which store root disk of an IBM-X22 ThinkPad mobile PC, where a live data and dead data are called “live pages” and “dead 20GB hard disk is accessed through NTFS. The activities pages”, respectively. “Free pages” constitute free space on on the mobile PC consisted of a web surfing, emails send- flash memory. After the processing of a large number of page ing/receiving, movie playing and downloading, document writes, the number of free pages on flash memory would be typesetting, and gaming. The disk traces were collected low. System activities (called garbage collection) are needed under a typical workload of common people for one month. to reclaim dead pages scattered over blocks so that they The second workload was collected over a storage system could become free pages. Because an erasable unit (a block) of multimedia appliances, and we created a process to spo- is relatively larger than a programmable unit (a page), copy- radically write and delete files over a disk to emulate the ings of live data might be involved in the recycling of blocks. access patterns of multimedia appliances. The file size was A potentially large amount of live data might be copied to between 1MB and 1GB. available space before a to-be-recycled block is erased. On The characteristics of the traces collected from the root the other hand, a block of a typical NAND flash memory disk are as follows: 30GB and 25GB data were read from could be erased for 1 million (106 ) times. A worn-out block and written to the disk, respectively. The average read size could suffer from frequent write errors. “Wear-levelling” ac- was 38 sectors, and the average write size was 35 sectors. tivities is needed to erase blocks on flash memory evenly Among all of the writes, 62% of the sizes of writes were no so that a longer overall lifetime could be achieved. Obvi- more than 8 sectors (that were called small writes), and 22% ously, garbage-collection and wear-levelling activities intro- of the sizes of writes were no less than 128 sectors (that duce significant performance overheads to the management were called bulk writes). The amount of data written by of flash memory. small writes and bulk writes contributed 10% and 77% of Due to the needs of out-place updating, garbage collec- the total amount of data written, where the logical block tion, and wear-levelling on flash memory, the physical loca- address space (LBA space) touched by small writes and bulk tions of live data could be moved around over flash-memory writes were 1% and 32% of the entire logical address space, from time to time. A common technique in the industry respectively. It was obvious that small writes had a strong is to have a logical address space indexed by LBA (Logical spatial locality. We also observed that bulk writes tended Block Address) through block device emulation [1, 10, 11] or to access the root disk sequentially. Regarding the workload native flash-memory file systems with tuples of (file ID, off- over a multimedia storage (i.e., the second workload), it was set, physical location) [7, 8]. The logical addresses of data observed that most of the writes were bulk and sequential. are recorded in the spare area of the corresponding pages These observations show the needs of a flash-memory man- (under both approaches). To provide an efficient logical-to- agement scheme with variable granularities, while traditional physical address translation, some index structures must be approaches usually adopt a fixed-sized granularity with two static tables for logical-to-physical address translation and 1 We focus on NAND flash memory because it is widely space management, as shown in Figure 1. A significant adopted in storage systems. tradeoff does exist between the usage of main memory and
  3. 3. R R Y X W W U V U RST Q P I R R Y X W W U V U ST R Q P I & f Y e U dI c T Vb `a & f Y e U dI c T Vb `a & sqg h R R Y T T g r p i ba4¥  © § ¦ F T F¥T SQ R X R ¢%( V U W ¦ rd ™ rd ™ ˜ b© ! ) F T 4 T F Y F ` ™˜ ™ f de r ˜ ˜ ` d ` dd ™ ˜™ dd 4¨¤c d ¡ ¡ X R ¢% U W ¦ j™ fr d ™ ` dd ™ ˜ ™f ™ d f d d™` f dd ™ e ` ˜ d™ d ™™ ˜ d™ d ™™ W U Y kW P H F R T ` 4%! R F g ) e h f ih f d™ d dh ˜˜ dh ˜˜ Y Yr X f g f ˜ d r ™ `` dg ˜ dg ˜ Y Y Xk f dh e ˜ ™ ` df ˜ df ˜ re f de ˜ ` f dg ˜ ` r de d ˜ r de d ˜ W˜U˜Y W e C 7 3A @ 9 8 67 5 B d f d™ dd ˜˜ dd ˜˜ ™ P H I H GE D F F ™˜ f d™ r f ˜ ™ ` ` ˜ d™ d ˜ ˜ d™ d ˜ ˜ ˜d d ) ¨4$  ' © § ¦ 1© !   0 f d ¥%$  ¡ £ # ¥¤¢  ¡ £ ¡ ¨©%¦$  § C 7 GA @ 9 8 67 5 B ¡ ¡ £ ¤ ¥ ¥ ¦ B ¦ 4A ¡ 3 9 @ 1)' 0 ( © ¨ ¤ £ ¢  ¡ ##$ m l q © © p no ¨¤  © § ¦ $© ! ' 8 £ H ¦ FG E A BD 2C 8 7 £ ¥ 6 53 ¦ ¤ ¤ 2¦ 4 ##$ ! ! ¦ § ¦ ¥ % ¢© ! x „‡ ‚ sƒ † … € ‚ „ ƒ ‚ w y y x u uvt € y € w ” w†“‰ 55— y „‚ – x ‰ € ƒ ‘‰ s ƒ 55ƒ …† € ‚ „† vt x x ‚ ‚ ‰ r „ ¥432 ¡ £ # ¥£%¥  ¡ # ( ¢%¨¤  © § ¦ ” w “‰ ‘‰ ) …ƒ ‘ …ƒ ˆ • † x ’ ‚ ‰ ” ‘‰ “‰  …ƒ “v …ƒ x ‡ ‚ € • w† x ’ ‚ ‰ ˆ „ P H F R T ` ¨ T P i ) D h f 3© ! 0 0 1© ! ) Figure 1: The table-driven method for flash-memory Figure 2: An LCPC example with a partial invali- management, in which one block consists of eight dation. pages. data updates. We propose to split the LCPC into three the system performance. A small granularity for flash-memory PC’s to reflect the fact that some data are invalid now: A, management could prevent the system from unnecessarily B, and C. At this time point, data in B are invalid, and copying of a lot of data, where a small granularity results in the most recent version is written at another space on flash huge static tables (also referred to as a main-memory foot- memory. Instead of directly reflecting this situation on the print for the rest of this paper). A brute-force way to reduce flash memory, we choose to the keep this information in the the main-memory footprint is to enlarge the management main memory to reduce the maintenance overheads of PC’s, granularity. The price paid for the benefit is on the inef- due to the write-once characteristics of flash memory. B is ficiency and the overheads in the handling of small writes. an FDPC, and A and C are LDPC’s because they could be Such a tradeoff introduces serious challenges on the scala- involved in garbage collection when the space of the original bility of flash-memory storage systems. We shall keep the LCPC is recycled. 2 main-memory footprint as low as that with a coarse man- The handling of PC’s is close to the manipulation of mem- agement granularity and, at the same time, maintain the ory chunks in a buddy system, where each PC is consid- system performance similar to that with a fine management ered as a leaf node of a buddy tree. PC’s in different lev- granularity. els of a buddy tree correspond to PC’s with different sizes (in a power of 2). A tree structure of PC’s is maintained 3. A MANAGEMENT SCHEME FOR LARGE- in the main memory. The initial tree structure is a hi- erarchical structure of FCPC’s based on their LBA’s. In SCALE FLASH-MEMORY STORAGE SYS- the tree structure all internal nodes are initially marked TEMS with CLEAN MARK. On the splitting of an FCPC and a live PC (LCPC/LDPC) the internal nodes generated are 3.1 Space Management marked with CLEAN MARK and DIRTY MARK, respec- tively. When a write request arrives, the system will lo- 3.1.1 Physical Clusters cate an FCPC with a sufficiently large size. If the allocated This section focuses on the manipulation of memory-resident FCPC is larger than the requested size, then the FCPC will information for the space management of flash memory. be split until an FCPC with the requested size is acquired. A physical cluster (PC) is a set of contiguous pages on New data will be written to the resulted FCPC (i.e., the flash memory. The corresponding data structure for each one with the requested size), and the FCPC becomes an PC is stored in the main memory. The status of a PC could LCPC. Because of the data updates, the old version of the be a combination of (free/live) and (clean/dirty). A free data should be invalidated. A similar procedure as shown PC simply means that the PC is available for allocation, in Example 3.1.1 could be done to handle the invalidation. and a live PC is occupied by valid data. A dirty PC is a When a new FDPC appears (due to invalidations), and the PC that might be involved in garbage collection for block sibling of the same parent node is also an FDPC, we should recycling, where a clean PC does not. In other words, An replace the parent node with a new FDPC of its FDPC’s. LCPC, an FCPC, and an FDPC are a set of contiguous live The merging could be propagated all the way to the root. pages, free pages, and dead pages, respectively. Similar to LCPC’s, an LDPC is a set of contiguous live pages, but it 3.1.2 PC-Based Garbage Collection could be involved in garbage collection. The purpose of garbage collection is to recycle the space occupied by dead (invalidated) data on flash memory. In this Example 3.1.1. An LDPC Example: section, we shall propose a garbage collection mechanism Consider an LCPC that denotes 16 contiguous pages with based on the concept of PC. a starting LBA as 100, as shown in Figure 2. The starting Consider the results of a partial invalidation on an 128KB LBA and the size of the LCPC are recorded in the spare LCPC (in the shadowed region) in Figure 3. Let the partial area of the first page of the LCPC. Suppose that pages with invalidation generate internal nodes marked with DIRTY MARK. LBA’s ranged from 108 to 111 are invalidated because of Note that the statuses of pages covered by the subtree with
  4. 4. Page Attribute Cost Benefit     Hot (contained in LCPC/LDPC) 2 0 Cold (contained in LCPC/LDPC) 2 1 ¢ © ¦ ¤ ¥ ¢ © ¦ ¤ ¥ Dead (contained in FDPC) 0 1 Free (contained in FCPC) 2 0 ¡ ¢ £ ¤ ¥ ¡ ¢ £ ¤ ¥ ¦ § ¤ ¥ Table 1: The cost and benefit for each type of page. ¦ § ¤ ¥ ¨ ¢ ¤ ¥ ¨ ¢ ¤ ¥ to B). The system then applies erase operations on blocks of the FDPC. In this example, 96KB (=64KB+32KB) is ( ) 0 ) @ ) ( C 0 ) @ ) ¥ 1 2 3 4 1 5 6 1 7 8 9 7 A 5 7 3 8 B 2 5 1 4 5 6 1 7 8 9 7 A 5 7 3 8 B ! # $ ¤ reclaimed on flash memory, and the overheads for garbage collection is on the copying of 32KB live data (i.e., those for LDPC C) and the erasing of 8 contiguous blocks (i.e., the ¤ % $ ' # $ 128KB covered by the proper dirty subtree). 2 Figure 3: A proper dirty subtree (in the shadowed Since the garbage collection problem is intractable even region) with two FDPC’s and one LDPC. for each garbage collection pass (as shown in Theorem 3.1.3), an efficient on-line implementation is more useful than the optimality consideration. We propose to extend the value- a DIRTY MARK root have not been updated on flash mem- driven heuristic proposed by Chang and Kuo in [5] to man- ory. A subtree is considered dirty if its root is marked with age garbage collection over PC’s. Since the management DIRTY MARK. The subtree in the shadowed region in Fig- unit under the proposed management scheme is one PC, ure 3 is a dirty subtree, and the flash-memory address space the “weight” of one PC could now be defined as the sum of covered by the dirty subtree is 128KB. The proper dirty sub- the “cost” and the “benefit” to recycle all of the pages of the tree of an FDPC is the largest dirty subtree that covers all PC. The functions cost() and benefit() are integer functions pages of the FDPC. to calculate the cost and the benefit in the recycling of one page, respectively. The return values for the cost() and ben- Definition 3.1.2. The Garbage Collection Problem efit() functions for different types of pages are summarized Suppose that there is a set of n available FDPC’s F D = in Table 1. Based on the returned values, the weight in the {f d1 , f d2 , f d3 , ..., f dm }. Let Dtree = {dt1 , dt2 , dt3 , ..., dtn } recycling of a dirty subtree could be calculated by summing be the set of the proper dirty subtrees of all FDPC’s in F D the weights of all PC’s contained in the dirty subtree: Given (m ≥ n), fsize (dti ) a function on the number of dead pages a dirty subtree dt and a collection of PC’s {pc1 , pc2 , ..., pcn } of dti , and fcost (dti ) a function on the cost in recycling dti . in dt. Let pi,j be the j − th page in PC pci . The weight of Given two constants S and R, the problem is to find a subset dt could be calculated by the following formula: Dtree ∈ Dtree such that the number of pages reclaimed in a garbage collection is no less than S, and the cost is no more n than R. weight(dt) = ( benef it(pi,j ) − cost(pi,j )). (1) i=1 ∀pi,j ∈pci Theorem 3.1.3. The Garbage Collection Problem is NP- Complete. For example, let LDPC C in Figure 3 contain hot (and Proof. The Garbage Collection Problem could be re- live) data. The weight of the proper dirty subtree of LDPC duced from the Knapsack Problem. 2 C (i.e., the dirty subtree rooted by node B) could be derived A PC-based garbage collection mechanism is based on as (0 − 2 ∗ 64) + (64 − 0) + (128 − 0) = 64. The garbage CLEAN MARK and DIRTY MARK proposed in the previ- collection policy would select the candidate which has the ous paragraphs: When an FDPC is selected to recycle (by a largest weight for garbage collection. garbage collection policy), we propose to first find its proper dirty subtree. All LDPC’s in the proper dirty subtree must 3.1.3 Allocation Strategies be copied to somewhere else before the space occupied by There are three cases for space allocation when a new the proper dirty subtree could be erased. After the copying request arrives: The priority for allocation is on Case 1 and of the data in the LDPC’s, the LDPC’s will be invalidated then Case 2. Case 3 will be the last choice. as FDPC’s, and the FDPC’s will be merged as one large Case 1: There exists an FCPC that can accommodate FDPC. Erase operations are then executed over the blocks the request. of the one large FDPC and turn it into a FCPC. We shall The searching of such an FCPC could be done by a best- use the following example to illustrate the activities involved fit algorithm. That is to find an FCPC with a size closest to in garbage collection: the requested size. Note that an FCPC consists of 2i pages, where 0 ≤ i. If the selected FCPC is much larger than the Example 3.1.4. An example on garbage collection: request size, then the FCFC could be split according to the Suppose that FDPC A is selected to recycle, as shown mechanism presented in Section 3.1.1. in Figure 3. The proper dirty subtree of FDPC A is the Case 2: There exists an FDPC that can accommodate subtree with the internal node B as the root. All data in the the request. LDPC’s (i.e., LDPC C) of the dirty subtree must be copied The searching of a proper FDPC is based on the weight to somewhere else. After the data copying, every LDPC in function value of PC’s (Please see Equation 1 in Section the subtree become a FDPC. All FDPC’s in the subtree will 3.1.2). We shall choose the FDPC with the largest func- be merged into a single FDPC (at the node corresponding tion value, where any tie-breaking could be done arbitrarily.
  5. 5. Garbage collection needs to be done according to the algo- # ! #IHG A # Q! #IHG A ) ( ' ! % $ ) ( ' ! % $ rithm in Section 3.1.2. 4302 10 ¦ ¥ © §¨£ ¦ ¤¥ ¡¡¢£   4302 10 Case 3: Otherwise (That is no single type of PC’s that ¦ ¥ © §¨£ ¦ ¤¥ ¡¡¢£   6 503 153 02 6503 15302 could accommodate the request.). To handle such a situation, we propose to “merge” avail- 2 604 17 503 ¦ ¥ © §¨£ ¦ ¤¥ ¡¡¢£   2 604 17 503 able PC’s (FCPC’s and FDPC’sare all referred to as avail- 980513604 ¦ ¥ §¨£© ¦ ¤¥ ¡¡¢£   980513604 able PC’s for the rest of this section) repeatedly until an 822 9 1@805 ¦ ¥ §¨£© ¦ ¤¥ ¡¡¢£   822 9 1@805 FCPC that can accommodate the request size appears. We 452 @ 10329 ¦ ¥ §¨£© ¦ ¤¥ ¡¡¢£   4 52 @ 1032 9 shall use the following example to illustrate how available 6@2 6 1552@ ¦ ¥ §¨£© ¦ ¤¥ ¡¡¢£   6@2 6 1552 @ PC’s are merged: 3827 17@26 ¦ ¥ §¨£© ¦ ¤¥ ¡¡¢£   382 7 17@2 6 ¦ ¦ # B # ! A # B # ! A ¦ ¦ # FD C E # FD C E T ! S QG # G ! G ' R Q! ' #' ' Q! G P ) $ ' R U # # ! B ! G ' ! R' Q! ' ' #Q! G P ) $S T # ! ' % B H R Q! ! H V ! # Figure 5: An example layout of the hash table for § ¨ © logical-to-physical address translation.   ¡ ¢ £ ¢   ¥ ¢ £ ¢   ¢ ¡ ! # $ % ' Let N = 2k for some non-negative integer k. If Case 3 is   ¡ ¤ £ ¢   ¥ ¤ £ ¢   ¤ ( ) 0 $ % ' true, the sizes of all available PC’s are smaller than N , and the sizes of available PC’s could only be one of the collection T = {20 , 21 , ......, 2k−1 }. Consider a merging process. If Figure 4: An example on the merging of an FCPC there do not exist any two available PC’s of the same size, with an FDPC then there should be no duplication of any available PC size in T . In other words, the total size of the available PC’s is a summation of 20 , 21 , · · · , 2k−1 and is less than N = Example 3.1.5. The merging of available PC’s 2k . It contradicts with the assumption that the total page Figure 4 shows how to merge C (i.e., an FCPC) and E number of available PC’s M is no less than N . There must (i.e., an FDPC). First, data in the pages of the buddy of E, exist at least two available PC’s of the same size. The same i.e., D, are copied to the pages of C, where C and D are an argument could be applied to any of the merging process LCPC and an LDPC, respectively. After the data copying such that we can always find and merge two available PC’s from the pages of D to the pages of C, D is invalidated of the same size until an FCPC of a proper size is created to entirely and becomes an FDPC. D (which was an LDPC) accommodate the request. We conclude that the procedure is merged with E, i.e., an FDPC, and the merging creates illustrated in Case 3 will produce an FCPC to accommodate an FDPC, i.e., F , as shown in the right-hand-side of Figure the request, and the allocation algorithm is correct. 2. 4.2 Note that once a sufficiently large FDPC is obtained, it is then recycled to be an FCPC. The space allocation algo- 3.2 Logical-to-Physical Address Translation rithm always assigns 2i pages to a request, where i is the In this section, we shall propose a hash-based approach to smallest integer such that the request size is no larger than handle logical-to-physical address translation. 2i pages. Every PC consists of 2i pages for some i ≥. We As pointed out in the previous sections, the physical loca- shall show that the above allocation algorithm always suc- tions of live data might change from time to time, due to the ceeds if the total size of existing FCPC’s and FDPC’s is out-place updates on flash memory. Traditional approaches larger than the request size. Note that the correctness of usually maintain a static array to resolve the correspond- this algorithm is proven with requests of 2i pages. ing physical addresses by given some logical addresses, as shown in Figure 1. The static array is indexed by logical Theorem 3.1.6. Let the total size of available PC’s be addresses, and the element in each array entry is the corre- M pages. Given a request of N pages (M ≥ N ), the space sponding physical address. allocation algorithm always succeeds. The space management unit for our approach is a physical Proof. If there exists any available PC that can accom- cluster (PC), instead of one page. We propose to adopt a modate the request, then the algorithm simply chooses one main-memory-resident hash table, where each hash entry is proper PC (an FCPC or an FDPC) and returns (and proba- a chain of tuples for collision resolution. Each tuple (start- bly do some splitting as described in Section 3.1.1), as shown ing logical address, starting physical address, the number of in Case 1 and Case 2 mentioned above. Otherwise, all avail- pages) represents a logical chunk (LC) of pages in consecu- able PC’s can not accommodate the request. The available tive locations, and the number of pages in an LC does not PC’s are all smaller than the requested size N , as shown in need to be a power of 2. Case 3. To handle the request, the merging of available PC’s The logical address space of flash memory is first exclu- will be proceeded to produce an FCPC to accommodate the sively partitioned into equal-sized regions referred as logical request. To prove that the procedure illustrated in Case 3 regions (LR’s) for the rest of this paper. Suppose that the could correctly produce an FCPC to accommodate the re- total logical address space is from page number 0 to page quest, we first assume that the procedure in Case 3 can not number 2n − 1, and each LR is of 2m pages. We propose a correctly produce an FCPC to accommodate the request: It dynamic-hashing-based method. Initially we have a direc- is proved by a contradiction. tory which is a static array with 2n−m entries, where one

×