[go: up one dir, main page]

JP5183662B2 - Memory control device and memory control method - Google Patents

Memory control device and memory control method Download PDF

Info

Publication number
JP5183662B2
JP5183662B2 JP2010076287A JP2010076287A JP5183662B2 JP 5183662 B2 JP5183662 B2 JP 5183662B2 JP 2010076287 A JP2010076287 A JP 2010076287A JP 2010076287 A JP2010076287 A JP 2010076287A JP 5183662 B2 JP5183662 B2 JP 5183662B2
Authority
JP
Japan
Prior art keywords
garbage collection
file
sector
flash memory
copy
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2010076287A
Other languages
Japanese (ja)
Other versions
JP2011209963A (en
Inventor
幸司 吉川
成憲 中田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2010076287A priority Critical patent/JP5183662B2/en
Publication of JP2011209963A publication Critical patent/JP2011209963A/en
Application granted granted Critical
Publication of JP5183662B2 publication Critical patent/JP5183662B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Memory System (AREA)

Description

本発明は、フラッシュメモリを制御する技術に関し、特に、ガベージコレクションの実行タイミングを制御する技術に関する。   The present invention relates to a technique for controlling a flash memory, and more particularly to a technique for controlling the execution timing of garbage collection.

近年、不揮発性の記録媒体であるフラッシュメモリは、パーソナルコンピュータ等の情報処理装置、携帯電話やデジタルカメラ等、様々な電子機器で使用されている。フラッシュメモリでは、上書き動作が行えないため、更新データは、空いている(未使用)の別のセクタに書き込まれると共に、元(更新前)のデータが格納されていたセクタの状態(フラグ)は、“削除”に更新される。また、フラッシュメモリでは、データの消去は、ブロック単位で行なわれる。したがって、“削除”セクタの多いブロック内のライト(使用中)セクタを他のブロックに移動させ、未使用ブロックとする処理(ガベージコレクション)を定期的に実行する必要がある。   In recent years, flash memories, which are nonvolatile recording media, are used in various electronic devices such as information processing apparatuses such as personal computers, mobile phones and digital cameras. In flash memory, the overwrite operation cannot be performed, so the update data is written to another vacant (unused) sector, and the state (flag) of the sector where the original (pre-update) data was stored is , Updated to “delete”. In the flash memory, data is erased in units of blocks. Therefore, it is necessary to periodically execute a process (garbage collection) in which a write (in use) sector in a block with many “deleted” sectors is moved to another block and used as an unused block.

これに関し、特許文献1では、フラッシュメモリをファイルシステムに適応させることが可能な管理方式において、各消去単位毎の消去回数のばらつきを減少させることを目的とした技術が開示されている。   In this regard, Patent Document 1 discloses a technique for reducing the variation in the number of erasures for each erasure unit in a management method capable of adapting a flash memory to a file system.

特開平9−97218号公報JP-A-9-97218

しかしながら、上記特許文献1の開示技術では、ガベージコレクションは、ファイルシステムを利用するアプリケーションとは独立に動作するため、データの書き込みあるいは読み出し中に、ガベージコレクションが発生することによって、ファイル処理の速度に支障を来す可能性があるという問題があった。   However, in the disclosed technique disclosed in Patent Document 1, garbage collection operates independently of an application that uses a file system. Therefore, garbage collection occurs during data writing or reading, thereby increasing the file processing speed. There was a problem that could cause trouble.

本発明では、ファイル処理の状況等を加味して、フラッシュメモリにおけるガベージコレクションの実行を制御することで、ファイル処理への影響を極力低減することが可能なメモリ制御装置及びメモリ制御方法を提供することを目的とする。   The present invention provides a memory control device and a memory control method capable of reducing the influence on file processing as much as possible by controlling the execution of garbage collection in a flash memory in consideration of the status of file processing and the like. For the purpose.

上記目的を達成するため、本発明に係るメモリ制御装置は、
フラッシュメモリに対するガベージコレクションの実行を制御するメモリ制御装置であって、
前記フラッシュメモリを構成する各セクタの利用状況をチェックして、空きセクタ数を検出するセクタ利用状況検出手段と、
前記フラッシュメモリに格納されている1又は複数のファイルの処理状態を検出し、検出した処理状態を、各ファイル毎に生成したファイル情報に格納して管理するファイル情報管理手段と、
前記セクタ利用状況検出手段が検出した前記空きセクタ数と、前記ファイル情報管理手段が検出した前記各ファイルの処理状態と、に基づいて、前記フラッシュメモリに対するガベージコレクションの実行の要否を判定するガベージコレクション判定手段と、を備え、前記ファイル情報管理手段が管理するファイル情報には、各ファイル毎に付与された優先度が含まれ、
前記ファイル情報管理手段は、前記フラッシュメモリに格納されている1又は複数のファイルのそれぞれについて、現在オープン中であるか否かを検出し、
前記ガベージコレクション判定手段は、前記セクタ利用状況検出手段が検出した前記空きセクタ数が、予め定めた下限値と該下限値より大きい許容値との間にある場合であって、現在オープン中のファイルが存在しない場合には、前記ガベージコレクションの実行が必要であると判定し、一方、現在オープン中のファイルが存在する場合には、当該ファイルに付与された前記優先度に基づいて、前記ガベージコレクションの実行の要否を判定する、ことを特徴とする。
In order to achieve the above object, a memory control device according to the present invention provides:
A memory control device that controls execution of garbage collection to flash memory,
Sector usage status detection means for checking the usage status of each sector constituting the flash memory and detecting the number of empty sectors;
A file information management means for detecting a processing state of one or a plurality of files stored in the flash memory, and storing and managing the detected processing state in file information generated for each file;
Garbage for determining whether or not it is necessary to execute garbage collection on the flash memory based on the number of empty sectors detected by the sector utilization status detection unit and the processing state of each file detected by the file information management unit The file information managed by the file information management means includes a priority assigned to each file,
The file information management means detects whether or not each of one or a plurality of files stored in the flash memory is currently open,
The garbage collection determining means is a case where the number of empty sectors detected by the sector utilization status detecting means is between a predetermined lower limit value and an allowable value larger than the lower limit value, and the currently open file If there is no file, it is determined that the garbage collection needs to be executed. On the other hand, if there is a file that is currently open, the garbage collection is performed based on the priority assigned to the file. It is characterized by determining whether or not it is necessary to execute .

本発明によれば、ファイル処理への影響を極力低減しつつ、フラッシュメモリの空き容量を確保することが可能となる。   According to the present invention, it is possible to secure the free space of the flash memory while reducing the influence on the file processing as much as possible.

本発明の実施形態1に係るメモリ制御装置を備える電子機器の構成を示すブロック図である。It is a block diagram which shows the structure of an electronic device provided with the memory control apparatus which concerns on Embodiment 1 of this invention. 図1のフラッシュメモリのメモリ構造を概略的に示す図である。FIG. 2 is a diagram schematically showing a memory structure of the flash memory of FIG. 1. 図1のCPU(メモリ制御装置)の機能構成を示すブロック図である。It is a block diagram which shows the function structure of CPU (memory control apparatus) of FIG. 実施形態1のファイル情報の構成を示す図である。It is a figure which shows the structure of the file information of Embodiment 1. 実施形態1のガベージコレクション実行処理の手順を示すフローチャートである。4 is a flowchart illustrating a procedure of garbage collection execution processing according to the first embodiment. 実施形態2のファイル情報の構成を示す図である。It is a figure which shows the structure of the file information of Embodiment 2. 実施形態2のガベージコレクション実行処理の手順を示すフローチャートである。10 is a flowchart illustrating a procedure of garbage collection execution processing according to the second embodiment. 他の実施形態において使用されるコピー元情報の構成を示す図である。It is a figure which shows the structure of the copy source information used in other embodiment.

以下、本発明の実施形態に係るメモリ制御装置について図面を参照して詳細に説明する。   Hereinafter, a memory control device according to an embodiment of the present invention will be described in detail with reference to the drawings.

(実施形態1)
図1は、実施形態1に係るメモリ制御装置を備える電子機器1の構成を示すブロック図である。この電子機器1は、例えば、パーソナルコンピュータ等の情報処理装置である。電子機器1は、CPU(Central Processing Unit)11(メモリ制御装置)と、ROM(Read Only Memory)12と、RAM(Random Access Memory)13と、フラッシュメモリ14と、入力部15と、表示部16と、を備える。
(Embodiment 1)
FIG. 1 is a block diagram illustrating a configuration of an electronic apparatus 1 including the memory control device according to the first embodiment. The electronic device 1 is an information processing apparatus such as a personal computer. The electronic device 1 includes a central processing unit (CPU) 11 (memory control device), a read only memory (ROM) 12, a random access memory (RAM) 13, a flash memory 14, an input unit 15, and a display unit 16. And comprising.

CPU11は、バス17を介して、ROM12、RAM13、フラッシュメモリ14、入力部15及び表示部16を制御し、それに付随して、これらとの間でデータの授受を行う。   The CPU 11 controls the ROM 12, RAM 13, flash memory 14, input unit 15, and display unit 16 via the bus 17, and accordingly, exchanges data with these.

ROM12には、CPU11が実行する各種の動作プログラム等が格納されている。RAM13は、動作プログラムやデータ等が一時的に保存される作業用メモリ等として使用される。   The ROM 12 stores various operation programs executed by the CPU 11. The RAM 13 is used as a working memory for temporarily storing operation programs, data, and the like.

入力部15は、キーボードやマウス等の入力デバイスから構成され、ユーザからの操作入力(例えば、ファイル操作に係る入力)を受け付け、受け付けた信号(操作信号)をCPU11に送出する。表示部16は、CRTや液晶モニタ等の表示デバイスにより構成され、CPU11から供給される文字や画像等のデータを表示する。   The input unit 15 includes input devices such as a keyboard and a mouse, receives an operation input from the user (for example, an input related to a file operation), and sends the received signal (operation signal) to the CPU 11. The display unit 16 includes a display device such as a CRT or a liquid crystal monitor, and displays data such as characters and images supplied from the CPU 11.

フラッシュメモリ14は、不揮発性メモリであり、レジスタと、メモリセルアレイと、から構成される。フラッシュメモリ14は、レジスタとメモリセルとの間でデータの複写を行って、データの書き込み又は読み出しを行う。   The flash memory 14 is a non-volatile memory, and includes a register and a memory cell array. The flash memory 14 performs data copying between the register and the memory cell to write or read data.

メモリセルアレイは、複数のメモリセル群と、ワード線と、を備える。各メモリセル群は、複数のメモリセルが直列に接続されたものである。ワード線は、メモリセル群の特定のメモリセルを選択するためのものである。このワード線を介して選択されたメモリセルとレジスタとの間で、データの複写、即ち、レジスタから選択されたメモリセルへの複写又は選択されたメモリセルからレジスタへのデータの複写が行われる。   The memory cell array includes a plurality of memory cell groups and word lines. Each memory cell group includes a plurality of memory cells connected in series. The word line is for selecting a specific memory cell in the memory cell group. Data is copied between the selected memory cell and the register via the word line, that is, data is copied from the register to the selected memory cell, or data is copied from the selected memory cell to the register. .

メモリセルアレイを構成するメモリセルは、2つのゲートを備えたMOSトランジスタによって構成される。この2つのゲートは、それぞれ、制御(コントロール)ゲート、浮遊(フローティング)ゲートと呼ばれており、フローティングゲートに電荷(電子)を注入若しくはフローティングゲートから電荷(電子)を排出することによって、データの書き込み若しくはデータの消去が行われる。   A memory cell constituting the memory cell array is constituted by a MOS transistor having two gates. These two gates are called a control gate and a floating gate, respectively. By injecting charges (electrons) into the floating gate or discharging charges (electrons) from the floating gate, data can be transferred. Writing or erasing of data is performed.

このフローティングゲートは、周囲を絶縁体で囲まれているので、注入された電子は長期間にわたって保持される。なお、フローティングゲートに電子を注入するときは、コントロールゲートが高電位側となるように電圧を印加する。また、フローティングゲートから電子を排出するときは、コントロールゲートが低電位側となるよう電圧を印加する。   Since the floating gate is surrounded by an insulator, the injected electrons are held for a long period of time. When electrons are injected into the floating gate, a voltage is applied so that the control gate is on the high potential side. Further, when electrons are discharged from the floating gate, a voltage is applied so that the control gate is on the low potential side.

ここで、フローティングゲートに電子が注入されている状態が書き込み状態であり、論理値「0」に対応する。また、フローティングゲートから電子が排出されている状態が消去状態であり、論理値「1」に対応する。   Here, a state where electrons are injected into the floating gate is a write state, which corresponds to a logical value “0”. The state in which electrons are discharged from the floating gate is an erased state, which corresponds to a logical value “1”.

このようなフラッシュメモリ14のメモリ構造を図2に示す。フラッシュメモリ14のメモリ領域は、“ページ”と“ブロック”に分割されて管理されている。   A memory structure of such a flash memory 14 is shown in FIG. The memory area of the flash memory 14 is managed by being divided into “pages” and “blocks”.

ページは、フラッシュメモリ14にて行われるデータ読み出し動作及びデータ書き込み動作における処理単位である。ブロックは、フラッシュメモリ14にて行われるデータ消去動作における処理単位である。   A page is a processing unit in a data read operation and a data write operation performed in the flash memory 14. A block is a processing unit in a data erasing operation performed in the flash memory 14.

図2に示したフラッシュメモリでは、1つのページは、1セクタ(512バイト)のデータ領域と、16バイトの冗長領域とを含んでいる。尚、1つのページが4セクタのデータ領域と64バイトの冗長領域で構成されているフラッシュメモリもある。データ領域は、ファイル処理等の際に、CPU11から供給されたデータを格納する。なお、図2は、フラッシュメモリ14のメモリ構造を概略的に示すものであり、図示はしないが、各ブロックは、所定サイズのヘッダ領域を備えている。   In the flash memory shown in FIG. 2, one page includes a data area of 1 sector (512 bytes) and a redundant area of 16 bytes. There is also a flash memory in which one page is composed of a data area of 4 sectors and a redundant area of 64 bytes. The data area stores data supplied from the CPU 11 during file processing or the like. FIG. 2 schematically shows the memory structure of the flash memory 14. Although not shown, each block has a header area of a predetermined size.

冗長領域は、エラーコレクションコード、対応論理ブロックアドレス、ページの利用状況を示す情報(利用フラグ)等の付加データを記録するための領域である。   The redundant area is an area for recording additional data such as an error collection code, a corresponding logical block address, and information (usage flag) indicating the usage status of a page.

エラーコレクションコードは、データ領域に記憶されているデータに含まれる誤りを検出し、訂正するためのデータである。   The error collection code is data for detecting and correcting an error included in the data stored in the data area.

対応論理ブロックアドレスは、1つのブロック内の少なくとも1つのデータ領域に有効なデータが格納されているとき、そのブロックが対応付けられている論理ブロックのアドレスを示す。   The corresponding logical block address indicates the address of the logical block with which the block is associated when valid data is stored in at least one data area in one block.

論理ブロックアドレスは、CPU11から与えられるアドレスに基づいて決定されるブロックのアドレスである。一方、フラッシュメモリ14内における実際のブロックのアドレスは、物理ブロックアドレスと称される。   The logical block address is a block address determined based on an address given from the CPU 11. On the other hand, an actual block address in the flash memory 14 is referred to as a physical block address.

1つのブロック内の何れのデータ領域にも有効なデータが格納されていない場合には、そのブロックに含まれている冗長領域に、対応論理ブロックアドレスは格納されていないことになる。   When valid data is not stored in any data area in one block, the corresponding logical block address is not stored in the redundant area included in the block.

したがって、冗長領域に対応論理ブロックアドレスが格納されているか否かを判定することにより、その冗長領域が含まれているブロックのデータが消去されているか否かを判定することができる。冗長領域に対応論理ブロックアドレスが格納されていないとき、そのブロックは、データが消去された状態となっている。   Therefore, by determining whether or not the corresponding logical block address is stored in the redundant area, it is possible to determine whether or not the data of the block including the redundant area has been erased. When the corresponding logical block address is not stored in the redundant area, the block is in a state where data is erased.

利用フラグは、各セクタの利用状況を示す。例えば、「未使用」、「移動中」、「使用中」、「削除」等を示す。例えば、ブロックが消去された直後は全てのセクタにおいて、利用フラグは「未使用」を示す。   The usage flag indicates the usage status of each sector. For example, “unused”, “moving”, “in use”, “deleted”, and the like are shown. For example, immediately after the block is erased, the utilization flag indicates “unused” in all sectors.

ブロックは、フラッシュメモリ14の消去の単位である。フラッシュメモリ14にデータを新規に書き込む場合には、データのサイズに対応する複数の消去された(即ち、「未使用」の)セクタを確保し、データの書き込みを行う。また、データの上書きの際には、「未使用」のセクタに当該データを書き込み、そして、元のデータが格納されているセクタの冗長領域を更新する。これにより、元のデータが格納されているセクタの利用フラグは、「削除」に更新される。   A block is a unit for erasing the flash memory 14. When data is newly written to the flash memory 14, a plurality of erased (that is, “unused”) sectors corresponding to the size of the data are secured and data is written. When data is overwritten, the data is written in an “unused” sector, and the redundant area of the sector in which the original data is stored is updated. As a result, the use flag of the sector in which the original data is stored is updated to “delete”.

フラッシュメモリ14に対して、上記の方法によりデータの書き込みを続けていると、実際に利用しているセクタ(利用フラグが「使用中」のセクタ)が、たとえ増えなくとも、利用フラグが「削除」を示すセクタが増えることになる。そこで、CPU11は、利用フラグが「削除」を示すセクタを「未使用」に戻し、空き容量を増加させる処理(ガベージコレクション)を適宜実行する必要がある。   If data is continuously written to the flash memory 14 by the above method, the usage flag is “deleted” even if the sector actually used (the sector whose usage flag is “in use”) does not increase. "Will increase. Therefore, the CPU 11 needs to return the sector whose usage flag indicates “deleted” to “unused” and appropriately execute a process (garbage collection) for increasing the free space.

CPU11は、機能的には、図3に示すように、アプリケーション実行部110と、ファイルシステム制御部120と、を備える。アプリケーション実行部110は、ROM12に格納されている所定のアプリケーションプログラム(例えば、文書作成ソフトウェア等)を実行する。アプリケーション実行部110は、当該アプリケーションプログラムの実行の際、例えば、ファイルのオープン、データの読み出し・書き込み、ファイルの削除等の実行をファイルシステム制御部120に要求する。   Functionally, the CPU 11 includes an application execution unit 110 and a file system control unit 120, as shown in FIG. The application execution unit 110 executes a predetermined application program (for example, document creation software) stored in the ROM 12. When executing the application program, the application execution unit 110 requests the file system control unit 120 to execute, for example, opening a file, reading / writing data, and deleting a file.

ファイルシステム制御部120は、フラッシュメモリ14に記録されているファイルの制御を行う。具体的には、ファイルシステム制御部120は、フラッシュメモリ14へのファイルの作成、読み出し・書き込み、ファイルの削除等を行う。また、ファイルシステム制御部120は、所定の条件の下、ガベージコレクションを実行する。   The file system control unit 120 controls files recorded in the flash memory 14. Specifically, the file system control unit 120 creates a file in the flash memory 14, reads / writes, deletes the file, and the like. In addition, the file system control unit 120 executes garbage collection under a predetermined condition.

ファイルシステム制御部120は、より詳細には、図3に示すように、セクタ利用状況検出部121と、ファイル情報管理部122と、ガベージコレクション判定部123と、メモリ制御部124と、を備える。   More specifically, as shown in FIG. 3, the file system control unit 120 includes a sector usage status detection unit 121, a file information management unit 122, a garbage collection determination unit 123, and a memory control unit 124.

セクタ利用状況検出部121は、所定時間毎に、フラッシュメモリ14における各セクタの利用状況をチェックして、空き(即ち、「未使用」の)セクタ数を検出し、これをRAM13上に展開した変数に格納する。   The sector usage status detection unit 121 checks the usage status of each sector in the flash memory 14 every predetermined time, detects the number of empty (that is, “unused”) sectors, and expands this on the RAM 13. Store in variable.

ファイル情報管理部122は、作成したファイルについての情報(ファイル情報)を管理する。具体的には、ファイル情報管理部122は、図4に示すように、ファイル名と、処理状態と、から構成されるファイル情報がエントリされたファイル情報テーブル(RAM13上に展開される)を管理する。ファイル情報管理部122は、新たなファイルが作成されると、当該ファイルのファイル情報をファイル情報テーブルにエントリする。ここで、「処理状態」とは、当該ファイルの現在の状況(例えば、“オープン”、“クローズ”等)を示す情報であり、ファイル情報管理部122は、当該ファイルの処理状態が変化する(例えば、“オープン”→“クローズ”)度に、この「処理状態」を更新する。ファイル情報管理部122は、あるファイルがフラッシュメモリ14から削除されると、対応するファイル情報をファイル情報テーブルから削除する。   The file information management unit 122 manages information (file information) about the created file. Specifically, as shown in FIG. 4, the file information management unit 122 manages a file information table (developed on the RAM 13) in which file information including a file name and a processing state is entered. To do. When a new file is created, the file information management unit 122 enters the file information of the file in the file information table. Here, the “processing state” is information indicating the current state of the file (for example, “open”, “closed”, etc.), and the file information management unit 122 changes the processing state of the file ( For example, this “processing state” is updated every time “open” → “closed”). When a file is deleted from the flash memory 14, the file information management unit 122 deletes the corresponding file information from the file information table.

ガベージコレクション判定部123は、所定時間毎に、ガベージコレクション実行の要否、即ち、ガベージコレクションを実行する必要があるか否かについて判定する。その際、ガベージコレクション判定部123は、セクタ利用状況検出部121が検出した空きセクタ数と、ファイル情報管理部122が管理するファイル情報テーブルを参照して、ガベージコレクション実行の要否を判定する。   The garbage collection determination unit 123 determines whether or not garbage collection needs to be executed, that is, whether or not garbage collection needs to be executed, every predetermined time. At that time, the garbage collection determination unit 123 refers to the number of empty sectors detected by the sector usage status detection unit 121 and the file information table managed by the file information management unit 122 to determine whether or not garbage collection needs to be executed.

本実施形態では、空きセクタ数が、予め定めた下限値(例えば、ブロック内のセクタ数(本実施形態では、32))以下の場合、ガベージコレクション判定部123は、ガベージコレクションの実行が必要であると判定する。また、空きセクタ数が下限値より大きく、予め定めた許容値(例えば、ブロック内のセクタ数×2(本実施形態では、64))以下の場合は、オープンしているファイルが存在しない場合に限り、ガベージコレクションの実行が必要であると判定する。ガベージコレクションの実行が必要であると判定すると、ガベージコレクション判定部123は、ガベージコレクションの実行をメモリ制御部124に要求する   In this embodiment, when the number of empty sectors is equal to or less than a predetermined lower limit value (for example, the number of sectors in a block (32 in this embodiment)), the garbage collection determination unit 123 needs to execute garbage collection. Judge that there is. In addition, when the number of empty sectors is larger than the lower limit value and is equal to or smaller than a predetermined allowable value (for example, the number of sectors in a block × 2 (64 in the present embodiment)), there is no open file. As long as it is determined that garbage collection needs to be executed. If it is determined that the garbage collection needs to be executed, the garbage collection determination unit 123 requests the memory control unit 124 to execute the garbage collection.

ガベージコレクション判定部123は、以上の条件が何れも成立しない場合、ガベージコレクションの実行が必要でないと判定する。   The garbage collection determination unit 123 determines that the execution of garbage collection is not necessary when none of the above conditions is satisfied.

メモリ制御部124は、アプリケーションプログラム実行部110からの要求に従ってフラッシュメモリ14にアクセスし、ファイルの作成、ファイルのオープン、データの読み出し・書き込み、ファイルの削除等を実行する。また、メモリ制御部124は、ガベージコレクション判定部123からの要求に従って、ガベージコレクションを実行する。   The memory control unit 124 accesses the flash memory 14 in accordance with a request from the application program execution unit 110 and executes file creation, file opening, data reading / writing, file deletion, and the like. Further, the memory control unit 124 executes garbage collection in accordance with a request from the garbage collection determination unit 123.

図5は、CPU11が実行するガベージコレクション実行処理の手順を示すフローチャートである。このガベージコレクション実行処理は、ユーザにより電子機器1の電源がONされ、CPU11が起動することで開始され、電子機器1の電源がOFFされるまで、周期的に以下の処理を繰り返し行う。   FIG. 5 is a flowchart showing a procedure of garbage collection execution processing executed by the CPU 11. The garbage collection execution process is started when the user turns on the power to the electronic device 1 and starts up the CPU 11, and periodically repeats the following processing until the power to the electronic device 1 is turned off.

先ず、ガベージコレクション判定部123は、セクタ利用状況検出部121が検出した空きセクタ数が、上述した許容値を超えている否かを判定する(ステップS101)。その結果、空きセクタ数が許容値を超えている場合(ステップS101;YES)、ガベージコレクション判定部123は、ガベージコレクションの実行が必要でないと判定する。その結果、当該処理ループでガベージコレクションは実行されず、所定時間のウエイト(ステップS105)後、ガベージコレクション判定部123は、上述したステップS101の処理を再度実行する。   First, the garbage collection determination unit 123 determines whether or not the number of empty sectors detected by the sector usage status detection unit 121 exceeds the allowable value described above (step S101). As a result, when the number of empty sectors exceeds the allowable value (step S101; YES), the garbage collection determination unit 123 determines that it is not necessary to execute garbage collection. As a result, garbage collection is not executed in the processing loop, and after waiting for a predetermined time (step S105), the garbage collection determination unit 123 executes the process of step S101 described above again.

一方、空きセクタ数が許容値を超えていない、即ち、空きセクタ数が許容値以下の場合(ステップS101;NO)、ガベージコレクション判定部123は、空きセクタ数が、上述した下限値を超えている否かを判定する(ステップS102)。その結果、空きセクタ数が下限値を超えていない、即ち、空きセクタ数が下限値以下の場合(ステップS102;NO)、ガベージコレクション判定部123は、ガベージコレクションの実行が必要であると判定し、ガベージコレクションの実行をメモリ制御部124に要求する。   On the other hand, when the number of free sectors does not exceed the allowable value, that is, when the number of free sectors is equal to or smaller than the allowable value (step S101; NO), the garbage collection determination unit 123 determines that the number of free sectors exceeds the lower limit value described above. It is determined whether or not there is (step S102). As a result, when the number of free sectors does not exceed the lower limit value, that is, when the number of free sectors is equal to or lower than the lower limit value (step S102; NO), the garbage collection determination unit 123 determines that garbage collection needs to be executed. The memory control unit 124 is requested to execute garbage collection.

メモリ制御部124は、ガベージコレクションの実行要求をガベージコレクション判定部123から受けると、ガベージコレクションを実行する(ステップS104)。具体的には、メモリ制御部124は、利用フラグが「削除」を示すセクタを最も多く含むブロックをフラッシュメモリ14全体から検索し、該当するブロックを消去対象ブロックとして決定する。そして、消去対象ブロック中の利用フラグが「使用中」を示す全セクタについて、その内容(データ領域及び冗長領域の内容)を他のブロックの空きセクタにコピーする。   When the memory control unit 124 receives a garbage collection execution request from the garbage collection determination unit 123, the memory control unit 124 executes garbage collection (step S104). Specifically, the memory control unit 124 searches the entire flash memory 14 for a block including the largest number of sectors whose use flag indicates “deleted”, and determines the corresponding block as an erasure target block. Then, the contents (the contents of the data area and the redundant area) of all the sectors in which the use flag in the block to be erased indicates “in use” are copied to empty sectors of other blocks.

次に、メモリ制御部124は、消去対象ブロックに格納されている全データを消去し、消去対象ブロックの全てのセクタの利用フラグを「未使用」に設定する。以上によりガベージコレクションが終了する。なお、消去対象ブロックが複数存在する場合には、当該ガベージコレクションで、全ての消去対象ブロックについて、上記の処理を行う。このように、複数の消去対象ブロックを消去できるようにすると、1回のガベージコレクションの実行で、より多くの空き容量を確保することが可能になる。   Next, the memory control unit 124 erases all data stored in the erasure target block, and sets the use flags of all sectors in the erasure target block to “unused”. Thus, the garbage collection ends. When there are a plurality of erasure target blocks, the above processing is performed for all erasure target blocks in the garbage collection. As described above, if a plurality of blocks to be erased can be erased, more free space can be secured by executing garbage collection once.

ガベージコレクションが終了すると、所定時間のウエイト(ステップS105)後、ガベージコレクション判定部123は、上述したステップS101の処理を再度実行する。   When the garbage collection ends, after waiting for a predetermined time (step S105), the garbage collection determination unit 123 executes the process of step S101 described above again.

ステップS102の判定の結果、空きセクタ数が下限値を超えている場合(ステップS102;YES)、ガベージコレクション判定部123は、ファイル情報テーブルを参照して、現在オープン中のファイルが存在するか否かを判定する(ステップS103)。その結果、オープン中のファイルが存在する場合(ステップS103;YES)、ガベージコレクション判定部123は、ガベージコレクションの実行が必要でないと判定し、所定時間のウエイト(ステップS105)後、上述したステップS101の処理を再度実行する。   As a result of the determination in step S102, if the number of empty sectors exceeds the lower limit (step S102; YES), the garbage collection determination unit 123 refers to the file information table to determine whether there is a currently open file. Is determined (step S103). As a result, when there is an open file (step S103; YES), the garbage collection determination unit 123 determines that garbage collection is not necessary, waits for a predetermined time (step S105), and then performs the above-described step S101. Execute the process again.

一方、オープン中のファイルが存在しない場合(ステップS103;NO)、ガベージコレクション判定部123は、ガベージコレクションの実行が必要である判定し、その結果、メモリ制御部124により上述したガベージコレクションが実行される(ステップS104)。そして、ガベージコレクションが終了すると、所定時間のウエイト(ステップS105)後、ガベージコレクション判定部123は、上述したステップS101の処理を再度実行する。   On the other hand, if there is no open file (step S103; NO), the garbage collection determination unit 123 determines that the garbage collection needs to be executed, and as a result, the memory control unit 124 executes the above-described garbage collection. (Step S104). When the garbage collection is completed, the garbage collection determination unit 123 executes the process of step S101 described above again after waiting for a predetermined time (step S105).

以上説明したように、本実施形態に係るメモリ制御装置(CPU11)は、単に定期的にガベージコレクションを実行するのではなく、空きセクタの数やファイル処理の状況に基づく所定の条件が成立する場合に、ガベージコレクションを実行する。即ち、空き容量が十分確保できている場合(許容値を超えている場合)には、ガベージコレクションを実行せず、また、空き容量が十分とはいえないまでも下限値(限界値)を超えている場合は、ファイルがオープン中でない場合に限り、ガベージコレクションを実行する。これにより、ファイル処理への影響を極力低減しつつ、フラッシュメモリの空き容量を確保することが可能となる。   As described above, the memory control device (CPU 11) according to the present embodiment does not simply execute garbage collection periodically, but a predetermined condition based on the number of empty sectors and the status of file processing is satisfied. Then, perform garbage collection. In other words, when sufficient free space is secured (when the allowable value is exceeded), garbage collection is not executed, and the lower limit (limit value) is exceeded even if the free space is not sufficient. If this is the case, perform garbage collection only if the file is not open. Thereby, it becomes possible to secure the free space of the flash memory while reducing the influence on the file processing as much as possible.

(実施形態2)
次に、本発明の実施形態2に係るメモリ制御装置について説明する。実施形態1のメモリ制御装置(CPU11)では、空き容量が下限値から許容値の間で、何れかのファイルがオープンしている場合、ガベージコレクションを実行しなかった。しかし、本実施形態のメモリ制御装置は、このような場合、さらに、予めファイル毎に付与した優先度も加味して、ガベージコレクションの実行の要否を判定する。なお、本実施形態のメモリ制御装置の構成は、実施形態1のメモリ制御装置(CPU11)の構成(図3参照)と同様であり、本実施形態のメモリ制御装置を備える電子機器の構成も実施形態1の電子機器1の構成(図1参照)と同様である。
(Embodiment 2)
Next, a memory control device according to the second embodiment of the present invention will be described. In the memory control device (CPU 11) according to the first embodiment, garbage collection is not executed when any file is open when the free space is between the lower limit value and the allowable value. However, in such a case, the memory control device according to the present embodiment further determines whether or not to execute the garbage collection in consideration of the priority given in advance for each file. The configuration of the memory control device according to the present embodiment is the same as the configuration of the memory control device (CPU 11) according to the first embodiment (see FIG. 3), and the configuration of an electronic device including the memory control device according to the present embodiment is also implemented. The configuration is the same as that of the electronic device 1 according to the first embodiment (see FIG. 1).

本実施形態のファイル情報管理部122は、図6に示すように、ファイル名と、処理状態と、優先度と、から構成されるファイル情報がエントリされたファイル情報テーブル(RAM13上に展開される)を管理する。ここで、「処理状態」の意味については、上述した通りである。「優先度」は、例えば、数値で示され、空き容量が下限値から許容値の間で当該ファイルがオープンしている場合、ガベージコレクションの実行の要否を判定する指標となる。「優先度」は、新規ファイルが作成される度に、ユーザが入力部15を介して入力操作することで、当該新規作成ファイルに付与されるようにしてもよいし、あるいは、新規作成されるファイルの種別に応じて、ファイルシステム制御部120が自動的に当該新規作成ファイルに付与してもよい。   As shown in FIG. 6, the file information management unit 122 according to the present embodiment is expanded on the file information table (RAM 13) in which file information including a file name, a processing state, and a priority is entered. ). Here, the meaning of “processing state” is as described above. The “priority” is indicated by a numerical value, for example, and serves as an index for determining whether or not to execute garbage collection when the file is open when the free space is between the lower limit value and the allowable value. The “priority” may be given to the newly created file by a user input operation via the input unit 15 every time a new file is created, or newly created. Depending on the file type, the file system control unit 120 may automatically assign the newly created file.

図7は、本実施形態のCPU11が実行するガベージコレクション実行処理の手順を示すフローチャートである。このガベージコレクション実行処理は、実施形態1と同様、ユーザにより電子機器1の電源がONされ、CPU11が起動することで開始され、電子機器1の電源がOFFされるまで、周期的に以下の処理を繰り返し行う。   FIG. 7 is a flowchart illustrating a procedure of garbage collection execution processing executed by the CPU 11 of this embodiment. As in the first embodiment, the garbage collection execution process is started when the user turns on the power to the electronic device 1 and starts up the CPU 11, and periodically performs the following processing until the power to the electronic device 1 is turned off. Repeat.

先ず、ガベージコレクション判定部123は、セクタ利用状況検出部121が検出した空きセクタ数が、予め定めた許容値(例えば、ブロック内のセクタ数×2(本実施形態では、64))を超えている否かを判定する(ステップS201)。その結果、空きセクタ数が許容値を超えている場合(ステップS201;YES)、ガベージコレクション判定部123は、ガベージコレクションの実行が必要でないと判定し、所定時間のウエイト(ステップS206)後、ステップS201の処理を再度実行する。   First, the garbage collection determination unit 123 exceeds the predetermined allowable value (for example, the number of sectors in a block × 2 (64 in the present embodiment)) detected by the sector usage status detection unit 121. It is determined whether or not there is (step S201). As a result, when the number of empty sectors exceeds the allowable value (step S201; YES), the garbage collection determination unit 123 determines that it is not necessary to execute the garbage collection, and after waiting for a predetermined time (step S206), the step The process of S201 is executed again.

一方、空きセクタ数が許容値を超えていない場合(ステップS201;NO)、ガベージコレクション判定部123は、空きセクタ数が、予め定めた下限値(例えば、ブロック内のセクタ数(本実施形態では、32))を超えている否かを判定する(ステップS202)。その結果、空きセクタ数が下限値を超えていない場合(ステップS202;NO)、ガベージコレクション判定部123は、ガベージコレクションの実行が必要であると判定し、その結果、メモリ制御部124によりガベージガベージコレクションが実行される(ステップS204)。   On the other hand, when the number of empty sectors does not exceed the allowable value (step S201; NO), the garbage collection determination unit 123 determines that the number of empty sectors is a predetermined lower limit (for example, the number of sectors in a block (in this embodiment, , 32)) is exceeded (step S202). As a result, when the number of free sectors does not exceed the lower limit (step S202; NO), the garbage collection determination unit 123 determines that garbage collection needs to be executed, and as a result, the memory control unit 124 performs garbage garbage. Collection is executed (step S204).

一方、空きセクタ数が下限値を超えている場合(ステップS202;YES)、ガベージコレクション判定部123は、ファイル情報テーブルを参照して、現在オープン中のファイルが存在するか否かを判定する(ステップS203)。その結果、オープン中のファイルが存在しない場合(ステップS203;NO)、ガベージコレクション判定部123は、ガベージコレクションの実行が必要であると判定し、その結果、メモリ制御部124によりガベージガベージコレクションが実行される(ステップS204)。   On the other hand, when the number of free sectors exceeds the lower limit (step S202; YES), the garbage collection determination unit 123 refers to the file information table to determine whether there is a currently open file ( Step S203). As a result, if there is no open file (step S203; NO), the garbage collection determination unit 123 determines that the garbage collection needs to be executed, and as a result, the memory control unit 124 executes the garbage garbage collection. (Step S204).

一方、オープン中のファイルが存在する場合(ステップS203;YES)、ガベージコレクション判定部123は、ファイル情報テーブルを参照して、当該オープン中のファイルの優先度を取得し、これが、予め定めた基準値より小さいか否かを判定する(ステップS205)。その結果、当該ファイルの優先度が基準値より小さい場合(ステップS205;YES)、ガベージコレクション判定部123は、ガベージコレクションの実行が必要であると判定し、その結果、メモリ制御部124によりガベージガベージコレクションが実行される(ステップS204)。   On the other hand, when an open file exists (step S203; YES), the garbage collection determination unit 123 refers to the file information table to acquire the priority of the open file, which is a predetermined criterion. It is determined whether it is smaller than the value (step S205). As a result, when the priority of the file is smaller than the reference value (step S205; YES), the garbage collection determination unit 123 determines that the garbage collection needs to be executed, and as a result, the memory control unit 124 performs garbage garbage. Collection is executed (step S204).

一方、当該ファイルの優先度が基準値より小さくない、即ち、基準値以上の場合(ステップS205;NO)、ガベージコレクション判定部123は、ガベージコレクションの実行が必要でないと判定し、所定時間のウエイト(ステップS206)後、ステップS201の処理を再度実行する。   On the other hand, if the priority of the file is not lower than the reference value, that is, it is equal to or higher than the reference value (step S205; NO), the garbage collection determination unit 123 determines that the execution of garbage collection is not necessary, and waits for a predetermined time. After (Step S206), the process of Step S201 is executed again.

また、上記ステップS204の処理が終了すると、所定時間のウエイト(ステップS206)後、ガベージコレクション判定部123は、上述したステップS201の処理を再度実行する。   When the process of step S204 is completed, after waiting for a predetermined time (step S206), the garbage collection determination unit 123 executes the process of step S201 described above again.

以上のように、本実施形態に係るメモリ制御装置(CPU11)は、オープン中のファイルの優先度も加味して、ガベージコレクションの実行の要否を判定する。したがって、実施形態1のメモリ制御装置と同様の効果を奏する上、ユーザにとってより都合のよいタイミングでガベージコレクションを実行させることが可能になる。   As described above, the memory control device (CPU 11) according to the present embodiment determines whether or not to execute garbage collection in consideration of the priority of the open file. Therefore, the same effect as that of the memory control device of Embodiment 1 can be obtained, and garbage collection can be executed at a timing that is more convenient for the user.

なお、本発明は、上記の各実施形態に限定されず、本発明の要旨を逸脱しない範囲での種々の変更は勿論可能である。   The present invention is not limited to the above-described embodiments, and various modifications can be made without departing from the gist of the present invention.

例えば、ガベージコレクションの実行の要否を判定する条件は、上記実施形態に限定されず、ユーザは、ファイル処理への影響を極力低減できるようにするための任意の条件を設定することができる。例えば、ファイルシステム制御部120において、ファイル情報管理部122により管理されるファイル情報に、図4又は図6で示す構成に加え、当該ファイルのデータが格納されているセクタの情報が含まれていてもよい。この場合、実施形態2のガベージコレクション実行処理(図7参照)において、ガベージコレクション判定部123は、例えば、優先度の低いファイルがオープン中であっても(ステップS205;YES)、消去対象ブロックに当該ファイルのデータが格納されている場合には、ガベージコレクションの実行が必要でないと判定してもよい。   For example, the condition for determining whether or not to execute garbage collection is not limited to the above embodiment, and the user can set an arbitrary condition for reducing the influence on the file processing as much as possible. For example, in the file system control unit 120, the file information managed by the file information management unit 122 includes information on the sector in which the data of the file is stored in addition to the configuration shown in FIG. 4 or FIG. Also good. In this case, in the garbage collection execution process (see FIG. 7) according to the second embodiment, the garbage collection determination unit 123 sets the erasure target block as an erasure target block even when a low priority file is open (step S205; YES). When the data of the file is stored, it may be determined that it is not necessary to execute garbage collection.

また、消去対象ブロックが複数存在する場合、1回のガベージコレクションで、全ての消去対象ブロックを消去するのではなく、1つずつ消去する仕様にしてもよい。このようにすると、ファイル処理の速度低下をより抑えることができる。   Further, when there are a plurality of erasure target blocks, the specification may be such that not all erasure target blocks are erased one by one but garbage collection is performed one by one. In this way, a decrease in file processing speed can be further suppressed.

また、不意の電源断等により、ガベージコレクションが中断された場合の対策機能を上記実施形態のメモリ制御装置に追加してもよい。この機能では、フラッシュメモリ14の各ブロックのヘッダ領域における所定領域を、図8に示すコピー元情報を格納するための領域として使用する。コピー元情報は、ガベージコレクションの実行時において、コピー元のセクタ(消去対象ブロックにおけるセクタ)の情報を格納するために使用される。図8に示すように、コピー元情報の格納領域は、ブロック内のセクタ数分(本実施形態では、32)確保され、当該領域の先頭から順に、セクタ0に対応するコピー元情報の格納領域、セクタ1に対応するコピー元情報の格納領域、・・・、セクタ31に対応するコピー元情報の格納領域となる。   Further, a countermeasure function in the case where garbage collection is interrupted due to an unexpected power interruption or the like may be added to the memory control device of the above embodiment. In this function, a predetermined area in the header area of each block of the flash memory 14 is used as an area for storing copy source information shown in FIG. The copy source information is used to store information of a copy source sector (a sector in an erasure target block) when garbage collection is executed. As shown in FIG. 8, the copy source information storage area is reserved for the number of sectors in the block (32 in this embodiment), and the copy source information storage area corresponding to sector 0 is sequentially started from the top of the area. , A storage area for copy source information corresponding to sector 1,..., A storage area for copy source information corresponding to sector 31.

コピー元情報は、コピー元ブロック番号と、コピー元セクタ番号と、コピー状態と、から構成され、それぞれ、例えば、4バイトの領域が確保されている。「コピー元ブロック番号」には、コピー元のブロック番号、即ち、ガベージコレクション時における消去対象ブロックのブロック番号が格納される。「コピー元セクタ番号」には、コピー元のセクタ番号が格納される。「コピー状態」には、ガベージコレクション時において、当該セクタ(コピー先のセクタ)へのコピーが完了したか否かの情報が格納される。   The copy source information is composed of a copy source block number, a copy source sector number, and a copy status. For example, a 4-byte area is secured. The “copy source block number” stores the copy source block number, that is, the block number of the block to be erased at the time of garbage collection. The “copy source sector number” stores the copy source sector number. The “copy status” stores information indicating whether or not copying to the sector (copy destination sector) has been completed at the time of garbage collection.

メモリ制御部124は、ガベージコレクションの実行時において、コピー先のセクタを決定すると、当該コピー先のセクタに対応するコピー元情報の「コピー元ブロック番号」、「コピー元セクタ番号」及び「コピー状態」に、それぞれ、当該消去対象ブロックのブロック番号、コピー元のセクタ番号及びコピーが完了していないことを示す情報(以下、“未完”という)を格納する。そして、メモリ制御部124は、コピー元のセクタの内容をコピー先のセクタに書き込むと、当該コピー先のセクタに対応するコピー元情報の「コピー状態」に、コピーが完了したことを示す情報(以下、“完”という)を格納する。   When the memory control unit 124 determines a copy destination sector at the time of executing the garbage collection, the “copy source block number”, “copy source sector number”, and “copy status” of the copy source information corresponding to the copy destination sector are determined. , The block number of the block to be erased, the sector number of the copy source, and information indicating that the copy is not completed (hereinafter referred to as “incomplete”) are stored. When the memory control unit 124 writes the contents of the copy source sector to the copy destination sector, the memory control unit 124 displays information indicating that the copy is completed in the “copy status” of the copy source information corresponding to the copy destination sector ( (Hereinafter referred to as “complete”).

例えば、何らかの理由により、電子機器1の電源がOFFにされ、ガベージコレクションの実行が中断したとする。この場合、再起動すると、空きセクタ数が少ないため、メモリ制御部124によって、ガベージコレクションが再度実行されることになる。この例におけるメモリ制御部124は、ガベージコレクションを開始する際、先ず、コピー元情報の「コピー状態」に“未完”が格納されているブロックを検索する。その結果、該当するブロックがあれば、そのブロックの当該コピー元情報に対応するセクタへのコピー中に、ガベージコレクションが中断したことが判る。   For example, it is assumed that the electronic device 1 is turned off for some reason and the execution of garbage collection is interrupted. In this case, when restarting, since the number of empty sectors is small, the memory control unit 124 executes garbage collection again. When starting the garbage collection, the memory control unit 124 in this example first searches for a block in which “incomplete” is stored in the “copy status” of the copy source information. As a result, if there is a corresponding block, it can be understood that the garbage collection is interrupted while copying the block to the sector corresponding to the copy source information.

したがって、この場合、メモリ制御部124は、当該コピー元情報に対応するセクタの利用フラグを「削除」に更新すると共に、新たな空きセクタを探し、その空きセクタに当該コピー元のセクタの内容をコピーする。   Therefore, in this case, the memory control unit 124 updates the use flag of the sector corresponding to the copy source information to “delete”, searches for a new empty sector, and stores the contents of the copy source sector in the empty sector. make a copy.

以上のように、各ブロック毎にコピー元情報を格納するための領域を確保し、これをガベージコレクションの実行時に使用することで、例えば、不意の電源断により、ガベージコレクションが中断された場合であっても、再起動後に、ガベージコレクションを支障なく再開することができる。   As described above, by securing an area for storing copy source information for each block and using this when executing garbage collection, for example, when garbage collection is interrupted due to an unexpected power failure. Even then, after the restart, garbage collection can be resumed without any problems.

本発明は、パーソナルコンピュータ等の情報処理装置、携帯電話やデジタルカメラ等、フラッシュメモリを利用する様々な電子機器に好適に採用され得る。   The present invention can be suitably employed in various electronic devices that use flash memory, such as information processing apparatuses such as personal computers, mobile phones, and digital cameras.

1 電子機器
11 CPU(メモリ制御装置)
110 アプリケーション実行部
120 ファイルシステム制御部
121 セクタ利用状況検出部
122 ファイル情報管理部
123 ガベージコレクション判定部
124 メモリ制御部
12 ROM
13 RAM
14 フラッシュメモリ
15 入力部
16 表示部
17 バス
1 Electronic device 11 CPU (memory control device)
DESCRIPTION OF SYMBOLS 110 Application execution part 120 File system control part 121 Sector utilization condition detection part 122 File information management part 123 Garbage collection determination part 124 Memory control part 12 ROM
13 RAM
14 Flash memory 15 Input unit 16 Display unit 17 Bus

Claims (7)

フラッシュメモリに対するガベージコレクションの実行を制御するメモリ制御装置であって、
前記フラッシュメモリを構成する各セクタの利用状況をチェックして、空きセクタ数を検出するセクタ利用状況検出手段と、
前記フラッシュメモリに格納されている1又は複数のファイルの処理状態を検出し、検出した処理状態を、各ファイル毎に生成したファイル情報に格納して管理するファイル情報管理手段と、
前記セクタ利用状況検出手段が検出した前記空きセクタ数と、前記ファイル情報管理手段が検出した前記各ファイルの処理状態と、に基づいて、前記フラッシュメモリに対するガベージコレクションの実行の要否を判定するガベージコレクション判定手段と、を備え、前記ファイル情報管理手段が管理するファイル情報には、各ファイル毎に付与された優先度が含まれ、
前記ファイル情報管理手段は、前記フラッシュメモリに格納されている1又は複数のファイルのそれぞれについて、現在オープン中であるか否かを検出し、
前記ガベージコレクション判定手段は、前記セクタ利用状況検出手段が検出した前記空きセクタ数が、予め定めた下限値と該下限値より大きい許容値との間にある場合であって、現在オープン中のファイルが存在しない場合には、前記ガベージコレクションの実行が必要であると判定し、一方、現在オープン中のファイルが存在する場合には、当該ファイルに付与された前記優先度に基づいて、前記ガベージコレクションの実行の要否を判定する、
ことを特徴とするメモリ制御装置。
A memory control device that controls execution of garbage collection to flash memory,
Sector usage status detection means for checking the usage status of each sector constituting the flash memory and detecting the number of empty sectors;
A file information management means for detecting a processing state of one or a plurality of files stored in the flash memory, and storing and managing the detected processing state in file information generated for each file;
Garbage for determining whether or not it is necessary to execute garbage collection on the flash memory based on the number of empty sectors detected by the sector utilization status detection unit and the processing state of each file detected by the file information management unit The file information managed by the file information management means includes a priority assigned to each file,
The file information management means detects whether or not each of one or a plurality of files stored in the flash memory is currently open,
The garbage collection determining means is a case where the number of empty sectors detected by the sector utilization status detecting means is between a predetermined lower limit value and an allowable value larger than the lower limit value, and the currently open file If there is no file, it is determined that the garbage collection needs to be executed. On the other hand, if there is a file that is currently open, the garbage collection is performed based on the priority assigned to the file. To determine whether or not to execute
A memory control device.
フラッシュメモリに対するガベージコレクションの実行を制御するメモリ制御装置であって、
前記フラッシュメモリを構成する各セクタの利用状況をチェックして、空きセクタ数を検出するセクタ利用状況検出手段と、
前記フラッシュメモリに格納されている1又は複数のファイルの処理状態を検出し、検出した処理状態を、各ファイル毎に生成したファイル情報に格納して管理するファイル情報管理手段と
前記セクタ利用状況検出手段が検出した前記空きセクタ数と、前記ファイル情報管理手段が検出した前記各ファイルの処理状態と、に基づいて、前記フラッシュメモリに対するガベージコレクションの実行の要否を判定するガベージコレクション判定手段と、
前記ガベージコレクション判定手段によりガベージコレクションの実行が必要であると判定された場合、ガベージコレクションを実行するガベージコレクション実行手段と、を備え、
前記フラッシュメモリを構成する各ブロックのヘッダ領域には、ガベージコレクションの実行時において、コピー元のセクタについての情報を格納するためのコピー元情報領域が設けられており、前記ガベージコレクション実行手段は、コピー先のセクタを決定すると、当該コピー先のセクタに対応する前記コピー元情報領域に、当該消去対象ブロックのブロック番号と、コピー元のセクタ番号と、コピー状態として、コピーが完了していないことを示す情報と、を格納し、コピーが完了すると、前記コピー元情報領域の前記コピー状態を、コピーが完了したことを示す情報に更新する、
ことを特徴とするメモリ制御装置。
A memory control device that controls execution of garbage collection to flash memory,
Sector usage status detection means for checking the usage status of each sector constituting the flash memory and detecting the number of empty sectors;
A file information management means for detecting a processing state of one or a plurality of files stored in the flash memory, and storing and managing the detected processing state in file information generated for each file ;
Garbage for determining whether or not it is necessary to execute garbage collection on the flash memory based on the number of empty sectors detected by the sector utilization status detection unit and the processing state of each file detected by the file information management unit Collection determination means;
A garbage collection executing means for executing garbage collection when the garbage collection determining means determines that it is necessary to execute garbage collection;
The header area of each block constituting the flash memory is provided with a copy source information area for storing information about a copy source sector at the time of execution of garbage collection, and the garbage collection executing means includes: When the copy-destination sector is determined, the copy source information area corresponding to the copy-destination sector has not been copied as the block number of the block to be erased, the sector number of the copy-source, and the copy status. When the copy is completed, the copy status in the copy source information area is updated to information indicating that the copy is completed.
A memory control device.
前記ガベージコレクション実行手段は、前記コピー元情報領域に、前記コピー状態として、前記コピーが完了していないことを示す情報が格納されている場合、当該コピー元のセクタの内容を新たに探索した空きセクタにコピーする、When the copy source information area stores information indicating that the copy has not been completed, the garbage collection execution unit newly searches for the contents of the copy source sector. Copy to sector,
ことを特徴とする請求項2に記載のメモリ制御装置。The memory control device according to claim 2.
前記ファイル情報管理手段は、前記フラッシュメモリに格納されている1又は複数のファイルのそれぞれについて、現在オープン中であるか否かを検出し、
前記ガベージコレクション判定手段は、前記セクタ利用状況検出手段が検出した前記空きセクタ数が、予め定めた下限値と該下限値より大きい許容値との間にあり、現在オープン中のファイルが存在しない場合には、前記ガベージコレクションの実行が必要であると判定する、
ことを特徴とする請求項2又は3に記載のメモリ制御装置。
The file information management means detects whether or not each of one or a plurality of files stored in the flash memory is currently open,
The garbage collection determination unit is configured such that the number of empty sectors detected by the sector usage status detection unit is between a predetermined lower limit value and an allowable value larger than the lower limit value, and there is no currently open file. Determines that it is necessary to execute the garbage collection.
The memory control device according to claim 2 , wherein the memory control device is a memory control device.
前記下限値は、前記フラッシュメモリを構成するブロックのセクタ総数である、
ことを特徴とする請求項1又は4に記載のメモリ制御装置。
The lower limit value is the total number of sectors of blocks constituting the flash memory.
The memory control device according to claim 1 , wherein the memory control device is a memory control device.
フラッシュメモリに対するガベージコレクションの実行を制御するメモリ制御方法であって、
前記フラッシュメモリを構成する各セクタの利用状況をチェックして、空きセクタ数を検出するセクタ利用状況検出ステップと、
前記フラッシュメモリに格納されている1又は複数のファイルの処理状態を検出し、検出した処理状態を、各ファイル毎に生成したファイル情報に格納して管理するファイル情報管理ステップと、
前記セクタ利用状況検出ステップで検出された前記空きセクタ数と、前記ファイル情報管理ステップで検出された前記各ファイルの処理状態と、に基づいて、前記フラッシュメモリに対するガベージコレクションの実行の要否を判定するガベージコレクション判定ステップと、を有し、
前記ファイル情報管理ステップで管理されるファイル情報には、各ファイル毎に付与された優先度が含まれ、
前記ファイル情報管理ステップでは、前記フラッシュメモリに格納されている1又は複数のファイルのそれぞれについて、現在オープン中であるか否かを検出し、
前記ガベージコレクション判定ステップでは、前記セクタ利用状況検出ステップで検出された前記空きセクタ数の値が、予め定めた下限値と該下限値より大きい許容値との間にある場合であって、現在オープン中のファイルが存在しない場合には、前記ガベージコレクションの実行が必要であると判定し、一方、現在オープン中のファイルが存在する場合には、当該ファイルに付与された前記優先度に基づいて、前記ガベージコレクションの実行の要否を判定する、
ことを特徴とするメモリ制御方法。
A memory control method for controlling execution of garbage collection to flash memory,
Sector usage status detection step of checking the usage status of each sector constituting the flash memory and detecting the number of empty sectors;
A file information management step of detecting a processing state of one or a plurality of files stored in the flash memory, and storing and managing the detected processing state in file information generated for each file;
Based on the number of empty sectors detected in the sector usage status detection step and the processing status of each file detected in the file information management step, it is determined whether or not it is necessary to execute garbage collection on the flash memory. and garbage collection decision step that, the possess,
The file information managed in the file information management step includes the priority given to each file,
In the file information management step, it is detected whether each of one or a plurality of files stored in the flash memory is currently open,
In the garbage collection determination step, the value of the number of empty sectors detected in the sector usage status detection step is between a predetermined lower limit value and an allowable value larger than the lower limit value, and is currently open. If the file in the file does not exist, it is determined that the garbage collection needs to be executed. On the other hand, if the file currently open exists, based on the priority assigned to the file, Determining whether the garbage collection needs to be executed;
And a memory control method.
フラッシュメモリに対するガベージコレクションの実行を制御するメモリ制御方法であって、A memory control method for controlling execution of garbage collection to flash memory,
前記フラッシュメモリを構成する各セクタの利用状況をチェックして、空きセクタ数を検出するセクタ利用状況検出ステップと、Sector usage status detection step of checking the usage status of each sector constituting the flash memory and detecting the number of empty sectors;
前記フラッシュメモリに格納されている1又は複数のファイルの処理状態を検出し、検出した処理状態を、各ファイル毎に生成したファイル情報に格納して管理するファイル情報管理ステップと、A file information management step of detecting a processing state of one or a plurality of files stored in the flash memory, and storing and managing the detected processing state in file information generated for each file;
前記セクタ利用状況検出ステップで検出された前記空きセクタ数と、前記ファイル情報管理ステップで検出された前記各ファイルの処理状態と、に基づいて、前記フラッシュメモリに対するガベージコレクションの実行の要否を判定するガベージコレクション判定ステップと、Based on the number of empty sectors detected in the sector usage status detection step and the processing status of each file detected in the file information management step, it is determined whether or not it is necessary to execute garbage collection on the flash memory. A garbage collection determination step,
前記ガベージコレクション判定ステップでガベージコレクションの実行が必要であると判定された場合、ガベージコレクションを実行するガベージコレクション実行ステップと、を有し、A garbage collection execution step for executing garbage collection when it is determined in the garbage collection determination step that execution of garbage collection is necessary;
前記フラッシュメモリを構成する各ブロックのヘッダ領域には、ガベージコレクションの実行時において、コピー元のセクタについての情報を格納するためのコピー元情報領域が設けられており、前記ガベージコレクション実行ステップでは、コピー先のセクタを決定すると、当該コピー先のセクタに対応する前記コピー元情報領域に、当該消去対象ブロックのブロック番号と、コピー元のセクタ番号と、コピー状態として、コピーが完了していないことを示す情報と、を格納し、コピーが完了すると、前記コピー元情報領域の前記コピー状態を、コピーが完了したことを示す情報に更新する、The header area of each block constituting the flash memory is provided with a copy source information area for storing information about a copy source sector at the time of execution of garbage collection, and in the garbage collection execution step, When the copy-destination sector is determined, the copy source information area corresponding to the copy-destination sector has not been copied as the block number of the block to be erased, the sector number of the copy-source, and the copy status. When the copy is completed, the copy status in the copy source information area is updated to information indicating that the copy is completed.
ことを特徴とするメモリ制御方法。And a memory control method.
JP2010076287A 2010-03-29 2010-03-29 Memory control device and memory control method Expired - Fee Related JP5183662B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010076287A JP5183662B2 (en) 2010-03-29 2010-03-29 Memory control device and memory control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010076287A JP5183662B2 (en) 2010-03-29 2010-03-29 Memory control device and memory control method

Publications (2)

Publication Number Publication Date
JP2011209963A JP2011209963A (en) 2011-10-20
JP5183662B2 true JP5183662B2 (en) 2013-04-17

Family

ID=44940958

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010076287A Expired - Fee Related JP5183662B2 (en) 2010-03-29 2010-03-29 Memory control device and memory control method

Country Status (1)

Country Link
JP (1) JP5183662B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11966327B2 (en) 2022-01-26 2024-04-23 Kioxia Corporation Memory system

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101549569B1 (en) * 2014-02-14 2015-09-03 고려대학교 산학협력단 Method for performing garbage collection and flash memory apparatus using the method
JP7167295B2 (en) * 2017-10-27 2022-11-08 キオクシア株式会社 Memory system and control method
JP6982468B2 (en) * 2017-10-27 2021-12-17 キオクシア株式会社 Memory system and control method
JP7204020B2 (en) * 2020-10-23 2023-01-13 キオクシア株式会社 Control method
JP7366222B2 (en) * 2021-11-17 2023-10-20 キオクシア株式会社 Memory system and control method
CN114398008A (en) * 2021-12-31 2022-04-26 珠海妙存科技有限公司 Data recovery method, controller and computer-readable storage medium
JP7661297B2 (en) * 2022-01-13 2025-04-14 キオクシア株式会社 Memory System

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004178417A (en) * 2002-11-28 2004-06-24 Hitachi Ltd Processing device having nonvolatile memory means and nonvolatile memory control method
JP3688286B2 (en) * 2003-06-09 2005-08-24 三菱電機株式会社 Information storage control device, information storage control method, and information storage control program
KR100690804B1 (en) * 2005-06-13 2007-03-09 엘지전자 주식회사 How to organize memory of mobile device
JP2010003150A (en) * 2008-06-20 2010-01-07 Nec Personal Products Co Ltd Memory controller and method for managing data in flash memory

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11966327B2 (en) 2022-01-26 2024-04-23 Kioxia Corporation Memory system

Also Published As

Publication number Publication date
JP2011209963A (en) 2011-10-20

Similar Documents

Publication Publication Date Title
JP5183662B2 (en) Memory control device and memory control method
US7774390B2 (en) Apparatus for collecting garbage block of nonvolatile memory according to power state and method of collecting the same
JP5413572B2 (en) Memory storage device and control method thereof
US10168940B2 (en) Data storage using SLC and TLC memory banks and data maintenance method thereof
JP4713867B2 (en) Memory controller, memory device, and memory controller control method
KR101176702B1 (en) Nand error management
US11126561B2 (en) Method and system for organizing NAND blocks and placing data to facilitate high-throughput for random writes in a solid state drive
JP5874525B2 (en) Control device, storage device, and storage control method
US20170285953A1 (en) Data Storage Device and Data Maintenance Method thereof
US8819332B2 (en) Nonvolatile storage device performing periodic error correction during successive page copy operations
JP4843222B2 (en) Semiconductor memory device control method, memory card, and host device
JP4513786B2 (en) Memory controller, memory system, and memory control method
JP5452735B2 (en) Memory controller and memory access method
CN103389943A (en) Control device, storage device, and storage control method
JP2013109404A (en) Information processing device
JP4235646B2 (en) Memory controller and flash memory system
JP5253471B2 (en) Memory controller
JP4334331B2 (en) Flash memory access control method
JP2008097339A (en) MEMORY CONTROLLER, FLASH MEMORY SYSTEM PROVIDED WITH MEMORY CONTROLLER, AND FLASH MEMORY CONTROL METHOD
JP3934659B1 (en) Memory controller and flash memory system
JP2014115927A (en) Program update device, method, program, and recording medium
JP2013218388A (en) Program update device, method, program, and recording medium
JP4213166B2 (en) Memory controller and flash memory system
JP2008077468A (en) Memory controller, flash memory system with memory controller, and control method of flash memory
JP2008299513A (en) Data storage device, and method for controlling the same

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120925

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121002

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20121130

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20121218

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130115

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 5183662

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20160125

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees