Flash memory management method

A method for managing a flash memory is provided wherein logical addresses of data recorded in a data region of the flash memory are recorded in a corresponding spare region. An address mapping table is produced by scanning information recorded in the spare region. As a result, the flash memory can be embodied more effectively. In addition, it is possible to restore a mapping table even though the power is suddenly cut-off.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is based upon and claims priority from Korean Patent Application No. 2001-71401 filed Nov. 16, 2001, the contents of which are incorporated herein by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to flash memory, and more particularly, to a method for managing flash memory in a system based on flash memory.

2. Description of the Related Art

A flash memory is a non-volatile memory device for electrically deleting or rewriting data. A storage device based on a flash memory has lower power consumption and is smaller than a storage device based on magnetic disk memory. Thus, the flash memory has been researched as an alternative of the magnetic disk memory. More importantly, the flash memory is expected to be used as a storage device for mobile computing devices, such as a digital camera, a mobile phone, and a Personal Digital Assistant (PDA).

However, unlike magnetic disk memory which is capable of data overwriting, the flash memory cannot overwrite data. In order to overwrite data stored in the flash memory, existing data must be deleted first. In other words, memory cells should be returned to an initial writable state. Generally, deleting takes much longer time than writing. Furthermore, deleting is performed in a much larger block than that of writing, possibly causing the deletion of a portion of the existing data where writing is not requested to be deleted. Since a portion of the existing data that has been unintentionally deleted should be restored by rewriting, a request for writing data may require one deletion and rewriting some of the deleted portion. Writing capability remains considerably behind compared to the reading capability due to discordance) of the units for performing a deletion and writing. Further, writing capability is lower than that of a storage device based on a magnetic disk accompanying necessary delays due to mechanical operations.

Generally, a re-mapping method is used in managing the flash memory due to the above mentioned characteristics. The re-mapping method refers to a method of writing data to be corrected in empty addresses and updating mapping information of a mapping table, in other words, to a method of changing a physical address indicated by a requested logical address to a physical address to be recorded by corrected data. Accordingly, applications and application systems can access corrected data using one logical address.

FIG. 1is a conceptual diagram illustrating a method for managing a conventional flash memory. Referring toFIG. 1, a logical address requested to read or write is changed into a physical address with reference to a mapping table and read/write data in corresponding addresses in the flash memory.

Here, there are various management methods depending on the locations of the existing mapping table and the method for referring to them. When the mapping table is positioned in a particular position of a flash memory, data can be maintained even though power is suddenly cut-off. As a result, there is no need to search for a method for restoring a mapping table. However, it is not easy to correct the mapping table. In other words, as described above, in the case of deleting, correcting, or rewriting data in performing operations in predetermined applications, large amounts of overhead calculations are required in order to update the mapping table.

In a case where the mapping table is positioned in a main memory (generally DRAM), it does not require a long period of time to access the main memory and it is easy to restore it, but data is lost, if the power is suddenly cut-off. In order to restore the mapping table, much time is required in performing complicated overhead calculations.

As described above, if re-mapping is adopted, space and time for storing and managing not only data but also mapping information are required. Accordingly, it is important to develop a method for handling a process of reading or writing data more efficiently. Furthermore, flash memory is limited in the number of partial writes in which the order of recording data, information, etc. has an effect on improving the capabilities of a system.

SUMMARY OF THE INVENTION

It is an object of the present invention to provide a method for managing flash memory of which capability is improved.

It is another object of the present invention to provide a method for conveniently producing a mapping table.

It is still another object of the present invention to provide a method for conveniently restoring a mapping table even though the power is suddenly cut-off.

To achieve the above objects, there is provided a method for managing a flash memory. Logical addresses of data recorded in a data region of the flash memory are recorded in a corresponding spare region. An address mapping table is produced by scanning information recorded in the spare region.

A produced address mapping table is recorded in a main memory or a produced address mapping table is recorded in the flash memory.

It is preferable that producing the address mapping table includes a step of producing the address mapping table by scanning logical addresses recorded in a particular spare region.

It is preferable that recording the logical addresses of data recorded in a data region of the flash memory in a corresponding spare region includes steps: recording time marks indicating orders of recording corresponding data in the spare region, and recording deletion marks indicating possibilities of using the corresponding data in the spare region.

To achieve above objects, there is provided a method for managing a flash memory. Writing-requested data is recorded in an empty address of a data region of the flash memory with reference to an address mapping table and corresponding logical addresses are recorded in corresponding spare regions. A correction table is updated so that physical addresses where the data is recorded are mapped to the logical addresses.

It is preferable that a deletion mark indicating the possibility of use of the recorded data is marked in spare regions corresponding to the physical addresses corresponding to the logical addresses with reference to the address mapping table.

To achieve the above objects, there is provided a method for managing a flash memory. Changes of an address mapping table stored in the flash memory containing mapping information of logical addresses and physical addresses are recorded in a correction table formed in a main memory. It is confirmed if the correction table is filled to a predetermined portion. If the predetermined portion of the correction table is filled, changes recorded in the correction table are reflected to the mapping table. The portions reflected to the mapping table of the contents recorded in the correction table are deleted.

DETAILED DESCRIPTION OF THE INVENTION

The present invention will now be described more fully with reference to the accompanying drawings, in which the preferred embodiments of the invention are shown.

FIG. 2is a block diagram of a flash memory system according to a preferred embodiment of the present invention. Referring toFIG. 2, the system comprises a memory1, a read only memory (ROM)2, a random access memory (RAM)3, and a processor4. Here, the RAM3, the main memory, is embodied as a dynamic random access memory (DRAM). However, if necessary, the RAM3may be embodied as a static random access memory (SRAM).

Generally, the processor4integrated with a program code recorded in the ROM2sends a series of write and deletion commands for the flash memory1or RAM3. The flash memory1performs the write and deletion calculations according to the method for managing the flash memory of the present invention. The ROM2and the RAM3store an application code performed in the processor4or its related data structure.

FIGS. 3 and 4are detailed configuration views of a flash memory according to the present invention. Referring toFIGS. 3 and 4, the flash memory1is divided into a hardware data region and a spare region. The sectors of a data region and a spare region are formed to correspond to one another. Data is written in the data region, and logical addresses, time marks, and deletion marks are written in the corresponding spare region. The time mark indicates the time when corresponding data was written. The deletion mark indicates if the particular data is effective, in other words, the possibility of use, and the deletion mark shows that the contents in the particular sector is negligible and can be deleted even though the effective data is physically recorded in the sector. In other words, the deletion mark stands for a logical deletion.

In the first embodiment, a mapping table is positioned in the flash memory1. The mapping table is produced by the processor4when a system is booted. The processor4produces a mapping table by scanning logical addresses, time marks, and deletion marks recorded in the spare region. The logical addresses and particular physical addresses are mapped in the mapping table. In addition, corresponding time marks and deletion marks are also recorded in the mapping table.

A correction table is positioned in the RAM3. The correction table is for storing only changed contents of the mapping table in a case where data is newly recorded or already existing data is corrected when a predetermined application is performed. In other words, if the existing data recorded in the predetermined logical address is corrected, the processor4does not perform a deletion calculation, writes corrected data in empty sectors, and writes corresponding logical addresses and time marks in the corresponding spare regions. Accordingly, the correction table is mapped by a physical address of a sector where corrected data is recorded. It is possible to update mapping information quickly by separately placing a correction table in the RAM3without updating the mapping table positioned in the flash memory1. In the meantime, the correction table has a fixed size. Accordingly, if all the regions in the correction table are used up, the processor4produces a new mapping table by reflecting changes recorded in the correction table to a mapping table positioned in the flash memory1and empties the correction table. When a particular portion of the correction table is filled, it is possible to adapt a method for reflecting the corrections to the mapping table and emptying only reflected portions of the correction table, if necessary. The mapping table is positioned in the RAM3and lost, if the power is cut-off.

A mapping table is positioned in the RAM3in the second embodiment. In this case, it is not necessary to additionally form correction tables. Because writing and deletion are easily performed in the RAM3unlike the flash memory1. In other words, positioning the mapping table in the RAM3can be adopted if the RAM3has sufficient space due to sufficient system sources. In a case where data is newly written or existing data is corrected in the process that a predetermined application is performed, the processor4reflects changed contents by directly correcting the mapping table. However, if an additional correction table is further formed, it is managed with the same method as that in the first embodiment.

A process for booting a flash memory system and accessing the flash memory1will be described as follows.

When a system is booted, the processor4scans the entire spare region of the flash memory1, produces a mapping table reflected by a current written state of the flash memory1, and writes the mapping table in the flash memory1or the RAM3. If more than two same logical addresses are found in the scanning process, new information is selected by comparing the existence of a deletion mark and a time mark. If old information is not marked with a deletion mark, a deletion mark is added.

When accessing the flashing memory1, the processor4searches a correction table to determine whether a corresponding logical address exists. If the corresponding logical address exists, the processor4finds a mapped physical address. If there is no particular logic address in the correction table, a physical address mapped to the corresponding logical address is found by searching the mapping address.

A method for managing a flash memory based on the above configuration will be described as follows.

FIG. 5is a flow chart illustrated to describe a method for managing flash memory according to an embodiment of the present invention. Referring toFIG. 5, the processor4writes data in a data region of the flash memory1and writes the logical address of the written data in a corresponding spare region (step501). Every time the data in the flash memory1is newly written or corrected, the step501is performed. If the power is cut-off and the system is rebooted (step502), the processor4produces a mapping table by scanning the entire spare region (step503). The processor4writes the produced mapping table in the RAM3, which is a main memory (step504-1), or writes the produced mapping table in the flash memory1(step504-2).

FIG. 6is a flow chart illustrated to describe a method for managing a flash memory according to another embodiment of the present invention. Referring toFIG. 6, if predetermined data is written in a requested logical address, the processor4searches for a correction table (step601). If there exists a requested logical address (step602), an empty sector is searched with reference to a mapping table, corresponding data is written in a data region, and its logical address is written in a corresponding spare region (step603). Here, time marks are recorded together. Next, a deletion mark is recorded in a spare region of the sectors where the data is recorded with reference to the mapping table (step604). Next, the existing entries written in the correction table are updated in order to be mapped to the physical addresses of the sector recorded in the step603(step605).

In a case where a requested logical address does not exist (step602), a mapping table is searched (step606). If a requested logical address exists (step607), empty sectors are searched with reference to the mapping table, corresponding data is recorded in a data region, and its logical address is written in a corresponding spare region (step608). Here, time marks can be recorded together. In addition, deletion marks are recorded in a spare region of the sectors where the existing data is written with reference to the mapping table (step609). Furthermore, new entries are added in the correction table so it is reflected that the step608was performed.

If a requested logical address does not exist in the mapping table (step607), empty sectors are searched with reference to the mapping table, corresponding data is recorded in a data region, and its logical address is written in a corresponding spare region (step611). Here, time marks can be recorded together. In addition, new entries are added in the correction table so it is reflected that the step611was performed (step612).

FIG. 7is a flow chart illustrated to describe a process for updating the mapping table.

Referring toFIG. 7, if the correction table is filled (step701), the processor4is influenced by the information of changes recorded in the correction table (step702). In other words, the state of the mapping information recorded in the mapping table becomes the same as that of the currently recorded state in the flash memory1. In the meantime, the processor4empties the correction table so that new entries may be recorded (step703).

On the other hand, it is possible that the method for managing the flash memory is written by computer programs. It can be easily presumed that codes and code segments comprising the programs can be made by computer programmers skilled in the art. In addition, the programs are stored in computer readable medium, and read and run by computers, thus a method for managing the flash memory is embodied. Computer readable medium comprises a magnetic recording medium, an optical recording medium, and a carrier wave medium.

As described above, a flash memory can be more effectively accessed according to the present invention. It is possible to restore a mapping table even though the power is suddenly cut-off by recording logical addresses in a spare region. The spare region is formed to as a separate hardware from a data region, thus restoring a mapping table is performed more quickly than other scanning the spare regions. In addition, in a case when a mapping table exists in a flash memory, it is possible to save time and energy in updating the mapping table by forming a correction table in a main memory and recording changes in the correction table. Accordingly, system capabilities are improved.