|Publication number||US7409527 B2|
|Application number||US 11/163,822|
|Publication date||Aug 5, 2008|
|Filing date||Nov 1, 2005|
|Priority date||Nov 1, 2004|
|Also published as||US20060095707|
|Publication number||11163822, 163822, US 7409527 B2, US 7409527B2, US-B2-7409527, US7409527 B2, US7409527B2|
|Original Assignee||Qisda Corporation|
|Export Citation||BiBTeX, EndNote, RefMan|
|Patent Citations (6), Referenced by (6), Classifications (7), Legal Events (6)|
|External Links: USPTO, USPTO Assignment, Espacenet|
1. Field of the Invention
The present invention relates to a data storing method, and more specifically, to a bi-directional data storing method for storing data sets selectively from one of two terminals of a memory block.
2. Description of the Prior Art
In general, for storing data sets, there are three primary methods: ordered, unordered, and hashed data-storing methods. The characteristic of the ordered data-storing method is to physically order the data sets stored in a memory. That is, when writing a data set into the memory, the system needs to perform a sorting operation to physically order the data sets stored in the memory. The characteristic of the unordered data-storing method is to write the data sets into the memory according to the time sequence of receiving the data sets. Hence, compared with the ordered data-storing method, when storing a data set, the unordered data-storing method omits a corresponding sorting operation. Because the data sets stored in the memory are not arranged in order conforming to any kind of rule, the system needs to further provide a mapping table to record a starting address and a size of each data set. Therefore, when accessing a specific data set, the system reads the address of the specific data set recorded in the mapping table without sequentially searching the memory for the specific data set. The hashed data-storing method performs a computation operation on each data set by using a hash function, wherein a value generated by the computation operation corresponds to a predetermined memory address. Hence, when accessing the data set, the system only needs to perform a computation operation using the hash function and then the memory address corresponding to the data set can be generated.
These three data-storing methods will be limited when they are applied in a system with a small memory, such as a memory in a mobile phone. Usually, a mobile phone's memory capacity is small. A possible consequence of this is that when utilizing the above-mentioned hashed data-storing method, if the system cannot select an appropriate hash function, a situation in which the memory is wasted may occur. Compared with the hashed data-storing method, the ordered data-storing method can efficiently utilize all of the memory. The disadvantage is that it is necessary to perform the above-mentioned sorting operation when storing each data set, which is a heavy load for the mobile phone, because the mobile phone has less computational abilities. It could therefore be concluded that for the mobile phone, the unordered data-storing method would seem to be an appropriate compromise. The unordered data-storing method writes the data sets into the memory according to the time sequence of receiving the data sets. A disadvantage of this method, however, is that memory spaces allocated and released by any kind of the three above-mentioned data-storing methods will discontinuously exist in the memory and cannot be utilized again. Hence, after a certain period of time, it is necessary to perform a defragmentation operation on the memory in order to combine the above-mentioned discontinuous memory spaces with remaining spaces of the memory, to allow the combined available memory spaces to be allocated for storing other data sets.
Please refer to
One of the objectives of the claimed invention is therefore to provide a bi-directional data storing method to solve the above-mentioned problem, thereby preventing an excessively long time being spent on defragmentation operations.
According to the claimed invention, a data managing method for storing all management data in a management bank of a non-volatile memory is disclosed. A bi-directional data storing method for storing data in a storage apparatus is disclosed. The storage apparatus comprises a plurality of memory blocks. The bi-directional data storing method comprises: receiving a data set; selecting a first writing direction or a second writing direction to be a preferred writing direction of a target memory block; and writing the data set into the target memory block according to the selected writing direction.
In addition, the claimed invention provides an electronic device. The electronic device comprises: a memory block comprising a first terminal and a second terminal; and a program, wherein when executing the program, a data set is generated and the program selectively writes the data set into the memory block from the first terminal or the second terminal.
The data storing method according to the claimed invention writes a data set into a memory block selectively from the first terminal or the second terminal, which means the size of the data sets that need to undergo a defragmentation operation are reduced to one half of their size (at the most), and therefore the time spent by the memory defragmentation operation can be substantially reduced.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
Please refer to
Step 110: Start.
Step 112: Receive a data set.
Step 114: Select a target memory block from a plurality of memory blocks in order to write the data set into the target memory block.
Step 116: Determine if the total amount of the data sets written into the target memory block according to the first writing direction is greater than the total amount of the data sets written into the target memory block according to the second writing direction; if not, proceed to step 122; otherwise, proceed to step 124.
Step 122: Write the data set according to the first writing direction. Proceed to step 126.
Step 124: Write the data set according to the second writing direction. Proceed to step 126.
Step 126: Record a writing address of the data set into a mapping table and record the total amount of the data set written according to the writing direction.
Step 128: End.
In the present embodiment, two pointers, a first pointer and a second pointer, are adopted in a way for determining whether the total amount of the data sets written into the target memory block according to the first writing direction is greater than the total amount of the data sets written into the target memory block according to the second writing direction. A first pointer is utilized for indicating the total amount of the data sets written according to the first writing direction, and the second pointer is utilized for indicating the total amount of the data sets written according to the second writing direction. A detailed description of the above-mentioned method will be described later.
Please refer to
Please refer to
Please refer to
Step 202: Start.
Step 204: Compute the size of a remaining space of each memory block.
Step 206: Determine if there is at least one memory block whose remaining space is large enough for storing the data set; if so, proceed to step 208; otherwise, proceed to step 210.
Step 208: Select a memory block with a smallest remaining space from the memory blocks, whose remaining space is large enough for storing the data set, to be a target memory block.
Step 210: Compute a fragmentation level of each memory block.
Step 212: Select a memory block with a greatest fragmentation level to be a target-defragment memory block, and compute fragmentation levels corresponding to the data sets written into the target-defragment memory block according to the first and the second writing directions respectively.
Step 214: Select the writing direction corresponding to a greater fragmentation level and perform a defragmentation operation on the target-defragment memory block corresponding to the selected writing direction, then proceed back to step 204.
In the present embodiment, the fragmentation levels are computed by determining if there are several discontinuous memory spaces in a memory block according to the starting address and the size of each of the data sets recorded in a mapping table (i.e. the mapping table 180 shown in
Please refer to
Please refer to
When the system further receives a data set C2 whose size is 40 bits, and the sizes of the remaining spaces of the memory blocks 320, 340, and 360 are 20 bits, 5 bits, and 30 bits respectively, it can be seen that none of them is large enough for storing the data set C2. Hence, the system will further compute the fragmentation levels of the memory blocks 320, 340, and 360. A conventional method for computing a fragmentation level is utilized in the present embodiment. That is, the address and the size of each of the data sets recorded in the mapping table utilized by the storage apparatus 300 are queried, the released memory spaces (parts with oblique lines shown in
Compared to the related art, the bi-directional data storing method according to the present invention arranges a plurality of data sets to be averagely spread in two terminals of a memory block according to a selected writing direction. Assume that the data amount of the data sets is m bits. Then the data amount of the data sets written from each of the two terminals is about m/2 bits. When performing a defragmentation operation, each of the conventional data storing methods will need to perform a defragmentation operation on the whole memory block. Therefore, the complexity of the defragmentation operation is about mx. However, the complexity of the bi-directional data storing method according to the present invention performing a defragmentation operation on the whole memory block is
which is obviously less than mx the complexity of the conventional method. In addition, the bi-directional data storing method averagely spreads the data sets of m bits over the two terminals of the memory block. Hence, when the time for performing a defragmentation operation is limited and it is necessary to select one half of all data sets and perform a defragmentation operation on that half of all data sets, then the complexity of the defragmentation operation of that half of all data sets is about
Therefore, the bi-directional data storing method can not only reduce the complexity of performing a defragmentation operation on a memory block, but can also use only a half of the time originally needed to perform a defragmentation operation on the memory block. When time is limited, a defragmentation operation on a half of the memory block is performed first, and a defragmentation operation on the other half of the memory block is performed when a controller (i.e. a micro-processor) is not so busy. In this way, the controller can arrange the tasks more flexibly and the performance of the system can be further improved.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.
|Cited Patent||Filing date||Publication date||Applicant||Title|
|US5712740 *||Feb 26, 1996||Jan 27, 1998||Sony Corporation||Method for reducing wasted storage space when storing multiple data blocks on a storage medium|
|US6594052 *||Apr 20, 1999||Jul 15, 2003||Sony Corporation||Transmitting apparatus and method, receiving apparatus and method, distribution medium and transmitting system|
|US20040103241 *||Oct 2, 2003||May 27, 2004||Sandisk Corporation||Method and apparatus for effectively enabling an out of sequence write process within a non-volatile memory system|
|US20040236897 *||May 19, 2003||Nov 25, 2004||Chi-Chih Cheng||System and method for optimized access to memory devices requiring block writing|
|US20040268063 *||Jun 30, 2003||Dec 30, 2004||M-Systems Flash Disk Pioneers, Ltd.||Flash memory management method that is resistant to data corruption by power loss|
|JPH09134312A||Title not available|
|Citing Patent||Filing date||Publication date||Applicant||Title|
|US7562203 *||Sep 27, 2006||Jul 14, 2009||Network Appliance, Inc.||Storage defragmentation based on modified physical address and unmodified logical address|
|US8639900 *||May 25, 2011||Jan 28, 2014||International Business Machines Corporation||Defragmentation of data storage pools|
|US8661217 *||Apr 26, 2012||Feb 25, 2014||International Business Machines Corporation||Defragmentation of data storage pools|
|US20080077762 *||Sep 27, 2006||Mar 27, 2008||Network Appliance, Inc.||Method and apparatus for defragmentation|
|US20120303916 *||May 25, 2011||Nov 29, 2012||International Business Machines Corporation||Defragmentation of data storage pools|
|US20120303918 *||Apr 26, 2012||Nov 29, 2012||International Business Machines Corporation||Defragmentation of data storage pools|
|U.S. Classification||711/219, 711/217, 711/E12.006, 711/218|
|Nov 1, 2005||AS||Assignment|
Owner name: BENQ CORPORATION, TAIWAN
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:HU, CHIH-LIN;REEL/FRAME:016709/0345
Effective date: 20051024
|Jun 25, 2008||AS||Assignment|
Owner name: QISDA CORPORATION, TAIWAN
Free format text: CHANGE OF NAME;ASSIGNOR:BENQ CORPORATION;REEL/FRAME:021145/0282
Effective date: 20070831
|Sep 22, 2011||FPAY||Fee payment|
Year of fee payment: 4
|Mar 18, 2016||REMI||Maintenance fee reminder mailed|
|Aug 5, 2016||LAPS||Lapse for failure to pay maintenance fees|
|Sep 27, 2016||FP||Expired due to failure to pay maintenance fee|
Effective date: 20160805