





技术领域technical field
本发明涉及通信领域,尤其涉及一种缓存目录的实现方法及装置。The invention relates to the communication field, in particular to a method and device for realizing a cache directory.
背景技术Background technique
处理器(CPU)是终端设备和服务器设备中必不可少的重要部件。随着终端设备和服务器设备性能的不断提高,多核处理器系统逐渐成为主流,例如常见的UMA(Uniform Memory Access,统一内存访问)系统和NUMA(Non-UniformMemory Access,非统一内存访问)系统等,均包括多个处理器模块。在多核处理器系统中,由于读写速度的差异,当CPU进行存储器访问时,会优先从本地cache查找并获取目标数据;若该CPU的本地高速缓冲存储器(cache)中没有存储目标数据,则从其他CPU的cache中查找并获取目标数据;若其他CPU的本地cache中没有存储目标数据,则从内存中查找并获取目标数据。A processor (CPU) is an essential and important component in terminal equipment and server equipment. With the continuous improvement of the performance of terminal equipment and server equipment, multi-core processor systems have gradually become mainstream, such as common UMA (Uniform Memory Access, unified memory access) systems and NUMA (Non-Uniform Memory Access, non-uniform memory access) systems, etc., Each includes a plurality of processor modules. In a multi-core processor system, due to the difference in read and write speed, when the CPU accesses the memory, it will first search and obtain the target data from the local cache; if the target data is not stored in the local cache memory (cache) of the CPU, then Search and obtain the target data from the caches of other CPUs; if the target data is not stored in the local caches of other CPUs, search and obtain the target data from the memory.
根据上述CPU查找及获取目标用户的方法,需要对cache和内存中的数据进行缓存一致性处理,以对处理器系统中存储的数据进行统计。一种实现方法是通过建立缓存目录、以目录的方式记录多CPU系统中的缓存数据和共享数据的位置和状态。一种较为常见的缓存目录是全映射目录,该目录完整的存储了处理器系统中所有地址空间(包括内存和cache)的数据信息,包括所有的共享数据在各处理器cache中的缓存信息。According to the method for searching and acquiring target users by the CPU, it is necessary to perform cache consistency processing on the data in the cache and memory, so as to make statistics on the data stored in the processor system. One implementation method is to establish a cache directory and record the location and status of the cache data and shared data in the multi-CPU system in a directory manner. A relatively common cache directory is a full-map directory, which completely stores data information of all address spaces (including memory and cache) in the processor system, including cache information of all shared data in each processor cache.
在实现本发明的过程中,发明人发现现有技术中至少存在如下问题:由于处理器系统中的地址空间较大、处理器数量较多,所以全映射目录所占的存储空间较大,使得全映射目录的访问速度慢且存储使用率较低。In the process of realizing the present invention, the inventor found that there are at least the following problems in the prior art: due to the large address space and the large number of processors in the processor system, the storage space occupied by the full mapping directory is relatively large, making Full-mapped directories have slower access and lower storage usage.
发明内容Contents of the invention
本发明的实施例提供一种缓存目录的实现方法及装置,能够解决现有技术中缓存目录的访问速度慢且存储使用率较低的问题。Embodiments of the present invention provide a method and device for implementing a cache directory, which can solve the problems of slow access speed and low storage usage of the cache directory in the prior art.
为达到上述目的,本发明的实施例采用如下技术方案:In order to achieve the above object, embodiments of the present invention adopt the following technical solutions:
第一方面,本发明实施例提供了一种缓存目录的实现方法,所述方法包括:In a first aspect, an embodiment of the present invention provides a method for implementing a cache directory, the method including:
创建缓存目录,所述缓存目录包括公有数据目录和私有数据目录,所述公有数据目录用于记录公有数据的数据块信息,所述私有数据目录用于记录私有数据的数据块信息;Create a cache directory, the cache directory includes a public data directory and a private data directory, the public data directory is used to record data block information of public data, and the private data directory is used to record data block information of private data;
当接收到第一处理器发送的读写请求时,确定该读写请求对应的目标数据的数据类型,所述数据类型包括私有数据、或公有数据;When receiving the read-write request sent by the first processor, determine the data type of the target data corresponding to the read-write request, where the data type includes private data or public data;
根据所述数据类型,在所述缓存目录中记录所述目标数据的数据块信息。According to the data type, record the data block information of the target data in the cache directory.
在一种可能的实现方式中,所述方法还包括:In a possible implementation, the method further includes:
接收第一处理器发送的读写请求,所述读写请求包括目标数据的物理地址;receiving a read-write request sent by the first processor, where the read-write request includes the physical address of the target data;
所述当接收到第一处理器发送的读写请求时,确定该读写请求对应的目标数据的数据类型,包括:根据所述读写请求确定目标数据的物理地址,检测所述缓存目录中是否记录有所述目标数据的物理地址。When receiving the read-write request sent by the first processor, determining the data type of the target data corresponding to the read-write request includes: determining the physical address of the target data according to the read-write request, and detecting the physical address of the target data in the cache directory Whether the physical address of the target data is recorded.
在一种可能的情况下:In one possible case:
如果所述缓存目录中没有记录所述目标数据的物理地址,则确定所述目标数据的数据类型为私有数据;If the physical address of the target data is not recorded in the cache directory, then determine that the data type of the target data is private data;
则所述根据所述数据类型,在所述缓存目录中记录所述目标数据的数据块信息,包括:在所述私有数据目录中记录所述目标数据的数据块信息,包括所述目标数据的物理地址以及对所述目标数据块进行读写操作的处理器标识,即第一处理器的标识。Then, according to the data type, recording the data block information of the target data in the cache directory includes: recording the data block information of the target data in the private data directory, including the The physical address and the identifier of the processor performing read and write operations on the target data block, that is, the identifier of the first processor.
在另一种可能的情况下:In another possible case:
如果所述缓存目录中记录有所述目标数据的物理地址,所述确定该读写请求对应的目标数据的数据类型,包括:If the physical address of the target data is recorded in the cache directory, the determining the data type of the target data corresponding to the read/write request includes:
(1)当所述目标数据的物理地址记录于所述缓存目录中的私有数据目录中时,检测所述私有数据目录中该物理地址对应的处理器标识与第一处理器的标识是否相同;若是,则确定所述目标数据的数据类型为私有数据;若否,则确定所述目标数据的数据类型为公有数据;则所述根据所述数据类型,在所述缓存目录中记录所述目标数据的数据块信息,包括:如果确定所述目标数据的数据类型为私有数据,则根据所述读写请求在所述私有数据目录中更新所述目标数据的数据块信息,所述数据块信息包括所述目标数据的读写次数、读写时间;如果确定所述目标数据的数据类型为公有数据,则将所述目标数据的数据块信息记录于所述公有数据目录中,将所述目标数据在所述私有数据目录中的目录项置为无效。(1) When the physical address of the target data is recorded in the private data directory in the cache directory, detect whether the processor identifier corresponding to the physical address in the private data directory is the same as the identifier of the first processor; If so, then determine that the data type of the target data is private data; if not, then determine that the data type of the target data is public data; then according to the data type, record the target in the cache directory The data block information of the data, including: if it is determined that the data type of the target data is private data, updating the data block information of the target data in the private data directory according to the read and write request, the data block information Including the read-write times and read-write time of the target data; if it is determined that the data type of the target data is public data, the data block information of the target data is recorded in the public data directory, and the target Directory entries for data in said private data directory are invalidated.
(2)当所述目标数据的物理地址记录于所述缓存目录中的公有数据目录中时,所述确定该读写请求对应的目标数据的数据类型,包括:确定所述目标数据的数据类型为公有数据;则所述根据所述数据类型,在所述缓存目录中记录所述目标数据的数据块信息,包括:在所述缓存目录中的公有数据目录中对所述目标数据的位向量标识进行修改,在所述位向量标识中增加第一处理器的信息。(2) When the physical address of the target data is recorded in the public data directory in the cache directory, determining the data type of the target data corresponding to the read and write request includes: determining the data type of the target data is public data; then according to the data type, recording the data block information of the target data in the cache directory includes: a bit vector of the target data in the public data directory in the cache directory The identifier is modified, and information about the first processor is added to the bit vector identifier.
第二方面,本发明实施例还提供了一种缓存目录的实现装置,所述装置包括:In the second aspect, the embodiment of the present invention also provides a device for implementing a cache directory, the device comprising:
建立单元,用于创建缓存目录,所述缓存目录包括公有数据目录和私有数据目录,所述公有数据目录用于记录公有数据的数据块信息,所述私有数据目录用于记录私有数据的数据块信息;The establishment unit is used to create a cache directory, the cache directory includes a public data directory and a private data directory, the public data directory is used to record data block information of public data, and the private data directory is used to record data blocks of private data information;
确定单元,用于当接收到第一处理器发送的读写请求时,确定该读写请求对应的目标数据的数据类型,所述数据类型包括私有数据、或公有数据;The determining unit is configured to, when receiving the read-write request sent by the first processor, determine the data type of the target data corresponding to the read-write request, where the data type includes private data or public data;
记录单元,用于根据所述确定单元确定的数据类型,在所述建立单元创建的缓存目录中记录所述目标数据的数据块信息。The recording unit is configured to record the data block information of the target data in the cache directory created by the establishing unit according to the data type determined by the determining unit.
在一种可能的实现方式中,所述装置还包括:In a possible implementation manner, the device further includes:
接收单元,用于接收第一处理器发送的读写请求,所述读写请求包括目标数据的物理地址。The receiving unit is configured to receive a read-write request sent by the first processor, where the read-write request includes the physical address of the target data.
所述确定单元包括:检测模块,用于根据所述读写请求确定目标数据的物理地址,检测所述缓存目录中是否记录有所述目标数据的物理地址;The determining unit includes: a detection module, configured to determine the physical address of the target data according to the read/write request, and detect whether the physical address of the target data is recorded in the cache directory;
在一种可能的情况下:In one possible case:
所述确定单元用于当所述检测模块检测缓存目录中没有记录所述目标数据的物理地址时,确定所述目标数据的数据类型为私有数据;The determining unit is configured to determine that the data type of the target data is private data when the detection module detects that the physical address of the target data is not recorded in the cache directory;
所述记录单元具体用于在所述私有数据目录中记录所述目标数据的数据块信息,包括所述目标数据的物理地址以及对所述目标数据块进行读写操作的处理器标识,即第一处理器的标识。The recording unit is specifically configured to record the data block information of the target data in the private data directory, including the physical address of the target data and the processor identifier for reading and writing the target data block, that is, the first A processor identification.
在另一种可能的情况下:In another possible case:
当所述检测模块确定所述缓存目录中记录有所述目标数据的物理地址时,所述检测模块还用于进一步确定所述目标数据的在所述缓存目录中的具体位置,所述具体位置包括私有数据目录和公有数据目录;When the detection module determines that the physical address of the target data is recorded in the cache directory, the detection module is further configured to further determine a specific location of the target data in the cache directory, the specific location Including private data directory and public data directory;
(1)所述检测模块还用于当确定所述目标数据的物理地址记录于所述缓存目录中的私有数据目录时,检测所述私有数据目录中该物理地址对应的处理器标识与第一处理器的标识是否相同;若是,则所述确定单元确定所述目标数据的数据类型为私有数据;若否,则所述确定单元确定所述目标数据的数据类型为公有数据;(1) The detection module is further configured to detect that the processor identifier corresponding to the physical address in the private data directory is the same as the first Whether the identifiers of the processors are the same; if so, the determination unit determines that the data type of the target data is private data; if not, the determination unit determines that the data type of the target data is public data;
所述记录单元具体用于当确定所述目标数据的数据类型为私有数据时,根据所述读写请求在所述私有数据目录中更新所述目标数据的数据块信息,所述数据块信息包括所述目标数据的读写次数、读写时间;以及The recording unit is specifically configured to update the data block information of the target data in the private data directory according to the read/write request when it is determined that the data type of the target data is private data, and the data block information includes The reading and writing times and reading and writing time of the target data; and
所述记录单元具体用于当确定所述目标数据的数据类型为公有数据时,将所述目标数据的数据块信息记录于所述公有数据目录中,将所述目标数据在所述私有数据目录中的目录项置为无效。The recording unit is specifically configured to record the data block information of the target data in the public data directory, and record the target data in the private data directory when it is determined that the data type of the target data is public data. The directory entry in is invalidated.
(2)所述确定单元用于当所述检测模块确定所述目标数据的物理地址记录于所述公有数据目录中时,确定所述目标数据的数据类型为公有数据;(2) The determining unit is configured to determine that the data type of the target data is public data when the detection module determines that the physical address of the target data is recorded in the public data directory;
所述记录单元用于在所述缓存目录中的公有数据目录中对所述目标数据的位向量标识进行修改,在所述位向量标识中增加第一处理器的信息。The recording unit is configured to modify the bit vector identifier of the target data in the public data directory in the cache directory, and add information about the first processor to the bit vector identifier.
本发明实施例提供的缓存目录的实现方法及装置,建立缓存目录、并将缓存目录划分为私有数据目录和公有数据目录,通过私有数据目录记录处理器系统中各处理器的私有数据的数据块信息,通过公有数据目录记录处理器系统中多个处理器共享数据的数据块信息。一方面,由于处理器系统的cache容量有限,所以能够节省所述缓存目录占用的存储空间;另一方面,由于私有数据仅被唯一的处理器访问,无需记录其他处理器的访问信息,能够有效的提升缓存目录的使用效率。The implementation method and device of the cache directory provided by the embodiment of the present invention, the cache directory is established, and the cache directory is divided into a private data directory and a public data directory, and the private data data blocks of each processor in the processor system are recorded through the private data directory Information, through the public data directory to record the data block information of data shared by multiple processors in the processor system. On the one hand, due to the limited cache capacity of the processor system, the storage space occupied by the cache directory can be saved; on the other hand, since the private data is only accessed by the only processor, there is no need to record the access information of other processors, which can effectively Improve the usage efficiency of the cache directory.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本发明实施例一提供的缓存目录的实现方法的流程示意图;FIG. 1 is a schematic flowchart of a method for implementing a cache directory provided in Embodiment 1 of the present invention;
图2为本发明实施例二提供的缓存目录的实现方法的流程示意图;FIG. 2 is a schematic flowchart of a method for implementing a cache directory provided in Embodiment 2 of the present invention;
图3为本发明实施例二提供的私有数据目录的逻辑结构图;FIG. 3 is a logical structural diagram of a private data directory provided by Embodiment 2 of the present invention;
图4、图5、图6为本发明实施例三提供的缓存目录的实现装置的结构框图。FIG. 4 , FIG. 5 , and FIG. 6 are structural block diagrams of an apparatus for implementing a cache directory provided in Embodiment 3 of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
实施例一Embodiment one
本发明实施例提供了一种缓存目录的实现方法,如图1所示,所述方法包括:An embodiment of the present invention provides a method for implementing a cache directory, as shown in FIG. 1 , the method includes:
101、目录缓存控制器创建缓存目录,所述缓存目录包括公有数据目录和私有数据目录,所述公有数据目录用于记录公有数据的数据块信息,所述私有数据目录用于记录私有数据的数据块信息。101. The directory cache controller creates a cache directory, the cache directory includes a public data directory and a private data directory, the public data directory is used to record data block information of public data, and the private data directory is used to record data of private data block information.
值得说明的是,本实施例缓存目录用于记录处理器模块的cache中缓存数据的数据块信息,所述处理器模块包括多个处理器,所述cache供所述多个处理器公用。缓存目录的目录项的项数取决于cache中缓存数据的数据量,由于cache的存储空间有限、且cache的存储空间通常远小于处理器模块内存的存储空间,所以本实施例中缓存目录的目录项的项数远小于现有技术中的全映射目录。由于缓存目录的容量较小,所以本实施例中缓存目录的访问速度能够得到较大的提升。It should be noted that the cache directory in this embodiment is used to record the data block information of the cached data in the cache of the processor module, where the processor module includes multiple processors, and the cache is shared by the multiple processors. The number of items in the directory entry of the cache directory depends on the amount of cached data in the cache. Since the storage space of the cache is limited, and the storage space of the cache is usually much smaller than the storage space of the processor module memory, the directory of the cache directory in this embodiment The number of items is much smaller than the full map directory in the prior art. Since the capacity of the cache directory is small, the access speed of the cache directory in this embodiment can be greatly improved.
102、当接收到第一处理器发送的读写请求时,所述目录缓存控制器确定该读写请求对应的目标数据的数据类型,所述数据类型包括私有数据、或公有数据。102. When receiving a read/write request sent by the first processor, the directory cache controller determines a data type of target data corresponding to the read/write request, where the data type includes private data or public data.
103、所述目录缓存控制器根据所述数据类型,在所述缓存目录中记录所述目标数据的数据块信息。103. The directory cache controller records data block information of the target data in the cache directory according to the data type.
值得说明的是,由于私有数据仅被唯一的处理器访问,所以在记录私有数据时,无需对私有数据进行缓存一致性处理,仅记录所述私有数据对应的处理器标识,能够有效的节省缓存目录所占用的存储空间,同时还可以记录更多的公有数据的数据块信息,提高缓存目录的使用效率。It is worth noting that since the private data is only accessed by the only processor, when recording the private data, there is no need to perform cache consistency processing on the private data, and only the processor ID corresponding to the private data is recorded, which can effectively save the cache The storage space occupied by the directory can also record more data block information of public data, and improve the efficiency of the cache directory.
本发明实施例提供的缓存目录的实现方法,缓存目录仅记录cache中缓存数据的数据块信息(无需记录内存中数据的数据块信息),所以本实施例中的缓存目录的容量较小,访问速度能够得到较大的提升;另一方面,通过识别私有数据、并在私有数据目录中记录私有数据的数据块信息,由于私有数据目录占用的存储空间较少,所以能够有效的提升缓存目录的使用效率。The implementation method of the cache directory provided by the embodiment of the present invention, the cache directory only records the data block information of the cached data in the cache (there is no need to record the data block information of the data in the memory), so the capacity of the cache directory in this embodiment is small, and the access The speed can be greatly improved; on the other hand, by identifying the private data and recording the data block information of the private data in the private data directory, since the private data directory occupies less storage space, the cache directory can be effectively improved. Use efficiency.
实施例二Embodiment two
本发明实施例提供了一种缓存目录的实现方法,如图2所示,所述方法包括:An embodiment of the present invention provides a method for implementing a cache directory, as shown in FIG. 2 , the method includes:
201、目录缓存控制器创建缓存目录,所述缓存目录包括公有数据目录和私有数据目录,所述公有数据目录用于记录公有数据的数据块信息,所述私有数据目录用于记录私有数据的数据块信息。201. The directory cache controller creates a cache directory, the cache directory includes a public data directory and a private data directory, the public data directory is used to record data block information of public data, and the private data directory is used to record data of private data block information.
值得说明的是,与现有技术中的全映射目录不同,本实施例中的缓存目录用于记录处理器系统中缓存数据的数据块信息。其中,所述公有数据的数据块信息包括缓存数据的物理地址与位向量标识的对应关系,所述位向量标识包括N个指针,用于表征所述公有数据对应的处理器,所述N是处理器的个数;所述私有数据的数据信息包括缓存数据的物理地址以及该缓存数据对应的处理器标识。It is worth noting that, unlike the full-map directory in the prior art, the cache directory in this embodiment is used to record data block information of cached data in the processor system. Wherein, the data block information of the public data includes the corresponding relationship between the physical address of the cached data and the bit vector identifier, and the bit vector identifier includes N pointers, which are used to represent the processor corresponding to the public data, and the N is The number of processors; the data information of the private data includes the physical address of the cached data and the identifier of the processor corresponding to the cached data.
202、所述目录缓存控制器接收第一处理器发送的读写请求,所述读写请求包括目标数据的物理地址。202. The directory cache controller receives a read/write request sent by the first processor, where the read/write request includes the physical address of the target data.
本实施例提供的方法适用于多核处理器系统中的处理器模块,该处理器模块包括多个处理器、cache、以及内存,其中,所述cache和内存供所述多个处理器共用。The method provided in this embodiment is applicable to a processor module in a multi-core processor system, where the processor module includes multiple processors, a cache, and memory, where the cache and memory are shared by the multiple processors.
203、所述目录缓存控制器根据所述读写请求确定目标数据的物理地址,检测所述缓存目录中是否记录有所述目标数据的物理地址;若否,则执行204,若是,则执行205。203. The directory cache controller determines the physical address of the target data according to the read and write request, and detects whether the physical address of the target data is recorded in the cache directory; if not, execute 204; if yes, execute 205 .
204、所述目录缓存控制器确定所述目标数据的数据类型为私有数据,在所述私有数据目录中记录所述目标数据的数据块信息,包括所述目标数据的物理地址以及对所述目标数据块进行读写操作的处理器标识,即第一处理器的标识。204. The directory cache controller determines that the data type of the target data is private data, and records the data block information of the target data in the private data directory, including the physical address of the target data and the The identifier of the processor performing read and write operations on the data block, that is, the identifier of the first processor.
也就是说,本实施例提供的缓存目录的实现方法,在对所有的数据进行初始记录时,均作为私有数据进行处理。如果后续存在其他处理器对某一数据进行读写操作,则将该数据的数据类型修改为公有数据。That is to say, in the implementation method of the cache directory provided in this embodiment, all data are treated as private data when initial recording is performed. If other processors subsequently perform read and write operations on certain data, the data type of the data is changed to public data.
205、所述目录缓存控制器进一步检测所述目标数据的物理地址在所述缓存目录中的具体位置;如果所述目标数据的物理地址记录于所述缓存目录中的公有数据目录中,执行206;如果所述目标数据的物理地址记录于所述缓存目录中的私有数据目录中,执行207。205. The directory cache controller further detects the specific location of the physical address of the target data in the cache directory; if the physical address of the target data is recorded in the public data directory in the cache directory, execute 206 ; If the physical address of the target data is recorded in the private data directory in the cache directory, go to step 207.
206、所述目录缓存控制器确定所述目标数据的数据类型为公有数据;在所述缓存目录中的公有数据目录中对所述目标数据的位向量标识进行修改,在所述位向量标识中增加第一处理器的信息。206. The directory cache controller determines that the data type of the target data is public data; modify the bit vector identifier of the target data in the public data directory in the cache directory, and in the bit vector identifier Add information about the first processor.
由于公有数据会被多个处理器进行读写操作,所以公有数据目录中的每个目录项包括N个指针(N是当前处理器模块中处理器的个数),这些指针构成位向量标识,每个位向量标识所占用的存储空间为N比特。Since the public data will be read and written by multiple processors, each directory entry in the public data directory includes N pointers (N is the number of processors in the current processor module), and these pointers form a bit vector identifier, The storage space occupied by each bit vector identifier is N bits.
207、所述目录缓存控制器检测所述目标数据的物理地址对应的处理器标识与第一处理器的标识是否相同;若是,则执行208;若否,则执行209。207. The directory cache controller detects whether the processor identifier corresponding to the physical address of the target data is the same as the identifier of the first processor; if yes, execute 208; if not, execute 209.
208、所述目录缓存控制器确定所述目标数据的数据类型为私有数据,根据所述读写请求在所述私有数据目录中更新所述目标数据的数据块信息,所述数据块信息包括所述目标数据的读写次数、读写时间。208. The directory cache controller determines that the data type of the target data is private data, and updates the data block information of the target data in the private data directory according to the read/write request, and the data block information includes the Describe the read and write times and read and write time of the target data.
具体的,为了便于理解,本发明实施例提供了一种私有数目目录的逻辑结构图,如图3所示,所述私有数据目录项包括物理地址位(Block_Address表示私有数据的物理地址)、处理器标识位(n表示私有数据对应的处理器标识)、有效位(1表示当前目录项有效,0表示当前目录项无效)。其中,物理地址位的长度取决于处理器模块中地址线的长度,处理器标识位的长度取决于处理器的个数,有效位的长度固定为1比特。具体的,如果当前处理器模块由N个处理器构成,则处理器标识位的长度为Log N比特。由此可见,与公有数据目录中的位向量标识相比,记录一个物理地址的数据块信息能够节省(N-Log N-1)比特,所以从目标数据中识别出私有数据能够有效的节省存储空间。以包括N=64个处理器的处理器模块为例,记录一个私有数据比记录一个公有数据能够节省N-Log N-1=57比特。Specifically, for ease of understanding, the embodiment of the present invention provides a logical structure diagram of a private number directory, as shown in FIG. 3 , the private data directory entry includes physical address bits (Block_Address represents the physical address of private device identification bit (n indicates the processor identification corresponding to the private data), valid bit (1 indicates that the current directory entry is valid, and 0 indicates that the current directory entry is invalid). Wherein, the length of the physical address bit depends on the length of the address line in the processor module, the length of the processor identification bit depends on the number of processors, and the length of the valid bit is fixed at 1 bit. Specifically, if the current processor module consists of N processors, the length of the processor identification bit is Log N bits. It can be seen that compared with the bit vector identifier in the public data directory, recording the data block information of a physical address can save (N-Log N-1) bits, so identifying private data from the target data can effectively save storage space. Taking a processor module including N=64 processors as an example, recording a private data can save N-Log N-1=57 bits compared with recording a public data.
值得说明的是,在多处理器系统,私有数据的数据量是很大的,例如:TPC-H程序中的私有数据量约为20%-25%,OLTP(On-Line Transaction Processing,联机事务处理系统)Oracle数据库中的私有数据量约为35%科学计算程序为80%以上。所以,在多处理器系统中采用本实施例提供的方法,能够有效提升缓存目录的使用效率。It is worth noting that in a multiprocessor system, the amount of private data is very large, for example: the amount of private data in the TPC-H program is about 20%-25%, OLTP (On-Line Transaction Processing, online transaction Processing system) The amount of private data in the Oracle database is about 35% and the scientific computing program is more than 80%. Therefore, using the method provided by this embodiment in a multi-processor system can effectively improve the efficiency of using the cache directory.
209、所述目录缓存控制器确定所述目标数据的数据类型为公有数据,将所述目标数据的数据块信息记录于所述公有数据目录中,并将所述目标数据在所述私有数据目录中的目录项置为无效。209. The directory cache controller determines that the data type of the target data is public data, records the data block information of the target data in the public data directory, and stores the target data in the private data directory The directory entry in is invalidated.
优选的,当所述公有数据目录和私有数据目录中没有空闲目录项时,所述方法还包括:所述目录缓存控制器在所述公有数据目录和私有数据目录中确定指定目录项作为可替换目录项,对该指定目录项进行替换,以记录所述目标数据的数据块信息。Preferably, when there is no free directory entry in the public data directory and the private data directory, the method further includes: the directory cache controller determines a specified directory entry in the public data directory and the private data directory as a replacement A directory entry is used to replace the specified directory entry to record the data block information of the target data.
例如,所述目录缓存控制器可以为所述公有数据目录和私有数据目录分别设定时间阈值,将超过预设时间阈值还没有被访问的目录项确定为可替换目录项。For example, the directory cache controller may set time thresholds for the public data directory and the private data directory respectively, and determine directory items that have not been accessed beyond the preset time threshold as replaceable directory items.
可选的,如果所述超过预设时间阈值还没有被访问的目录项为零,则所述目录缓存控制器可以在所述公有数据目录和私有数据目录中查找使用次数最少的目标项,确定该目录项为可替换目录项。Optionally, if the directory entries that have not been accessed beyond the preset time threshold are zero, the directory cache controller may search the public data directory and the private data directory for the target item with the least number of uses, and determine The catalog entry is a replaceable catalog entry.
需要特别强调的是,本发明实施例提供的缓存目录的实现方法,只需修改目录缓存结构即可识别出私有数据,无需对多处理器系统中的硬件或软件进行任何修改,便于实现。It should be emphasized that the implementation method of the cache directory provided by the embodiment of the present invention can identify private data only by modifying the directory cache structure, without any modification to the hardware or software in the multiprocessor system, which is easy to implement.
本发明实施例提供的缓存目录的实现方法,缓存目录仅记录cache中缓存数据的数据块信息(无需记录内存中数据的数据块信息),所以本实施例中的缓存目录的容量较小,访问速度能够得到较大的提升;另一方面通过识别出私有数据并在所述私有数据目录中对所述私有数据进行记录,能够有效的提升缓存目录的使用效率。The implementation method of the cache directory provided by the embodiment of the present invention, the cache directory only records the data block information of the cached data in the cache (there is no need to record the data block information of the data in the memory), so the capacity of the cache directory in this embodiment is small, and the access The speed can be greatly improved; on the other hand, by identifying private data and recording the private data in the private data directory, the use efficiency of the cache directory can be effectively improved.
实施例三Embodiment Three
本发明实施例提供了一种缓存目录的实现装置,能够实现上述方法实施例,如图4所示,所述装置包括:An embodiment of the present invention provides a device for implementing a cache directory, which can implement the above method embodiment, as shown in FIG. 4 , the device includes:
建立单元41,用于创建缓存目录,所述缓存目录包括公有数据目录和私有数据目录,所述公有数据目录用于记录公有数据的数据块信息,所述私有数据目录用于记录私有数据的数据块信息;The
确定单元42,用于当接收到第一处理器发送的读写请求时,确定该读写请求对应的目标数据的数据类型,所述数据类型包括私有数据、或公有数据;A determining
记录单元43,用于根据所述确定单元42确定的数据类型,在所述建立单元41创建的缓存目录中记录所述目标数据的数据块信息。The
具体的,所述建立单元41创建的缓存目录用于记录处理器系统中缓存数据的数据块信息;其中,所述公有数据的数据块信息包括缓存数据的物理地址与位向量标识的对应关系,所述位向量标识包括N个指针,用于表征所述公有数据对应的处理器,所述N是处理器的个数;所述私有数据的数据信息包括缓存数据的物理地址以及该缓存数据对应的处理器标识。Specifically, the cache directory created by the
进一步的,如图5所示,所述装置还包括:Further, as shown in Figure 5, the device also includes:
接收单元44,用于接收第一处理器发送的读写请求,所述读写请求包括目标数据的物理地址。The receiving
具体的,如图5所示,所述确定单元42包括检测模块421,用于根据所述读写请求确定目标数据的物理地址,检测所述缓存目录中是否记录有所述目标数据的物理地址;Specifically, as shown in FIG. 5 , the determining
一方面,所述确定单元42用于当所述检测模块421检测缓存目录中没有记录所述目标数据的物理地址时,确定所述目标数据的数据类型为私有数据;On the one hand, the determining
所述记录单元43具体用于在所述私有数据目录中记录所述目标数据的数据块信息,包括所述目标数据的物理地址以及对所述目标数据块进行读写操作的处理器标识,即第一处理器的标识。The
另一方面,当所述检测模块421确定所述缓存目录中记录有所述目标数据的物理地址时,所述检测模块421还用于进一步确定所述目标数据的在所述缓存目录中的具体位置,所述具体位置包括私有数据目录和公有数据目录;On the other hand, when the
具体的,所述检测模块421还用于当确定所述目标数据的物理地址记录于所述缓存目录中的私有数据目录时,检测所述私有数据目录中该物理地址对应的处理器标识与第一处理器的标识是否相同;若是,则所述确定单元42确定所述目标数据的数据类型为私有数据;若否,则所述确定单元42确定所述目标数据的数据类型为公有数据;Specifically, the
所述记录单元43具体用于当确定所述目标数据的数据类型为私有数据时,根据所述读写请求在所述私有数据目录中更新所述目标数据的数据块信息,所述数据块信息包括所述目标数据的读写次数、读写时间;以及The
所述记录单元43具体还用于当确定所述目标数据的数据类型为公有数据时,将所述目标数据的数据块信息记录于所述公有数据目录中,将所述目标数据在所述私有数据目录中的目录项置为无效。The
再一方面,所述确定单元42用于当所述检测模块421确定所述目标数据的物理地址记录于所述公有数据目录中时,确定所述目标数据的数据类型为公有数据;In another aspect, the determining
所述记录单元43用于在所述缓存目录中的公有数据目录中对所述目标数据的位向量标识进行修改,在所述位向量标识中增加第一处理器的信息。The
可选的,如图6所示,所述装置还包括替换单元45,用于当所述公有数据目录和私有数据目录中没有空闲目录项时,在所述公有数据目录和私有数据目录中确定指定目录项作为可替换目录项,对该指定目录项进行替换,以记录所述目标数据的数据块信息。Optionally, as shown in FIG. 6, the device further includes a
具体的,如图6所示,所述替换单元45包括阈值设定模块451,用于为所述公有数据目录和私有数据目录分别设定时间阈值,以使得所述替换单元45将超过预设时间阈值还没有被访问的目录项确定为可替换目录项。Specifically, as shown in FIG. 6, the
可选的,如图6所示,所述替换单元45还包括统计模块452,用于当所述阈值设定模块451确定的超过预设时间阈值还没有被访问的目录项为零时,在所述公有数据目录和私有数据目录中查找使用次数最少的目标项,确定该目录项为可替换目录项。Optionally, as shown in FIG. 6 , the
本发明实施例提供的缓存目录的实现装置,建立单元41建立的缓存目录仅记录cache中缓存数据的数据块信息(无需记录内存中数据的数据块信息),所以本实施例中的缓存目录的容量较小,访问速度能够得到较大的提升;另一方面本实施例中的缓存目录的实现装置能够通过识别出私有数据并在所述私有数据目录中对所述私有数据进行记录,从而有效的提升缓存目录的使用效率。In the implementation device of the cache directory provided by the embodiment of the present invention, the cache directory established by the
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本发明可借助软件加必需的通用硬件的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘,硬盘或光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the present invention can be realized by means of software plus necessary general-purpose hardware, and of course also by hardware, but in many cases the former is a better embodiment . Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a readable storage medium, such as a floppy disk of a computer , a hard disk or an optical disk, etc., including several instructions for enabling a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments of the present invention.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the protection scope of the claims.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210395299.6ACN103049392B (en) | 2012-10-17 | 2012-10-17 | The implementation method of CACHE DIRECTORY and device |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210395299.6ACN103049392B (en) | 2012-10-17 | 2012-10-17 | The implementation method of CACHE DIRECTORY and device |
| Publication Number | Publication Date |
|---|---|
| CN103049392Atrue CN103049392A (en) | 2013-04-17 |
| CN103049392B CN103049392B (en) | 2016-04-06 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201210395299.6AActiveCN103049392B (en) | 2012-10-17 | 2012-10-17 | The implementation method of CACHE DIRECTORY and device |
| Country | Link |
|---|---|
| CN (1) | CN103049392B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103279575A (en)* | 2013-06-20 | 2013-09-04 | 福建伊时代信息科技股份有限公司 | Method and device for processing file information |
| CN104461932A (en)* | 2014-11-04 | 2015-03-25 | 浪潮电子信息产业股份有限公司 | Directory cache management method for big data application |
| WO2016049807A1 (en)* | 2014-09-29 | 2016-04-07 | 华为技术有限公司 | Cache directory processing method and directory controller of multi-core processor system |
| WO2016049808A1 (en)* | 2014-09-29 | 2016-04-07 | 华为技术有限公司 | Cache directory processing method and directory controller of multi-core processor system |
| WO2016201998A1 (en)* | 2015-06-18 | 2016-12-22 | 华为技术有限公司 | Cache distribution, data access and data sending methods, processors, and system |
| CN107810490A (en)* | 2015-06-18 | 2018-03-16 | 华为技术有限公司 | Systems and methods for directory-based cache coherency |
| CN108108402A (en)* | 2017-12-07 | 2018-06-01 | 泰康保险集团股份有限公司 | Data item paraphrase update method and device |
| CN108280355A (en)* | 2017-12-26 | 2018-07-13 | 山东浪潮云服务信息科技有限公司 | A kind of data desensitization method and device |
| CN114978665A (en)* | 2022-05-17 | 2022-08-30 | 中原银行股份有限公司 | Data verification method and data isolation system based on Redis distributed cache platform |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5265232A (en)* | 1991-04-03 | 1993-11-23 | International Business Machines Corporation | Coherence control by data invalidation in selected processor caches without broadcasting to processor caches not having the data |
| CN102346714A (en)* | 2011-10-09 | 2012-02-08 | 西安交通大学 | Consistency maintenance device for multi-kernel processor and consistency interaction method |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5265232A (en)* | 1991-04-03 | 1993-11-23 | International Business Machines Corporation | Coherence control by data invalidation in selected processor caches without broadcasting to processor caches not having the data |
| CN102346714A (en)* | 2011-10-09 | 2012-02-08 | 西安交通大学 | Consistency maintenance device for multi-kernel processor and consistency interaction method |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103279575A (en)* | 2013-06-20 | 2013-09-04 | 福建伊时代信息科技股份有限公司 | Method and device for processing file information |
| CN105659216B (en)* | 2014-09-29 | 2019-03-19 | 华为技术有限公司 | The CACHE DIRECTORY processing method and contents controller of multi-core processor system |
| US10216634B2 (en) | 2014-09-29 | 2019-02-26 | Huawei Technologies Co., Ltd. | Cache directory processing method for multi-core processor system, and directory controller |
| WO2016049808A1 (en)* | 2014-09-29 | 2016-04-07 | 华为技术有限公司 | Cache directory processing method and directory controller of multi-core processor system |
| CN105659216A (en)* | 2014-09-29 | 2016-06-08 | 华为技术有限公司 | Cache directory processing method and directory controller of multi-core processor system |
| WO2016049807A1 (en)* | 2014-09-29 | 2016-04-07 | 华为技术有限公司 | Cache directory processing method and directory controller of multi-core processor system |
| CN104461932A (en)* | 2014-11-04 | 2015-03-25 | 浪潮电子信息产业股份有限公司 | Directory cache management method for big data application |
| CN104461932B (en)* | 2014-11-04 | 2017-05-10 | 浪潮电子信息产业股份有限公司 | Directory cache management method for big data application |
| WO2016201998A1 (en)* | 2015-06-18 | 2016-12-22 | 华为技术有限公司 | Cache distribution, data access and data sending methods, processors, and system |
| CN106326143A (en)* | 2015-06-18 | 2017-01-11 | 华为技术有限公司 | Cache distribution, data access and data sending method, processor and system |
| CN107810490A (en)* | 2015-06-18 | 2018-03-16 | 华为技术有限公司 | Systems and methods for directory-based cache coherency |
| CN106326143B (en)* | 2015-06-18 | 2019-08-27 | 华为技术有限公司 | A cache allocation, data access, data transmission method, processor and system |
| CN108108402A (en)* | 2017-12-07 | 2018-06-01 | 泰康保险集团股份有限公司 | Data item paraphrase update method and device |
| CN108108402B (en)* | 2017-12-07 | 2020-07-17 | 泰康保险集团股份有限公司 | Data item paraphrasing updating method and device |
| CN108280355A (en)* | 2017-12-26 | 2018-07-13 | 山东浪潮云服务信息科技有限公司 | A kind of data desensitization method and device |
| CN114978665A (en)* | 2022-05-17 | 2022-08-30 | 中原银行股份有限公司 | Data verification method and data isolation system based on Redis distributed cache platform |
| Publication number | Publication date |
|---|---|
| CN103049392B (en) | 2016-04-06 |
| Publication | Publication Date | Title |
|---|---|---|
| CN103049392B (en) | The implementation method of CACHE DIRECTORY and device | |
| CN103856567B (en) | Small file storage method based on Hadoop distributed file system | |
| CN108459826B (en) | Method and device for processing IO (input/output) request | |
| CN102725752B (en) | Method and device for processing dirty data | |
| WO2017041570A1 (en) | Method and apparatus for writing data to cache | |
| CN104809179A (en) | Device and method for accessing Hash table | |
| CN107888687B (en) | Proxy client storage acceleration method and system based on distributed storage system | |
| CN101630303A (en) | Request information processing method and device and multiprocessor storage system | |
| CN112346647A (en) | Data storage method, apparatus, device and medium | |
| WO2017181895A1 (en) | Cache-coherence management method and node controller | |
| CN111488293B (en) | Access method and equipment for data visitor directory in multi-core system | |
| US20240086332A1 (en) | Data processing method and system, device, and medium | |
| Wang et al. | Temperature-aware persistent data management for LSM-tree on 3-D NAND flash memory | |
| WO2024093090A1 (en) | Metadata management method and apparatus, computer device, and readable storage medium | |
| CN117349235A (en) | A KV storage system, electronic equipment, and media based on LSM-Tree | |
| CN115981555A (en) | Data processing method and device, electronic equipment and medium | |
| CN108664217B (en) | A caching method and system for reducing write performance jitter of solid state disk storage system | |
| CN103729309A (en) | Method for cataloging Cache consistency | |
| CN105740172A (en) | Block device data cache power-down protection method and system | |
| US20190303476A1 (en) | Dynamic buffer pools for process non-conforming tasks | |
| CN104050189A (en) | Page sharing processing method and device | |
| CN105740167B (en) | A kind of method and system that file system cache is deleted | |
| CN112463652B (en) | Data processing method, device, processing chip and server based on cache coherence | |
| CN107463512B (en) | Data updating method of distributed high-speed storage system | |
| CN109165172B (en) | Cache data processing method and related equipment |
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant |