Patent ID: 8200891

Claim:
A memory controller for controlling access to one or more flash memories in which data erasing is performed in physical blocks, comprising: a logical block management unit which forms plural logical blocks each composed of plural logical sectors to each of which a logical address for a host system is assigned; a program-erase cycles management unit which manages a number of program-erase cycles of each physical block; an assignment unit which assigns a logical block composed of plural logical sectors each assigned a logical address provided from a host system to a physical block; a search unit which searches out a free physical block among each of groups into which physical blocks are divided on a basis of one or more predetermined thresholds relating to a number of program-erase cycles; an identifying unit which identifies a physical block to which a logical block is assigned earliest among each of the groups; a data writing unit which, in response to a request issued by the host system, identifies a logical block including a logical sector corresponding to a logical address pertaining to the request and stores data provided from the host system in a physical block corresponding to the logical block identified; and a data transfer unit which transfers data stored in a physical block identified by the identifying unit to a free physical block searched out by the search unit; wherein, when the assignment unit assigns a logical block to a physical block, the search unit performs a search for a free physical block so that a free physical block among a first group of the groups precedes a free physical block among a second group of the groups, which covers a larger number of program-erase cycles than that covered by the first group, in the search; and wherein, in a case where there is at least one physical block included in a third group of the groups, which covers a smaller number of program-erase cycles than that covered by a group including a free physical block searched out in the search, the identifying unit identifies a physical block to which a logical block is assigned earliest among the third group, the data transfer unit transfers data stored in the physical block identified to the free physical block searched out, and the assignment unit assigns the logical block to the physical block identified after the data transfer unit completes data transfer.