[go: up one dir, main page]

CN111897487B - Method, device, electronic equipment and medium for managing data - Google Patents

Method, device, electronic equipment and medium for managing data Download PDF

Info

Publication number
CN111897487B
CN111897487B CN202010544948.9A CN202010544948A CN111897487B CN 111897487 B CN111897487 B CN 111897487B CN 202010544948 A CN202010544948 A CN 202010544948A CN 111897487 B CN111897487 B CN 111897487B
Authority
CN
China
Prior art keywords
storage
data
stored
group
queue
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.)
Active
Application number
CN202010544948.9A
Other languages
Chinese (zh)
Other versions
CN111897487A (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.)
Beijing Hannuo Semiconductor Technology Co ltd
Zijinshan Laboratory
Peking University
Original Assignee
Beijing Hannuo Semiconductor Technology Co ltd
Peking University
Network Communication and Security Zijinshan Laboratory
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 Beijing Hannuo Semiconductor Technology Co ltd, Peking University, Network Communication and Security Zijinshan Laboratory filed Critical Beijing Hannuo Semiconductor Technology Co ltd
Priority to CN202010544948.9A priority Critical patent/CN111897487B/en
Publication of CN111897487A publication Critical patent/CN111897487A/en
Application granted granted Critical
Publication of CN111897487B publication Critical patent/CN111897487B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0659Command handling arrangements, e.g. command buffers, queues, command scheduling
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a method, a device, electronic equipment and a medium for managing data. In the application, after the target storage area is acquired, the target storage area can be divided into a first number of storage groups based on a first preset rule, wherein each storage group at least has a storage capacity capable of storing one piece of data to be stored, each storage group is divided into a second number of storage subareas based on a second preset rule, and the first number of storage groups and the second number of storage subareas are utilized to store the data to be stored. By applying the technical scheme of the application, after the data to be stored is acquired, the data can be stored into the storage subareas in the corresponding storage groups in a targeted manner according to the corresponding queue identifications. Thereby avoiding the problem of unordered data storage in any cache area in the related art.

Description

管理数据的方法、装置、电子设备及介质Method, device, electronic device and medium for managing data

技术领域technical field

本申请中涉及数据存储技术,尤其是一种管理数据的方法、装置、电子设备及介质。This application relates to data storage technology, especially a method, device, electronic device and medium for managing data.

背景技术Background technique

由于通信时代和社会的兴起,智能设备已经随着越来越多用户的使用而不断发展。Due to the rise of the communication age and society, smart devices have been continuously developed with the use of more and more users.

其中,随着通信时代的飞速发展,大量的数据生成已经成为了一种常态。而在数据应用的过程中,常常也需要将数据进行对应的存储。例如对于网络技术的发展,网络数据的不断增多以及网络速率的不断提高,网络缓存的规模也越来越大。进一步的,对于缓存领域来说,共享缓存是通信领域中常见的资源配置策略。其具备多个队列共享存储空间,能够较大的提高缓存利用率,合理利用缓存资源。Among them, with the rapid development of the communication era, the generation of a large amount of data has become a norm. In the process of data application, it is often necessary to store the data correspondingly. For example, with the development of network technology, the continuous increase of network data and the continuous improvement of network speed, the scale of network cache is also increasing. Furthermore, for the cache field, shared cache is a common resource allocation strategy in the communication field. It has multiple queues to share storage space, which can greatly improve cache utilization and rationally utilize cache resources.

然而,相关技术中存在的共享缓存结构会占用较多的管理资源。因此如何实现一种可以合理将数据进行存储的方案,成为了本领域技术人员需要解决的问题。However, the shared cache structure existing in the related art will occupy more management resources. Therefore, how to implement a solution that can reasonably store data has become a problem to be solved by those skilled in the art.

发明内容Contents of the invention

本申请实施例提供一种管理数据的方法、装置、电子设备及介质,本申请实施例用于解决相关技术中存在的共享缓存结构会占用较多的管理资源的问题。Embodiments of the present application provide a data management method, device, electronic device, and medium. The embodiments of the present application are used to solve the problem in the related art that the shared cache structure occupies more management resources.

其中,根据本申请实施例的一个方面,提供的一种管理数据的方法,其特征在于,包括:Among them, according to an aspect of the embodiments of the present application, a method for managing data is provided, which is characterized in that it includes:

获取目标存储区域;Get the target storage area;

基于第一预设规则,将所述目标存储区域划分为第一数量的存储组,所述每个存储组至少具备可以存储一个待存储数据的存储容量,其中每个所述存储组的存储容量相对应;Based on a first preset rule, divide the target storage area into a first number of storage groups, each of which has at least a storage capacity capable of storing one data to be stored, wherein the storage capacity of each of the storage groups Corresponding;

基于第二预设规则,将每个所述存储组划分为第二数量的存储子区域,其中在同一存储组中每个所述存储子区域的存储容量相对应;Based on a second preset rule, dividing each of the storage groups into a second number of storage sub-regions, wherein the storage capacity of each of the storage sub-regions in the same storage group is corresponding;

利用所述第一数量的存储组以及所述第二数量的存储子区域,对待存储数据进行存储。The data to be stored is stored by using the first number of storage groups and the second number of storage sub-areas.

可选地,在基于本申请上述方法的另一个实施例中,在所述基于第二预设规则,将每个所述存储组划分为第二数量的存储子区域之后,还包括:Optionally, in another embodiment based on the above method of the present application, after dividing each of the storage groups into a second number of storage sub-areas based on the second preset rule, the method further includes:

获取第三数量的数据存储队列,所述第三数量小于等于所述第一数量;Acquiring a third number of data storage queues, the third number being less than or equal to the first number;

为每个所述数据存储队列分配对应的至少一个存储组,并分别为每个所述数据存储队列与对应的存储组建立映射关系;Allocating at least one corresponding storage group to each of the data storage queues, and establishing a mapping relationship between each of the data storage queues and the corresponding storage group;

将各个映射关系记录到映射数据库中。Record each mapping relationship into the mapping database.

可选地,在基于本申请上述方法的另一个实施例中,在所述基于第二预设规则,将每个所述存储组划分为第二数量的存储子区域之后,还包括:Optionally, in another embodiment based on the above method of the present application, after dividing each of the storage groups into a second number of storage sub-areas based on the second preset rule, the method further includes:

获取待存储数据的存储参数;Obtain the storage parameters of the data to be stored;

基于所述待存储数据中的存储队列标识,确定所述待存储数据对应的存储队列;Determining a storage queue corresponding to the data to be stored based on the storage queue identifier in the data to be stored;

基于所述映射数据库,确定与所述待存储数据对应的存储队列相映射的所述第一存储组;determining the first storage group mapped to the storage queue corresponding to the data to be stored based on the mapping database;

当检测到所述待存储数据的数据大小低于预设容量时,将所述待存储数据存储在所述第一存储组的第一存储子区域。When it is detected that the data size of the data to be stored is lower than a preset capacity, the data to be stored is stored in the first storage sub-area of the first storage group.

可选地,在基于本申请上述方法的另一个实施例中,在所述确定与所述待存储数据对应的存储队列相映射的所述第一存储组之后,包括:Optionally, in another embodiment based on the above method of the present application, after determining the first storage group mapped to the storage queue corresponding to the data to be stored, the method includes:

当检测到所述待存储数据的数据大小不低于所述预设容量时,获取所述待存储数据对应的优先级标签;When it is detected that the data size of the data to be stored is not lower than the preset capacity, acquiring a priority tag corresponding to the data to be stored;

当确定所述待存储数据对应的优先级标签满足预设的优先条件时,清除所述第一存储组中存储的预设优先级数据,并将所述待存储数据存储在所述第一存储组中;When it is determined that the priority tag corresponding to the data to be stored satisfies a preset priority condition, clear the preset priority data stored in the first storage group, and store the data to be stored in the first storage group group;

当确定所述待存储数据对应的优先级标签不满足所述预设的优先条件时,清除所述待存储数据。When it is determined that the priority label corresponding to the data to be stored does not satisfy the preset priority condition, the data to be stored is cleared.

可选地,在基于本申请上述方法的另一个实施例中,在所述将所述待存储数据存储在所述第一存储组的第一存储子区域之后,包括:Optionally, in another embodiment based on the above method of the present application, after storing the data to be stored in the first storage sub-area of the first storage group, the method includes:

更新所述第一数据存储队列的地址偏移信息以及队长信息,所述地址偏移信息包括队首信息以及队尾信息,所述地址偏移信息用于表征所述第一存储队列中当前已存储数据的位置,所述队长信息用于表征所述第一数据存储队列的存储容量。Updating the address offset information and team leader information of the first data storage queue, the address offset information includes queue head information and queue tail information, and the address offset information is used to represent the currently existing data in the first storage queue The location where the data is stored, and the captain information is used to characterize the storage capacity of the first data storage queue.

可选地,在基于本申请上述方法的另一个实施例中,在所述将所述待存储数据存储在所述第一存储组的第一存储子区域之后,包括:Optionally, in another embodiment based on the above method of the present application, after storing the data to be stored in the first storage sub-area of the first storage group, the method includes:

检测所述第一存储组的剩余存储空间;detecting the remaining storage space of the first storage group;

当检测到所述第一存储组的剩余存储空间小于目标容量时,获取处于空闲状态的第二存储组;When it is detected that the remaining storage space of the first storage group is less than the target capacity, acquiring a second storage group in an idle state;

将所述第二存储组与所述第一数据存储队列建立映射关系。Establish a mapping relationship between the second storage group and the first data storage queue.

可选地,在基于本申请上述方法的另一个实施例中,每个所述存储组的存储容量相对应,包括:Optionally, in another embodiment based on the above method of the present application, the storage capacity of each storage group is corresponding, including:

每个所述存储组的存储容量均相同;each of said storage groups has the same storage capacity;

以及,同一存储组中每个所述存储子区域的存储容量相对应,包括:And, the storage capacity of each storage sub-area in the same storage group is corresponding, including:

同一所述存储组中,每个所述存储子区域的存储容量均相同。In the same storage group, the storage capacity of each storage sub-area is the same.

根据本申请实施例的另一个方面,提供的一种管理数据的装置,包括:According to another aspect of the embodiments of the present application, a device for managing data is provided, including:

获取模块,被设置为获取目标存储区域;an acquisition module configured to acquire a target storage area;

第一划分模块,被设置为基于第一预设规则,将所述目标存储区域划分为第一数量的存储组,所述每个存储组至少具备可以存储一个待存储数据的存储容量,其中每个所述存储组的存储容量相对应;The first dividing module is configured to divide the target storage area into a first number of storage groups based on a first preset rule, and each storage group has at least a storage capacity capable of storing one data to be stored, wherein each Corresponding to the storage capacity of each of the storage groups;

第二划分模块,被设置为基于第二预设规则,将每个所述存储组划分为第二数量的存储子区域,其中在同一存储组中每个所述存储子区域的存储容量相对应;The second dividing module is configured to divide each of the storage groups into a second number of storage sub-regions based on a second preset rule, wherein the storage capacity of each of the storage sub-regions in the same storage group corresponds to ;

存储模块,被设置为利用所述第一数量的存储组以及所述第二数量的存储子区域,对待存储数据进行存储。The storage module is configured to use the first number of storage groups and the second number of storage sub-areas to store data to be stored.

根据本申请实施例的又一个方面,提供的一种电子设备,包括:According to still another aspect of the embodiments of the present application, an electronic device is provided, including:

存储器,用于存储可执行指令;以及memory for storing executable instructions; and

显示器,用于与所述存储器显示以执行所述可执行指令从而完成上述任一所述管理数据的方法的操作。A display, configured to display with the memory to execute the executable instructions to complete the operation of any one of the methods for managing data above.

根据本申请实施例的还一个方面,提供的一种计算机可读存储介质,用于存储计算机可读取的指令,所述指令被执行时执行上述任一所述管理数据的方法的操作。According to still another aspect of the embodiments of the present application, there is provided a computer-readable storage medium for storing computer-readable instructions, and when the instructions are executed, operations of any one of the methods for managing data described above are performed.

本申请中,在获取目标存储区域之后,可以基于第一预设规则,将目标存储区域划分为第一数量的存储组,其中每个存储组至少具备可以存储一个待存储数据的存储容量,并基于第二预设规则,将每个存储组划分为第二数量的存储子区域,再利用第一数量的存储组以及第二数量的存储子区域,对待存储数据进行存储。通过应用本申请的技术方案,可以在获取到待存储数据之后,根据其对应的队列标识,针对性的将其存储到对应的存储组中的存储子区域中。进而避免相关技术中存在的将数据无序存储在任一缓存区域的问题。In this application, after the target storage area is acquired, the target storage area may be divided into a first number of storage groups based on a first preset rule, wherein each storage group has at least a storage capacity capable of storing one data to be stored, and Based on the second preset rule, each storage group is divided into a second number of storage sub-areas, and then the first number of storage groups and the second number of storage sub-areas are used to store the data to be stored. By applying the technical solution of the present application, after the data to be stored is acquired, it can be stored in the storage sub-area of the corresponding storage group according to its corresponding queue identifier. Thus, the problem of disorderly storing data in any cache area existing in the related art is avoided.

下面通过附图和实施例,对本申请的技术方案做进一步的详细描述。The technical solutions of the present application will be described in further detail below with reference to the drawings and embodiments.

附图说明Description of drawings

构成说明书的一部分的附图描述了本申请的实施例,并且连同描述一起用于解释本申请的原理。The accompanying drawings, which constitute a part of this specification, illustrate the embodiments of the application and, together with the description, serve to explain the principles of the application.

参照附图,根据下面的详细描述,可以更加清楚地理解本申请,其中:The present application can be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:

图1为本申请提出的一种管理数据的方法示意图;FIG. 1 is a schematic diagram of a method for managing data proposed in this application;

图2为本申请提出的存储数据的流程示意图;Fig. 2 is a schematic flow chart of the stored data proposed by the present application;

图3为本申请提出的又一种存储数据的流程示意图;FIG. 3 is a schematic flow diagram of another storage data proposed by the present application;

图4为本申请提出的一种管理数据的方法示意图;FIG. 4 is a schematic diagram of a method for managing data proposed by the present application;

图5为本申请提出的一种管理数据的缓存分配流程示意图;FIG. 5 is a schematic diagram of a buffer allocation process for management data proposed by the present application;

图6为本申请管理数据的装置的结构示意图;FIG. 6 is a schematic structural diagram of a device for managing data in the present application;

图7为本申请管理数据的显示电子设备结构示意图。FIG. 7 is a schematic structural diagram of an electronic device for displaying management data in the present application.

具体实施方式Detailed ways

现在将参照附图来详细描述本申请的各种示例性实施例。应注意到:除非另外具体说明,否则在这些实施例中阐述的部件和步骤的相对布置、数字表达式和数值不限制本申请的范围。Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangements of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present application unless specifically stated otherwise.

同时,应当明白,为了便于描述,附图中所示出的各个部分的尺寸并不是按照实际的比例关系绘制的。At the same time, it should be understood that, for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

以下对至少一个示例性实施例的描述实际上仅仅是说明性的,不作为对本申请及其应用或使用的任何限制。The following description of at least one exemplary embodiment is merely illustrative in nature and not intended as any limitation of the application, its application or uses.

对于相关领域普通技术人员已知的技术、方法和设备可能不作详细讨论,但在适当情况下,所述技术、方法和设备应当被视为说明书的一部分。Techniques, methods and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, such techniques, methods and devices should be considered part of the description.

应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步讨论。It should be noted that like numerals and letters denote like items in the following figures, therefore, once an item is defined in one figure, it does not require further discussion in subsequent figures.

另外,本申请各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。In addition, the technical solutions of the various embodiments of the present application can be combined with each other, but it must be based on the realization of those skilled in the art. When the combination of technical solutions is contradictory or cannot be realized, it should be considered as a combination of technical solutions. Does not exist, nor is it within the scope of protection required by this application.

需要说明的是,本申请实施例中所有方向性指示(诸如上、下、左、右、前、后……)仅用于解释在某一特定姿态(如附图所示)下各部件之间的相对位置关系、运动情况等,如果该特定姿态发生改变时,则该方向性指示也相应地随之改变。It should be noted that all directional indications (such as up, down, left, right, front, back...) in the embodiments of the present application are only used to explain If the specific posture changes, the directional indication will also change accordingly.

下面结合图1-图5来描述根据本申请示例性实施方式的用于进行管理数据的方法。需要注意的是,下述应用场景仅是为了便于理解本申请的精神和原理而示出,本申请的实施方式在此方面不受任何限制。相反,本申请的实施方式可以应用于适用的任何场景。A method for managing data according to an exemplary embodiment of the present application is described below with reference to FIGS. 1-5 . It should be noted that the following application scenarios are only shown for easy understanding of the spirit and principle of the present application, and the implementation manners of the present application are not limited in this respect. On the contrary, the embodiments of the present application can be applied to any applicable scene.

本申请还提出一种管理数据的方法、装置、目标终端及介质。The present application also proposes a data management method, device, target terminal and medium.

图1示意性地示出了根据本申请实施方式的一种管理数据的方法的流程示意图。如图1所示,该方法包括:Fig. 1 schematically shows a schematic flowchart of a method for managing data according to an embodiment of the present application. As shown in Figure 1, the method includes:

S101,获取目标存储区域。S101. Obtain a target storage area.

S102,基于第一预设规则,将目标存储区域划分为第一数量的存储组,每个存储组至少具备可以存储一个待存储数据的存储容量,其中每个存储组的存储容量相对应。S102. Based on a first preset rule, divide the target storage area into a first number of storage groups, each storage group has at least a storage capacity capable of storing one data to be stored, wherein each storage group has a corresponding storage capacity.

首先需要说明的是,本申请中不对获取目标存储区域的设备做具体限定,例如可以为智能设备,也可以为服务器等等。First of all, it should be noted that the device for obtaining the target storage area is not specifically limited in this application, for example, it may be a smart device or a server.

同样的,本申请中存储数据的方案可以应用到缓存领域中。其中,缓存是指可以进行高速数据交换的存储器,它先于内存与CPU交换数据,因此速率很快。L1Cache(一级缓存)是CPU第一层高速缓存。内置的L1高速缓存的容量和结构对CPU的性能影响较大,不过高速缓冲存储器均由静态RAM组成,结构较复杂,在CPU管芯面积不能太大的情况下,L1级高速缓存的容量不可能做得太大。一般L1缓存的容量通常在32—256KB。L2Cache(二级缓存)是CPU的第二层高速缓存,分内部和外部两种芯片。内部的芯片二级缓存运行速率与主频相同,而外部的二级缓存则只有主频的一半。Similarly, the solution for storing data in this application can be applied to the cache field. Among them, the cache refers to the memory that can perform high-speed data exchange. It exchanges data with the CPU before the memory, so the speed is very fast. L1Cache (Level 1 cache) is the first layer of CPU cache. The capacity and structure of the built-in L1 cache have a great influence on the performance of the CPU. However, the cache memory is composed of static RAM, and the structure is relatively complicated. When the CPU die area cannot be too large, the capacity of the L1 cache is not large. Might be too big. The capacity of the general L1 cache is usually 32-256KB. L2Cache (second-level cache) is the second-level cache of the CPU, which is divided into internal and external chips. The internal on-chip L2 cache runs at the same speed as the main frequency, while the external L2 cache runs at half the main frequency.

进一步的,缓存的工作原理是当CPU要读取一个数据时,首先从CPU缓存中查找,找到就立即读取并送给CPU处理;没有找到,就从速率相对较慢的内存中读取并送给CPU处理,同时把这个数据所在的数据块调入缓存中,可以使得以后对整块数据的读取都从缓存中进行,不必再调用内存。正是这样的读取机制使CPU读取缓存的命中率非常高,也就是说CPU下一次要读取的数据大部分都在CPU缓存中。这也极大节省了CPU直接读取内存的时间,也使CPU读取数据时基本无需等待。Furthermore, the working principle of the cache is that when the CPU wants to read a piece of data, it first searches it from the CPU cache, and if it finds it, it reads it immediately and sends it to the CPU for processing; if it does not find it, it reads it from the relatively slow memory and sends it to the CPU Send it to the CPU for processing, and at the same time transfer the data block where the data is located into the cache, so that the entire block of data can be read from the cache in the future without calling the memory. It is this reading mechanism that makes the hit rate of the CPU read cache very high, which means that most of the data that the CPU will read next time is in the CPU cache. This also greatly saves the time for the CPU to directly read the memory, and basically does not need to wait for the CPU to read data.

S103,基于第二预设规则,将每个存储组划分为第二数量的存储子区域,其中在同一存储组中每个存储子区域的存储容量相对应。S103. Based on a second preset rule, divide each storage group into a second number of storage sub-areas, where the storage capacity of each storage sub-area in the same storage group is corresponding.

S104,利用第一数量的存储组以及第二数量的存储子区域,对待存储数据进行存储。S104. Use the first number of storage groups and the second number of storage sub-areas to store the data to be stored.

进一步的,为了避免相关技术中存在的对缓存区域无序管理的问题,本申请可以首先将目标存储区域基于第一预设规则划分为第一数量的存储组。其中需要说明的是,每个存储组至少具备可以存储一个待存储数据的存储容量,以及每个存储组的存储容量相同。Further, in order to avoid the problem of out-of-order management of the cache area in the related art, the present application may first divide the target storage area into a first number of storage groups based on a first preset rule. It should be noted that each storage group has at least a storage capacity capable of storing one piece of data to be stored, and each storage group has the same storage capacity.

同样的,为了避免相关技术中存在的对缓存区域无序管理的问题,本申请还可以进一步将每个存储组基于第二预设规则划分为第二数量的存储子区域。其中需要说明的是,同一存储组中每个存储子区域的存储容量相同。Likewise, in order to avoid the problem of out-of-order management of cache areas in the related art, the present application may further divide each storage group into a second number of storage sub-areas based on a second preset rule. It should be noted that the storage capacity of each storage sub-area in the same storage group is the same.

另外,本申请不对第一数量以及第二数量做具体限定,例如可以为3,也可以为5。再者,第一数量与第二数量可以相同,第一数量与第二数量也可以不相同。In addition, the present application does not specifically limit the first number and the second number, for example, they may be 3 or 5. Furthermore, the first quantity and the second quantity may be the same, or the first quantity and the second quantity may be different.

本申请中,在获取目标存储区域之后,可以基于第一预设规则,将目标存储区域划分为第一数量的存储组,其中每个存储组至少具备可以存储一个待存储数据的存储容量,并基于第二预设规则,将每个存储组划分为第二数量的存储子区域,再利用第一数量的存储组以及第二数量的存储子区域,对待存储数据进行存储。通过应用本申请的技术方案,可以在获取到待存储数据之后,根据其对应的队列标识,针对性的将其存储到对应的存储组中的存储子区域中。进而避免相关技术中存在的将数据无序存储在任一缓存区域的问题。In this application, after the target storage area is acquired, the target storage area may be divided into a first number of storage groups based on a first preset rule, wherein each storage group has at least a storage capacity capable of storing one data to be stored, and Based on the second preset rule, each storage group is divided into a second number of storage sub-areas, and then the first number of storage groups and the second number of storage sub-areas are used to store the data to be stored. By applying the technical solution of the present application, after the data to be stored is acquired, it can be stored in the storage sub-area of the corresponding storage group according to its corresponding queue identifier. Thus, the problem of disorderly storing data in any cache area existing in the related art is avoided.

可选的,在本申请一种可能的实施方式中,在S103(基于第二预设规则,将每个存储组划分为第二数量的存储子区域)之后,还可以实施下述步骤:Optionally, in a possible implementation manner of the present application, after S103 (dividing each storage group into a second number of storage sub-areas based on the second preset rule), the following steps may also be implemented:

获取第三数量的数据存储队列;Obtain a third number of data storage queues;

为每个数据存储队列分配对应的至少一个存储组,并分别为每个数据存储队列与对应的存储组建立映射关系;Allocating at least one corresponding storage group for each data storage queue, and establishing a mapping relationship between each data storage queue and the corresponding storage group;

将各个映射关系记录到映射数据库中。Record each mapping relationship into the mapping database.

进一步的,本申请在得到多个存储组以及多个存储子区域之后,还可以为每个数据存储队列分配一个或多个的存储组并分别为每个数据存储队列与对应的存储组建立映射关系。可以理解的,该数据存储队列对应的存储组即为用于存储该存储队列的存储数据。Furthermore, after the application obtains multiple storage groups and multiple storage sub-areas, it can also assign one or more storage groups to each data storage queue and establish a mapping for each data storage queue and the corresponding storage group relation. It can be understood that the storage group corresponding to the data storage queue is used to store the storage data of the storage queue.

需要说明的是,本申请的第三数量应该小于等于第一数量。例如当数据存储队列的数量为3个时,目标存储区域包含的存储组应该为3个及3个以上。以保证每个数据存储队列均会分配有不同的存储组。It should be noted that the third quantity in this application should be less than or equal to the first quantity. For example, when the number of data storage queues is 3, the target storage area should contain 3 or more storage groups. To ensure that each data storage queue is assigned a different storage group.

例如以缓存领域而言,以如下步骤解释为每个所述数据存储队列分配对应的至少一个存储组:For example, in the field of caching, the following steps explain the allocation of at least one corresponding storage group for each of the data storage queues:

步骤1:把整个缓存均分成N组,其中每组缓存大小相等,每组缓存大小应大于至少一个待缓存数据。Step 1: Divide the entire cache into N groups, where the size of each group of caches is equal, and the size of each group of caches should be larger than at least one data to be cached.

步骤2:所述步骤1中每组缓存继续分割,分成大小相等的G个存储子区域,即所述步骤1中的一组缓存为G个存储子区域组成的一个存储组。Step 2: Each group of buffers in step 1 is further divided into G storage sub-regions of equal size, that is, a group of buffers in step 1 is a storage group composed of G storage sub-regions.

步骤3:在所述步骤1中存储组个数N的大小关系到缓存管理资源的大小。Step 3: In the step 1, the size of the storage group number N is related to the size of the cache management resource.

步骤4:为每个入队数据报文分配缓存组。为便于管理,一个存储组中的缓存连续分配;分配到一组中的最后一个缓存子区域时,申请下一组缓存子区域,再分配给对应的数据列队。Step 4: Allocate a cache group for each enqueued data packet. For ease of management, caches in a storage group are allocated continuously; when allocated to the last cache sub-area in a group, apply for the next set of cache sub-areas, and then allocate to the corresponding data queue.

步骤5:同一组缓存子区域的缓存只会分配给一个数据队列。Step 5: The caches of the same group of cache sub-areas will only be allocated to one data queue.

可选的,本申请在基于第二预设规则,将每个存储组划分为第二数量的存储子区域之后,还可以实施下述步骤:Optionally, after the present application divides each storage group into a second number of storage sub-areas based on the second preset rule, the following steps may also be implemented:

获取待存储数据的存储参数;Obtain the storage parameters of the data to be stored;

基于待存储数据中的存储队列标识,确定待存储数据对应的存储队列;Based on the storage queue identifier in the data to be stored, determine the storage queue corresponding to the data to be stored;

基于映射数据库,确定与待存储数据对应的存储队列相映射的第一存储组;Based on the mapping database, determine the first storage group mapped to the storage queue corresponding to the data to be stored;

当检测到待存储数据的数据大小低于预设容量时,将待存储数据存储在第一存储组的第一存储子区域。When it is detected that the data size of the data to be stored is lower than the preset capacity, the data to be stored is stored in the first storage sub-area of the first storage group.

进一步的,本申请中在获取到待存储数据之后,可以根据其携带的存储队列标识,确定待存储数据对应的存储队列。并根据映射数据库存储的每个存储队列相映射的存储组,确定该待存储数据存放的第一存储组。并将待存储数据存储在第一存储组的第一存储子区域。Further, in this application, after the data to be stored is acquired, the storage queue corresponding to the data to be stored may be determined according to the storage queue identifier carried by it. And according to the storage group mapped to each storage queue stored in the mapping database, determine the first storage group where the data to be stored is stored. And store the data to be stored in the first storage sub-area of the first storage group.

获取待存储数据的存储参数,存储参数包括数据大小参数以及存储队列标识。Obtain the storage parameters of the data to be stored, the storage parameters include data size parameters and storage queue identifiers.

本申请中,在获取到待存储在缓存区域的数据时,可以获取其对应的存储参数,其中存储参数包括数据大小参数以及存储队列标识。可以理解的,本申请可以根据该待存储数据的存储队列标识,将其存放在对应的数据队列中。In this application, when the data to be stored in the cache area is obtained, its corresponding storage parameters may be obtained, where the storage parameters include data size parameters and storage queue identifiers. It can be understood that the present application may store the data to be stored in the corresponding data queue according to the storage queue identifier of the data to be stored.

进一步的,本申请中可以根据待存储数据的存储参数,确定该待存储数据对应的第一数据存储队列所在的第一存储组,并将待存储数据存储在第一存储组的第一存储子区域中。Further, in this application, according to the storage parameters of the data to be stored, the first storage group in which the first data storage queue corresponding to the data to be stored is located is determined, and the data to be stored is stored in the first storage sub-group of the first storage group. in the area.

其中,本申请不对预设容量做具体限定,也即预设容量可以为任意数值的存储容量。Wherein, the present application does not specifically limit the preset capacity, that is, the preset capacity may be a storage capacity of any value.

如图2所示,为本申请提出的一种数据存储的流程示意图,由图2可以看出,可以首先获取对应的待存储数据,并利用该待存储数据对应的队列标识,确定其要发送的数据队列。并在确定该数据队列剩余的存储容量大于待存储数据的数据大小时,即可将待存储数据存储在第一存储组的第一存储子区域。需要说明的是,本申请中的第一存储子区域可以为第一存储组中的任意一块存储子区域。As shown in Figure 2, it is a schematic flow diagram of a data storage proposed by the present application. It can be seen from Figure 2 that the corresponding data to be stored can be obtained first, and the queue identifier corresponding to the data to be stored can be used to determine the data to be sent. data queue. And when it is determined that the remaining storage capacity of the data queue is greater than the data size of the data to be stored, the data to be stored can be stored in the first storage sub-area of the first storage group. It should be noted that the first storage sub-area in this application may be any storage sub-area in the first storage group.

进一步可选的,本申请在确定与待存储数据对应的存储队列相映射的第一存储组之后,还可以实施下述步骤:Further optionally, after the application determines the first storage group mapped to the storage queue corresponding to the data to be stored, the following steps may also be implemented:

当检测到待存储数据的数据大小不低于预设容量时,获取待存储数据对应的优先级标签;When it is detected that the data size of the data to be stored is not lower than the preset capacity, the priority label corresponding to the data to be stored is obtained;

当确定待存储数据对应的优先级标签满足预设的优先条件时,清除第一存储组的预设优先级的已存储数据,并将待存储数据存储在第一存储组中;When it is determined that the priority label corresponding to the data to be stored satisfies the preset priority condition, clearing the stored data of the preset priority of the first storage group, and storing the data to be stored in the first storage group;

当确定待存储数据对应的优先级标签不满足预设的优先条件时,清除待存储数据。When it is determined that the priority tag corresponding to the data to be stored does not satisfy the preset priority condition, the data to be stored is cleared.

如图3所示,为本申请提出的一种数据存储的流程示意图。由图3可以看出,可以首先获取对应的待存储数据,并利用该待存储数据对应的队列标识,确定其要发送的数据队列。并在确定该数据队列剩余的存储容量大于待存储数据的数据大小时,即可将待存储数据存储在第一存储组的第一存储子区域。As shown in FIG. 3 , it is a schematic flow chart of a data storage proposed in this application. It can be seen from FIG. 3 that the corresponding data to be stored may be obtained first, and the queue identifier corresponding to the data to be stored may be used to determine the data queue to be sent. And when it is determined that the remaining storage capacity of the data queue is greater than the data size of the data to be stored, the data to be stored can be stored in the first storage sub-area of the first storage group.

需要说明的是,当检测到待存储数据的数据大小不低于预设容量时,则代表当前数据队列的剩余存储空间已不具备存储待存储数据的空间。其中,本申请需要检测待存储数据对应的优先级标签,当其满足预设的优先条件时,则优先将该待存储数据进行存储。例如可以包括清除第一存储组的较低优先级的已存储数据之后,再将待存储数据存储在第一存储组中。进一步的,当检测待存储数据对应的优先级标签不满足预设的优先条件时,则判断该数据重要性不高,即可以将其直接进行清除。It should be noted that when it is detected that the data size of the data to be stored is not lower than the preset capacity, it means that the remaining storage space of the current data queue has no space for storing the data to be stored. Wherein, the present application needs to detect the priority tag corresponding to the data to be stored, and when it meets the preset priority condition, the data to be stored is stored preferentially. For example, it may include clearing the stored data of lower priority in the first storage group, and then storing the data to be stored in the first storage group. Further, when it is detected that the priority tag corresponding to the data to be stored does not meet the preset priority condition, it is judged that the data is not of high importance, that is, it can be cleared directly.

进一步可选的,本申请在S103(将待存储数据存储在第一存储组的第一存储子区域)之后,还可以包含一种具体的实施方式,如图4所示,包括:Further optionally, after S103 (storing the data to be stored in the first storage sub-area of the first storage group), the present application may also include a specific implementation manner, as shown in FIG. 4 , including:

S201,基于待存储数据中的存储队列标识,确定待存储数据对应的存储队列。S201. Based on the storage queue identifier in the data to be stored, determine a storage queue corresponding to the data to be stored.

S202,基于映射数据库,确定与待存储数据对应的存储队列相映射的第一存储组。S202. Based on the mapping database, determine a first storage group mapped to the storage queue corresponding to the data to be stored.

S203,当检测到待存储数据的数据大小低于预设容量时,将待存储数据存储在第一存储组的第一存储子区域。S203. When it is detected that the data size of the data to be stored is lower than the preset capacity, store the data to be stored in the first storage sub-area of the first storage group.

可选的,在将待存储数据存储在第一存储组的第一存储子区域之后,还可以实施下述步骤:Optionally, after the data to be stored is stored in the first storage sub-area of the first storage group, the following steps may also be implemented:

更新第一数据存储队列的地址偏移信息以及队长信息,地址偏移信息包括队首信息以及队尾信息,地址偏移信息用于表征第一存储队列中当前已存储数据的位置,队长信息用于表征第一数据存储队列的存储容量。Update the address offset information and team leader information of the first data storage queue. The address offset information includes team head information and team tail information. The address offset information is used to represent the position of the currently stored data in the first storage queue, and the team leader information uses is used to represent the storage capacity of the first data storage queue.

进一步的,为了合理利用缓存,防止某个队列数据突发严重影响其他队列的情况,应为每个队列可以分配的存储组设置阈值,限制每个队列的缓存长度。例如可以记录每个队列中包括存储组地址和存储子区域偏移地址的队首地址,以及包括存储组地址和存储子区域偏移地址的队尾地址。并记录每个队列的占用存储子区域的队长信息,即每个队列的存储容量。Furthermore, in order to make reasonable use of the cache and prevent a queue's data burst from seriously affecting other queues, a threshold should be set for the storage group that can be allocated to each queue to limit the cache length of each queue. For example, the head address of each queue including the address of the storage group and the offset address of the storage sub-area, and the address of the tail of the queue including the address of the storage group and the offset address of the storage sub-area may be recorded. And record the captain information of the occupied storage sub-area of each queue, that is, the storage capacity of each queue.

一种可能的实施方式中,本申请可以将每个数据队里的队首信息、队尾信息以及队长信息分别存放在三个RAM中,RAM地址为队列编号,RAM数据为队首、队尾、队长信息。In a possible implementation, this application can store the team leader information, team tail information and captain information in each data team in three RAMs respectively, the RAM address is the queue number, and the RAM data is the team leader and team tail information. , captain information.

由图5可以看出,为根据更新第一数据存储队列的地址偏移信息以及队长信息来进行缓存分配的流程图,其中一个存储组中的存储子区域为两个,地址分别为G1、G2,并在分配过程中每个存储组的地址连续分配,则需记录正在用的存储组的偏移地址0~G-1;G1(0)、G2(0)代表存储组没有被分配过,下次从G1(0)开始分配;G1(i)、G2(0),i∈[1:G-1]代表从G1(i)开始分配;G1(0)、G2(j),j∈[1:G-1]代表从G2(j)开始分配;G1(G)或G2(G)代表该缓存组已经分配完,从另一个缓存组开始分配,且等待新的缓存组被二级缓存模块分配进来;S323.所说步骤S31中,剩余缓存子区域个数可由,i、j计算出来,公式为2G-i-j。当缓存分配完毕时需要修改G1、G2、i、j等。It can be seen from Fig. 5 that it is a flow chart of cache allocation based on updating the address offset information and captain information of the first data storage queue, wherein there are two storage sub-areas in one storage group, and the addresses are G1 and G2 respectively , and the address of each storage group is assigned continuously during the allocation process, it is necessary to record the offset address 0~G-1 of the storage group in use; G1(0), G2(0) represent that the storage group has not been allocated, Allocation starts from G1(0) next time; G1(i), G2(0), i∈[1:G-1] means allocation starts from G1(i); G1(0), G2(j), j∈ [1:G-1] means to start allocation from G2(j); G1(G) or G2(G) means that the cache group has been allocated, start allocation from another cache group, and wait for the new cache group to be secondary The cache module is allocated; S323. In the step S31, the number of remaining cache sub-areas can be calculated by i, j, and the formula is 2G-i-j. When the cache is allocated, G1, G2, i, j, etc. need to be modified.

进一步的,数据入队后,可以由缓存控制模块将数据帧按照分配的缓存子区域地址,按缓存子区域顺序依次写入相应缓存中并实施下述步骤:Further, after the data is enqueued, the cache control module can write the data frame into the corresponding cache sequentially according to the address of the allocated cache sub-area and in the order of the cache sub-area and implement the following steps:

其中,更新第一数据存储队列的地址偏移信息以及队长信息中,详细可包括:Wherein, updating the address offset information and captain information of the first data storage queue may include in detail:

获取队长信息,此时获取到的队长信息为入队前帧长;如果数据入队前队长为零,则将数据首地址Ph写入缓存队列管理模块的队头信息中,包括缓存子区域组地址及缓存子区域偏移地址;更新队尾信息,将所述步骤S32中数据帧的尾地址Pt写入缓存队列管理模块的队尾信息中,包括缓存子区域地址及缓存子区域偏移地址;更新队长信息,将队长加上新入队帧长得到入队后的队长重新写入队长信息中。Obtain the captain information, the captain information obtained at this time is the frame length before entering the queue; if the captain is zero before the data enters the queue, write the data head address Ph into the queue header information of the cache queue management module, including the cache sub-area group Address and cache sub-area offset address; update team tail information, write the tail address Pt of the data frame in the step S32 in the team tail information of the cache queue management module, including cache sub-area address and cache sub-area offset address ;Update the captain information, add the captain plus the newly joined frame length to get the captain after entering the team and rewrite it into the captain information.

S204,检测第一存储组的剩余存储空间。S204. Detect remaining storage space of the first storage group.

S205,当检测到第一存储组的剩余存储空间小于目标容量时,获取处于空闲状态的第二存储组。S205. When it is detected that the remaining storage space of the first storage group is less than the target capacity, acquire a second storage group in an idle state.

S206,将第二存储组与第一数据存储队列建立映射关系。S206. Establish a mapping relationship between the second storage group and the first data storage queue.

进一步的,本申请还包括将已存储在数据队列中的存储数据进行调出的情况:Further, this application also includes the case of calling out the stored data already stored in the data queue:

接收数据出队申请,由出队调度发起出队申请,包括出队队列,出队缓存子区域个数N’等信息;Receive the data dequeue application, and the dequeue dispatcher initiates the dequeue application, including the dequeue queue, the number of dequeue cache sub-areas N' and other information;

出队队列查询,包括:查询所在队列队长信息,如果队列缓存子区域长度L为零,则不出队;如果L>=N’,则出N’个缓存子区域;如果L<N’,则出L个数据;Dequeue queue query, including: query the queue leader information, if the length L of the queue cache sub-area is zero, then no queue; if L>=N', then N' cache sub-areas; if L<N', Then output L data;

查询所在队列队首信息,得到出队队列队首缓存子区域组地址Sh及缓存子区域偏移地址i;Query the information of the head of the queue where it is located, and obtain the address Sh of the cache sub-area group of the head of the dequeue queue and the offset address i of the cache sub-area;

出队指令产生时,按照需要出队个数,产生出队指令,每个出队指令对应一个需要出队的缓存子区域,包含缓存子区域组地址,缓存子区域所在组偏移地址;从队首缓存子区域所在组偏移地址由队首的地址开始,依次产生出队指令,给出出队地址Sh(i)、Sh(i+1)直到出队个数完成或Sh(G-1)地址为止,G为缓存子区域组中包含的缓存子区域个数;如果队首缓存子区域组出队个数不足,则需要从下一个缓存子区域组出队,从缓存链表信息中获取到下一个缓存子区域组地址,继续按顺序产生出队指令。When the dequeue command is generated, the dequeue command is generated according to the number of dequeues required. Each dequeue command corresponds to a cache sub-area that needs to be de-queue, including the address of the cache sub-area group, and the offset address of the group where the cache sub-area is located; from The offset address of the group where the team head cache sub-area is located starts from the address of the team head, and sequentially generates dequeue commands, and gives the dequeue addresses Sh(i), Sh(i+1) until the number of dequeues is completed or Sh(G- 1) Up to the address, G is the number of cache sub-areas contained in the cache sub-area group; if the number of cache sub-area group dequeues at the head of the team is insufficient, it is necessary to dequeue from the next cache sub-area group, from the cache link list information After obtaining the address of the next cache sub-region group, continue to generate dequeuing instructions in sequence.

在进一步的,出队指令产生完毕后,记录最后一个出队的下一跳缓存子区域地址St(j);并按照产生的出队指令中的缓存子区域组地址及缓存子区域偏移地址依次从缓存中读出数据帧;其中,当队列信息更新时,可以更新队首信息,将中缓存子区域地址St(j)写入队尾信息RAM中;更新队长信息,将队长L减去出队缓存子区域个数,重新写入队长信息RAM中;如果出队时一个缓存子区域组最后一个缓存子区域Sh(G-1)出队成功,则需将缓存子区域组Sh释放,更新二级缓存管理中的链表信息及空闲缓存信息;更新缓存链表信息,将缓存链表中Sh地址对应的下一跳地址清空,设为无效;更新空闲缓存FIFO,将地址Sh重新写入空闲缓存FIFO中。Further, after the dequeue instruction is generated, record the last dequeue next-hop cache sub-area address St(j); and according to the cache sub-area group address and cache sub-area offset address in the dequeue command generated Read data frames from the cache in turn; wherein, when the queue information is updated, the team head information can be updated, and the middle cache sub-area address St(j) is written in the team tail information RAM; the team leader information is updated, and the team leader L is subtracted from The number of cache sub-areas to be dequeued is rewritten in the captain information RAM; if the last cache sub-area Sh (G-1) of a cache sub-area group is dequeued successfully when dequeuing, the cache sub-area group Sh needs to be released. Update the linked list information and idle cache information in the secondary cache management; update the cache linked list information, clear the next hop address corresponding to the Sh address in the cache linked list, and set it to invalid; update the idle cache FIFO, and rewrite the address Sh into the idle cache in the FIFO.

本申请中,在获取目标存储区域之后,可以基于第一预设规则,将目标存储区域划分为第一数量的存储组,其中每个存储组至少具备可以存储一个待存储数据的存储容量,并基于第二预设规则,将每个存储组划分为第二数量的存储子区域,再利用第一数量的存储组以及第二数量的存储子区域,对待存储数据进行存储。通过应用本申请的技术方案,可以在获取到待存储数据之后,根据其对应的队列标识,针对性的将其存储到对应的存储组中的存储子区域中。进而避免相关技术中存在的将数据无序存储在任一缓存区域的问题。In this application, after the target storage area is acquired, the target storage area may be divided into a first number of storage groups based on a first preset rule, wherein each storage group has at least a storage capacity capable of storing one data to be stored, and Based on the second preset rule, each storage group is divided into a second number of storage sub-areas, and then the first number of storage groups and the second number of storage sub-areas are used to store the data to be stored. By applying the technical solution of the present application, after the data to be stored is acquired, it can be stored in the storage sub-area of the corresponding storage group according to its corresponding queue identifier. Thus, the problem of disorderly storing data in any cache area existing in the related art is avoided.

在本申请的另外一种实施方式中,如图6所示,本申请还提供一种管理数据的装置。其中,该装置包括获取模块301,确定模块301,存储模块303,其中,In another implementation manner of the present application, as shown in FIG. 6 , the present application further provides a device for managing data. Wherein, the device includes an acquisition module 301, a determination module 301, and a storage module 303, wherein,

获取模块,被设置为获取目标存储区域;an acquisition module configured to acquire a target storage area;

第一划分模块,被设置为基于第一预设规则,将所述目标存储区域划分为第一数量的存储组,所述每个存储组至少具备可以存储一个待存储数据的存储容量,其中每个所述存储组的存储容量相对应;The first dividing module is configured to divide the target storage area into a first number of storage groups based on a first preset rule, and each storage group has at least a storage capacity capable of storing one data to be stored, wherein each Corresponding to the storage capacity of each of the storage groups;

第二划分模块,被设置为基于第二预设规则,将每个所述存储组划分为第二数量的存储子区域,其中在同一存储组中每个所述存储子区域的存储容量相对应;The second dividing module is configured to divide each of the storage groups into a second number of storage sub-regions based on a second preset rule, wherein the storage capacity of each of the storage sub-regions in the same storage group corresponds to ;

存储模块,被设置为利用所述第一数量的存储组以及所述第二数量的存储子区域,对待存储数据进行存储。The storage module is configured to use the first number of storage groups and the second number of storage sub-areas to store data to be stored.

本申请中,在获取目标存储区域之后,可以基于第一预设规则,将目标存储区域划分为第一数量的存储组,其中每个存储组至少具备可以存储一个待存储数据的存储容量,并基于第二预设规则,将每个存储组划分为第二数量的存储子区域,再利用第一数量的存储组以及第二数量的存储子区域,对待存储数据进行存储。通过应用本申请的技术方案,可以在获取到待存储数据之后,根据其对应的队列标识,针对性的将其存储到对应的存储组中的存储子区域中。进而避免相关技术中存在的将数据无序存储在任一缓存区域的问题。In this application, after the target storage area is acquired, the target storage area may be divided into a first number of storage groups based on a first preset rule, wherein each storage group has at least a storage capacity capable of storing one data to be stored, and Based on the second preset rule, each storage group is divided into a second number of storage sub-areas, and then the first number of storage groups and the second number of storage sub-areas are used to store the data to be stored. By applying the technical solution of the present application, after the data to be stored is acquired, it can be stored in the storage sub-area of the corresponding storage group according to its corresponding queue identifier. Thus, the problem of disorderly storing data in any cache area existing in the related art is avoided.

在本申请的另一种实施方式中,获取模块301,还包括:In another implementation manner of the present application, the acquisition module 301 further includes:

获取模块301,被配置为获取第三数量的数据存储队列,所述第三数量小于等于所述第一数量;The acquiring module 301 is configured to acquire a third number of data storage queues, where the third number is less than or equal to the first number;

获取模块301,被配置为为每个所述数据存储队列分配对应的至少一个存储组,并分别为每个所述数据存储队列与对应的存储组建立映射关系;The acquisition module 301 is configured to assign at least one corresponding storage group to each of the data storage queues, and establish a mapping relationship between each of the data storage queues and the corresponding storage group;

获取模块301,被配置为将各个映射关系记录到映射数据库中。The obtaining module 301 is configured to record each mapping relationship into a mapping database.

在本申请的另一种实施方式中,获取模块301,还包括:In another implementation manner of the present application, the acquisition module 301 further includes:

获取模块301,被配置为获取所述待存储数据的存储参数;The obtaining module 301 is configured to obtain the storage parameters of the data to be stored;

获取模块301,被配置为基于所述待存储数据中的存储队列标识,确定所述待存储数据对应的存储队列;The obtaining module 301 is configured to determine the storage queue corresponding to the data to be stored based on the storage queue identifier in the data to be stored;

获取模块301,被配置为基于所述映射数据库,确定与所述待存储数据对应的存储队列相映射的所述第一存储组;The obtaining module 301 is configured to determine, based on the mapping database, the first storage group mapped to the storage queue corresponding to the data to be stored;

获取模块301,被配置为当检测到所述待存储数据的数据大小低于预设容量时,将所述待存储数据存储在所述第一存储组的第一存储子区域。The obtaining module 301 is configured to store the data to be stored in the first storage sub-area of the first storage group when it is detected that the data size of the data to be stored is lower than a preset capacity.

在本申请的另一种实施方式中,获取模块301,还包括:In another implementation manner of the present application, the acquisition module 301 further includes:

获取模块301,被配置为当检测到所述待存储数据的数据大小不低于所述预设容量时,获取所述待存储数据对应的优先级标签;The obtaining module 301 is configured to obtain a priority label corresponding to the data to be stored when it is detected that the data size of the data to be stored is not lower than the preset capacity;

获取模块301,被配置为当确定所述待存储数据对应的优先级标签满足预设的优先条件时,清除所述第一存储组中存储的预设优先级数据,并将所述待存储数据存储在所述第一存储组中;The obtaining module 301 is configured to clear the preset priority data stored in the first storage group when it is determined that the priority label corresponding to the data to be stored satisfies a preset priority condition, and store the data to be stored stored in said first storage group;

获取模块301,被配置为当确定所述待存储数据对应的优先级标签不满足所述预设的优先条件时,清除所述待存储数据。The obtaining module 301 is configured to clear the data to be stored when it is determined that the priority label corresponding to the data to be stored does not satisfy the preset priority condition.

在本申请的另一种实施方式中,还包括,更新模块304,其中:In another embodiment of the present application, an update module 304 is also included, wherein:

更新模块304,被配置为更新所述第一数据存储队列的地址偏移信息以及队长信息,所述地址偏移信息包括队首信息以及队尾信息,所述地址偏移信息用于表征所述第一存储队列中当前已存储数据的位置,所述队长信息用于表征所述第一数据存储队列的存储容量。The update module 304 is configured to update the address offset information and team leader information of the first data storage queue, the address offset information includes queue head information and queue tail information, and the address offset information is used to represent the The location of the currently stored data in the first storage queue, where the captain information is used to represent the storage capacity of the first data storage queue.

在本申请的另一种实施方式中,更新模块304,还包括:In another implementation manner of the present application, the update module 304 further includes:

更新模块304,被配置为检测所述第一存储组的剩余存储空间;An updating module 304, configured to detect the remaining storage space of the first storage group;

更新模块304,被配置为当检测到所述第一存储组的剩余存储空间小于目标容量时,获取处于空闲状态的第二存储组;The update module 304 is configured to acquire a second storage group in an idle state when it is detected that the remaining storage space of the first storage group is less than the target capacity;

更新模块304,被配置为将所述第二存储组与所述第一数据存储队列建立映射关系。The update module 304 is configured to establish a mapping relationship between the second storage group and the first data storage queue.

在本申请的另一种实施方式中,每个所述存储组的存储容量均相同;In another embodiment of the present application, the storage capacity of each of the storage groups is the same;

以及,同一存储组中每个所述存储子区域的存储容量相对应,包括:And, the storage capacity of each storage sub-area in the same storage group is corresponding, including:

同一所述存储组中,每个所述存储子区域的存储容量均相同。In the same storage group, the storage capacity of each storage sub-area is the same.

图7是根据一示例性实施例示出的一种电子设备的逻辑结构框图。例如,电子设备400可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。Fig. 7 is a logical structural block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 400 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like.

参照图7,电子设备400可以包括以下一个或多个组件:处理器401和存储器402。Referring to FIG. 7 , an electronic device 400 may include one or more of the following components: a processor 401 and a memory 402 .

处理器401可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器401可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器401也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central ProcessingUnit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器401可以在集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器401还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。The processor 401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 401 can adopt at least one hardware form in DSP (Digital Signal Processing, digital signal processing), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array, programmable logic array) accomplish. The processor 401 may also include a main processor and a coprocessor, the main processor is a processor for processing data in the wake-up state, and is also called a CPU (Central Processing Unit, central processing unit); Low-power processor for processing data in standby state. In some embodiments, the processor 401 may be integrated with a GPU (Graphics Processing Unit, image processor), and the GPU is used for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 401 may further include an AI (Artificial Intelligence, artificial intelligence) processor, where the AI processor is configured to process computing operations related to machine learning.

存储器402可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器402还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器402中的非暂态的计算机可读存储介质用于存储至少一个指令,该至少一个指令用于被处理器401所执行以实现本申请中方法实施例提供的互动特效标定方法。Memory 402 may include one or more computer-readable storage media, which may be non-transitory. The memory 402 may also include high-speed random access memory and non-volatile memory, such as one or more magnetic disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 402 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 401 to realize the interactive effects provided by the method embodiments in this application calibration method.

在一些实施例中,电子设备400还可选包括有:外围设备接口403和至少一个外围设备。处理器401、存储器402和外围设备接口403之间可以通过总线或信号线相连。各个外围设备可以通过总线、信号线或电路板与外围设备接口403相连。具体地,外围设备包括:射频电路404、触摸显示屏405、摄像头406、音频电路407、定位组件408和电源409中的至少一种。In some embodiments, the electronic device 400 may optionally further include: a peripheral device interface 403 and at least one peripheral device. The processor 401, the memory 402, and the peripheral device interface 403 may be connected through buses or signal lines. Each peripheral device can be connected to the peripheral device interface 403 through a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 404 , a touch screen 405 , a camera 406 , an audio circuit 407 , a positioning component 408 and a power supply 409 .

外围设备接口403可被用于将I/O(Input/Output,输入/输出)相关的至少一个外围设备连接到处理器401和存储器402。在一些实施例中,处理器401、存储器402和外围设备接口403被集成在同一芯片或电路板上;在一些其他实施例中,处理器401、存储器402和外围设备接口403中的任意一个或两个可以在单独的芯片或电路板上实现,本实施例对此不加以限定。The peripheral device interface 403 may be used to connect at least one peripheral device related to I/O (Input/Output, input/output) to the processor 401 and the memory 402 . In some embodiments, the processor 401, memory 402 and peripheral device interface 403 are integrated on the same chip or circuit board; in some other embodiments, any one of the processor 401, memory 402 and peripheral device interface 403 or The two can be implemented on a separate chip or circuit board, which is not limited in this embodiment.

射频电路404用于接收和发射RF(Radio Frequency,射频)信号,也称电磁信号。射频电路404通过电磁信号与通信网络以及其他通信设备进行通信。射频电路404将电信号转换为电磁信号进行发送,或者,将接收到的电磁信号转换为电信号。可选地,射频电路404包括:天线系统、RF收发器、一个或多个放大器、调谐器、振荡器、数字信号处理器、编解码芯片组、用户身份模块卡等等。射频电路404可以通过至少一种无线通信协议来与其它终端进行通信。该无线通信协议包括但不限于:城域网、各代移动通信网络(2G、3G、4G及5G)、无线局域网和/或WiFi(Wireless Fidelity,无线保真)网络。在一些实施例中,射频电路404还可以包括NFC(Near Field Communication,近距离无线通信)有关的电路,本申请对此不加以限定。The radio frequency circuit 404 is configured to receive and transmit RF (Radio Frequency, radio frequency) signals, also called electromagnetic signals. The radio frequency circuit 404 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 404 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 404 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. The radio frequency circuit 404 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and/or a WiFi (Wireless Fidelity, wireless fidelity) network. In some embodiments, the radio frequency circuit 404 may also include circuits related to NFC (Near Field Communication, short-range wireless communication), which is not limited in this application.

显示屏405用于显示UI(User Interface,用户界面)。该UI可以包括图形、文本、图标、视频及其它们的任意组合。当显示屏405是触摸显示屏时,显示屏405还具有采集在显示屏405的表面或表面上方的触摸信号的能力。该触摸信号可以作为控制信号输入至处理器401进行处理。此时,显示屏405还可以用于提供虚拟按钮和/或虚拟键盘,也称软按钮和/或软键盘。在一些实施例中,显示屏405可以为一个,设置电子设备400的前面板;在另一些实施例中,显示屏405可以为至少两个,分别设置在电子设备400的不同表面或呈折叠设计;在再一些实施例中,显示屏405可以是柔性显示屏,设置在电子设备400的弯曲表面上或折叠面上。甚至,显示屏405还可以设置成非矩形的不规则图形,也即异形屏。显示屏405可以采用LCD(Liquid Crystal Display,液晶显示屏)、OLED(Organic Light-Emitting Diode,有机发光二极管)等材质制备。The display screen 405 is used to display a UI (User Interface, user interface). The UI can include graphics, text, icons, video, and any combination thereof. When the display screen 405 is a touch display screen, the display screen 405 also has the ability to collect touch signals on or above the surface of the display screen 405 . The touch signal can be input to the processor 401 as a control signal for processing. At this time, the display screen 405 can also be used to provide virtual buttons and/or virtual keyboards, also called soft buttons and/or soft keyboards. In some embodiments, there may be one display screen 405, which is arranged on the front panel of the electronic device 400; in other embodiments, there may be at least two display screens 405, which are respectively arranged on different surfaces of the electronic device 400 or in a folding design In some other embodiments, the display screen 405 may be a flexible display screen, which is arranged on the curved surface or the folding surface of the electronic device 400 . Even, the display screen 405 can also be set as a non-rectangular irregular figure, that is, a special-shaped screen. The display screen 405 can be made of LCD (Liquid Crystal Display, liquid crystal display), OLED (Organic Light-Emitting Diode, organic light-emitting diode) and other materials.

摄像头组件406用于采集图像或视频。可选地,摄像头组件406包括前置摄像头和后置摄像头。通常,前置摄像头设置在终端的前面板,后置摄像头设置在终端的背面。在一些实施例中,后置摄像头为至少两个,分别为主摄像头、景深摄像头、广角摄像头、长焦摄像头中的任意一种,以实现主摄像头和景深摄像头融合实现背景虚化功能、主摄像头和广角摄像头融合实现全景拍摄以及VR(Virtual Reality,虚拟现实)拍摄功能或者其它融合拍摄功能。在一些实施例中,摄像头组件406还可以包括闪光灯。闪光灯可以是单色温闪光灯,也可以是双色温闪光灯。双色温闪光灯是指暖光闪光灯和冷光闪光灯的组合,可以用于不同色温下的光线补偿。The camera assembly 406 is used to capture images or videos. Optionally, the camera component 406 includes a front camera and a rear camera. Usually, the front camera is set on the front panel of the terminal, and the rear camera is set on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of the main camera, depth-of-field camera, wide-angle camera, and telephoto camera, so as to realize the fusion of the main camera and the depth-of-field camera to realize the background blur function. Combined with the wide-angle camera to realize panoramic shooting and VR (Virtual Reality, virtual reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 406 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. Dual color temperature flash refers to the combination of warm light flash and cold light flash, which can be used for light compensation under different color temperatures.

音频电路407可以包括麦克风和扬声器。麦克风用于采集用户及环境的声波,并将声波转换为电信号输入至处理器401进行处理,或者输入至射频电路404以实现语音通信。出于立体声采集或降噪的目的,麦克风可以为多个,分别设置在电子设备400的不同部位。麦克风还可以是阵列麦克风或全向采集型麦克风。扬声器则用于将来自处理器401或射频电路404的电信号转换为声波。扬声器可以是传统的薄膜扬声器,也可以是压电陶瓷扬声器。当扬声器是压电陶瓷扬声器时,不仅可以将电信号转换为人类可听见的声波,也可以将电信号转换为人类听不见的声波以进行测距等用途。在一些实施例中,音频电路407还可以包括耳机插孔。Audio circuitry 407 may include a microphone and speakers. The microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals and input them to the processor 401 for processing, or input them to the radio frequency circuit 404 to realize voice communication. For the purpose of stereo sound collection or noise reduction, there may be multiple microphones, which are respectively arranged in different parts of the electronic device 400 . The microphone can also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert the electrical signal from the processor 401 or the radio frequency circuit 404 into sound waves. The loudspeaker can be a conventional membrane loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, it is possible not only to convert electrical signals into sound waves audible to humans, but also to convert electrical signals into sound waves inaudible to humans for purposes such as distance measurement. In some embodiments, audio circuitry 407 may also include a headphone jack.

定位组件408用于定位电子设备400的当前地理位置,以实现导航或LBS(LocationBased Service,基于位置的服务)。定位组件408可以是基于美国的GPS(GlobalPositioning System,全球定位系统)、中国的北斗系统、俄罗斯的格雷纳斯系统或欧盟的伽利略系统的定位组件。The positioning component 408 is used to locate the current geographic location of the electronic device 400 to implement navigation or LBS (Location Based Service, location-based service). The positioning component 408 may be a positioning component based on the GPS (Global Positioning System, Global Positioning System) of the United States, the Beidou system of China, the Grenax system of Russia, or the Galileo system of the European Union.

电源409用于为电子设备400中的各个组件进行供电。电源409可以是交流电、直流电、一次性电池或可充电电池。当电源409包括可充电电池时,该可充电电池可以支持有线充电或无线充电。该可充电电池还可以用于支持快充技术。The power supply 409 is used to supply power to various components in the electronic device 400 . Power source 409 may be AC, DC, disposable or rechargeable batteries. When the power source 409 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.

在一些实施例中,电子设备400还包括有一个或多个传感器410。该一个或多个传感器410包括但不限于:加速度传感器411、陀螺仪传感器412、压力传感器413、指纹传感器414、光学传感器415以及接近传感器416。In some embodiments, the electronic device 400 further includes one or more sensors 410 . The one or more sensors 410 include, but are not limited to: an acceleration sensor 411 , a gyro sensor 412 , a pressure sensor 413 , a fingerprint sensor 414 , an optical sensor 415 and a proximity sensor 416 .

加速度传感器411可以检测以电子设备400建立的坐标系的三个坐标轴上的加速度大小。比如,加速度传感器411可以用于检测重力加速度在三个坐标轴上的分量。处理器401可以根据加速度传感器411采集的重力加速度信号,控制触摸显示屏405以横向视图或纵向视图进行用户界面的显示。加速度传感器411还可以用于游戏或者用户的运动数据的采集。The acceleration sensor 411 can detect the acceleration on the three coordinate axes of the coordinate system established by the electronic device 400 . For example, the acceleration sensor 411 can be used to detect the components of the gravitational acceleration on the three coordinate axes. The processor 401 may control the touch display screen 405 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 411 . The acceleration sensor 411 can also be used for collecting game or user's motion data.

陀螺仪传感器412可以检测电子设备400的机体方向及转动角度,陀螺仪传感器412可以与加速度传感器411协同采集用户对电子设备400的3D动作。处理器401根据陀螺仪传感器412采集的数据,可以实现如下功能:动作感应(比如根据用户的倾斜操作来改变UI)、拍摄时的图像稳定、游戏控制以及惯性导航。The gyro sensor 412 can detect the body direction and rotation angle of the electronic device 400 , and the gyro sensor 412 can cooperate with the acceleration sensor 411 to collect 3D actions of the user on the electronic device 400 . According to the data collected by the gyroscope sensor 412, the processor 401 can realize the following functions: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control and inertial navigation.

压力传感器413可以设置在电子设备400的侧边框和/或触摸显示屏405的下层。当压力传感器413设置在电子设备400的侧边框时,可以检测用户对电子设备400的握持信号,由处理器401根据压力传感器413采集的握持信号进行左右手识别或快捷操作。当压力传感器413设置在触摸显示屏405的下层时,由处理器401根据用户对触摸显示屏405的压力操作,实现对UI界面上的可操作性控件进行控制。可操作性控件包括按钮控件、滚动条控件、图标控件、菜单控件中的至少一种。The pressure sensor 413 may be disposed on the side frame of the electronic device 400 and/or the lower layer of the touch screen 405 . When the pressure sensor 413 is arranged on the side frame of the electronic device 400 , it can detect the user's grip signal on the electronic device 400 , and the processor 401 performs left and right hand recognition or shortcut operation according to the grip signal collected by the pressure sensor 413 . When the pressure sensor 413 is arranged on the lower layer of the touch screen 405, the processor 401 controls the operable controls on the UI interface according to the user's pressure operation on the touch screen 405. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.

指纹传感器414用于采集用户的指纹,由处理器401根据指纹传感器414采集到的指纹识别用户的身份,或者,由指纹传感器414根据采集到的指纹识别用户的身份。在识别出用户的身份为可信身份时,由处理器401授权该用户执行相关的敏感操作,该敏感操作包括解锁屏幕、查看加密信息、下载软件、支付及更改设置等。指纹传感器414可以被设置电子设备400的正面、背面或侧面。当电子设备400上设置有物理按键或厂商Logo时,指纹传感器414可以与物理按键或厂商Logo集成在一起。The fingerprint sensor 414 is used to collect the user's fingerprint, and the processor 401 identifies the user's identity according to the fingerprint collected by the fingerprint sensor 414, or, the fingerprint sensor 414 identifies the user's identity according to the collected fingerprint. When the identity of the user is recognized as a trusted identity, the processor 401 authorizes the user to perform related sensitive operations, such sensitive operations include unlocking the screen, viewing encrypted information, downloading software, making payment, and changing settings. The fingerprint sensor 414 may be disposed on the front, back or side of the electronic device 400 . When the electronic device 400 is provided with a physical button or a manufacturer's Logo, the fingerprint sensor 414 may be integrated with the physical button or the manufacturer's Logo.

光学传感器415用于采集环境光强度。在一个实施例中,处理器401可以根据光学传感器415采集的环境光强度,控制触摸显示屏405的显示亮度。具体地,当环境光强度较高时,调高触摸显示屏405的显示亮度;当环境光强度较低时,调低触摸显示屏405的显示亮度。在另一个实施例中,处理器401还可以根据光学传感器415采集的环境光强度,动态调整摄像头组件406的拍摄参数。The optical sensor 415 is used to collect ambient light intensity. In one embodiment, the processor 401 can control the display brightness of the touch screen 405 according to the ambient light intensity collected by the optical sensor 415 . Specifically, when the ambient light intensity is high, the display brightness of the touch screen 405 is increased; when the ambient light intensity is low, the display brightness of the touch screen 405 is decreased. In another embodiment, the processor 401 may also dynamically adjust shooting parameters of the camera assembly 406 according to the ambient light intensity collected by the optical sensor 415 .

接近传感器416,也称距离传感器,通常设置在电子设备400的前面板。接近传感器416用于采集用户与电子设备400的正面之间的距离。在一个实施例中,当接近传感器416检测到用户与电子设备400的正面之间的距离逐渐变小时,由处理器401控制触摸显示屏405从亮屏状态切换为息屏状态;当接近传感器416检测到用户与电子设备400的正面之间的距离逐渐变大时,由处理器401控制触摸显示屏405从息屏状态切换为亮屏状态。The proximity sensor 416 , also called a distance sensor, is usually arranged on the front panel of the electronic device 400 . The proximity sensor 416 is used to collect the distance between the user and the front of the electronic device 400 . In one embodiment, when the proximity sensor 416 detects that the distance between the user and the front of the electronic device 400 gradually decreases, the processor 401 controls the touch display screen 405 to switch from the bright screen state to the off screen state; when the proximity sensor 416 When it is detected that the distance between the user and the front of the electronic device 400 gradually increases, the processor 401 controls the touch display screen 405 to switch from the off-screen state to the on-screen state.

本领域技术人员可以理解,图7中示出的结构并不构成对电子设备400的限定,可以包括比图示更多或更少的组件,或者组合某些组件,或者采用不同的组件布置。Those skilled in the art can understand that the structure shown in FIG. 7 does not constitute a limitation to the electronic device 400, and may include more or less components than shown in the figure, or combine some components, or adopt a different component arrangement.

在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器404,上述指令可由电子设备400的处理器420执行以完成上述管理数据的方法,该方法包括:获取目标存储区域;基于第一预设规则,将所述目标存储区域划分为第一数量的存储组,所述每个存储组至少具备可以存储一个待存储数据的存储容量,其中每个所述存储组的存储容量相对应;基于第二预设规则,将每个所述存储组划分为第二数量的存储子区域,其中在同一存储组中每个所述存储子区域的存储容量相对应;利用所述第一数量的存储组以及所述第二数量的存储子区域,对待存储数据进行存储。可选地,上述指令还可以由电子设备400的处理器420执行以完成上述示例性实施例中所涉及的其他步骤。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium including instructions, such as a memory 404 including instructions, the instructions can be executed by the processor 420 of the electronic device 400 to complete the above method for managing data, The method includes: acquiring a target storage area; dividing the target storage area into a first number of storage groups based on a first preset rule, and each storage group has at least a storage capacity capable of storing one data to be stored, wherein The storage capacity of each of the storage groups corresponds; based on a second preset rule, each of the storage groups is divided into a second number of storage sub-areas, wherein in the same storage group, each of the storage sub-areas The storage capacity is corresponding; the data to be stored is stored by using the first number of storage groups and the second number of storage sub-areas. Optionally, the above instructions may also be executed by the processor 420 of the electronic device 400 to complete other steps involved in the above exemplary embodiments. For example, the non-transitory computer readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.

在示例性实施例中,还提供了一种应用程序/计算机程序产品,包括一条或多条指令,该一条或多条指令可以由电子设备400的处理器420执行,以完成上述管理数据的方法,该方法包括:获取目标存储区域;基于第一预设规则,将所述目标存储区域划分为第一数量的存储组,所述每个存储组至少具备可以存储一个待存储数据的存储容量,其中每个所述存储组的存储容量相对应;基于第二预设规则,将每个所述存储组划分为第二数量的存储子区域,其中在同一存储组中每个所述存储子区域的存储容量相对应;利用所述第一数量的存储组以及所述第二数量的存储子区域,对待存储数据进行存储。可选地,上述指令还可以由电子设备400的处理器420执行以完成上述示例性实施例中所涉及的其他步骤。In an exemplary embodiment, an application program/computer program product is also provided, including one or more instructions, which can be executed by the processor 420 of the electronic device 400, so as to complete the above-mentioned method for managing data , the method includes: acquiring a target storage area; based on a first preset rule, dividing the target storage area into a first number of storage groups, each of which has at least a storage capacity capable of storing one data to be stored, wherein the storage capacity of each of the storage groups corresponds; based on a second preset rule, each of the storage groups is divided into a second number of storage sub-areas, wherein each of the storage sub-areas in the same storage group corresponding to the storage capacity; using the first number of storage groups and the second number of storage sub-areas to store the data to be stored. Optionally, the above instructions may also be executed by the processor 420 of the electronic device 400 to complete other steps involved in the above exemplary embodiments.

本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求指出。Other embodiments of the present application will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the application, these modifications, uses or adaptations follow the general principles of the application and include common knowledge or conventional technical means in the technical field not disclosed in the application . The specification and examples are to be considered exemplary only, with a true scope and spirit of the application indicated by the following claims.

应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求来限制。It should be understood that the present application is not limited to the precise constructions which have been described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (8)

1. A method of managing data, comprising:
acquiring a target storage area;
dividing the target storage area into a first number of storage groups based on a first preset rule, wherein each storage group at least has a storage capacity for storing one data to be stored, and the storage capacity of each storage group corresponds to the storage capacity of the corresponding storage group;
dividing each storage group into a second number of storage subareas based on a second preset rule, wherein the storage capacity of each storage subarea in the same storage group corresponds to that of each storage subarea;
storing data to be stored by utilizing the first number of storage groups and the second number of storage subareas;
wherein after dividing each memory group into a second number of memory sub-regions based on a second preset rule, the method further comprises:
acquiring a third number of data storage queues, wherein the third number is smaller than or equal to the first number;
Allocating at least one corresponding storage group for each data storage queue, and respectively establishing a mapping relation between each data storage queue and the corresponding storage group;
recording each mapping relation into a mapping database;
wherein after dividing each memory group into a second number of memory sub-regions based on a second preset rule, the method further comprises:
acquiring storage parameters of the data to be stored;
determining a storage queue corresponding to the data to be stored based on a storage queue identifier in the data to be stored;
determining a first storage group mapped with a storage queue corresponding to the data to be stored based on a mapping database;
and when the data size of the data to be stored is detected to be lower than the preset capacity, storing the data to be stored in a first memory subarea of the first memory group.
2. The method of claim 1, wherein after said determining said first storage group mapped to a storage queue corresponding to said data to be stored, comprising:
when the data size of the data to be stored is detected to be not lower than the preset capacity, acquiring a priority label corresponding to the data to be stored;
When the priority label corresponding to the data to be stored is determined to meet the preset priority condition, the preset priority data stored in the first storage group is cleared, and the data to be stored is stored in the first storage group;
and when the priority label corresponding to the data to be stored is determined not to meet the preset priority condition, the data to be stored is cleared.
3. The method of claim 1, after said storing said data to be stored in a first memory sub-region of said first memory group, comprising:
updating address offset information and queue length information of a first data storage queue, wherein the address offset information comprises queue head information and queue tail information, the address offset information is used for representing the position of currently stored data in the first data storage queue, and the queue length information is used for representing the storage capacity of the first data storage queue.
4. The method of claim 3, after said storing said data to be stored in a first memory sub-region of said first memory group, comprising:
detecting the remaining storage space of the first storage group;
when the fact that the residual storage space of the first storage group is smaller than the target capacity is detected, acquiring a second storage group in an idle state;
And establishing a mapping relation between the second storage group and the first data storage queue.
5. The method of any of claims 1-4, wherein the storage capacity of each of the storage groups corresponds to comprising:
the storage capacity of each storage group is the same;
and, the memory capacity of each memory subarea in the same memory group corresponds to that of the memory subarea, including:
in the same memory group, the memory capacity of each memory subarea is the same.
6. An apparatus for managing data, comprising:
an acquisition module configured to acquire a target storage area;
the first dividing module is configured to divide the target storage area into a first number of storage groups based on a first preset rule, wherein each storage group is provided with at least one storage capacity for storing data to be stored, and the storage capacity of each storage group corresponds to the storage capacity of the corresponding storage group;
a second dividing module, configured to divide each storage group into a second number of storage subareas based on a second preset rule, where the storage capacity of each storage subarea in the same storage group corresponds to that of each storage subarea;
a storage module configured to store data to be stored using the first number of storage groups and the second number of storage sub-regions;
Wherein after dividing each memory group into a second number of memory sub-regions based on a second preset rule, the method further comprises:
acquiring a third number of data storage queues, wherein the third number is smaller than or equal to the first number;
allocating at least one corresponding storage group for each data storage queue, and respectively establishing a mapping relation between each data storage queue and the corresponding storage group;
recording each mapping relation into a mapping database;
wherein after dividing each memory group into a second number of memory sub-regions based on a second preset rule, the method further comprises:
acquiring storage parameters of the data to be stored;
determining a storage queue corresponding to the data to be stored based on a storage queue identifier in the data to be stored;
determining a first storage group mapped with a storage queue corresponding to the data to be stored based on a mapping database;
and when the data size of the data to be stored is detected to be lower than the preset capacity, storing the data to be stored in a first memory subarea of the first memory group.
7. An electronic device, comprising:
A memory for storing executable instructions; the method comprises the steps of,
a processor for displaying with the memory to execute the executable instructions to perform operations of the method of managing data of any one of claims 1-5.
8. A computer readable storage medium storing computer readable instructions which, when executed, perform the operations of the method of managing data of any one of claims 1-5.
CN202010544948.9A 2020-06-15 2020-06-15 Method, device, electronic equipment and medium for managing data Active CN111897487B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010544948.9A CN111897487B (en) 2020-06-15 2020-06-15 Method, device, electronic equipment and medium for managing data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010544948.9A CN111897487B (en) 2020-06-15 2020-06-15 Method, device, electronic equipment and medium for managing data

Publications (2)

Publication Number Publication Date
CN111897487A CN111897487A (en) 2020-11-06
CN111897487B true CN111897487B (en) 2023-08-18

Family

ID=73206690

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010544948.9A Active CN111897487B (en) 2020-06-15 2020-06-15 Method, device, electronic equipment and medium for managing data

Country Status (1)

Country Link
CN (1) CN111897487B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112711384A (en) * 2020-12-30 2021-04-27 华录光存储研究院(大连)有限公司 Data storage method and device based on multiple storage devices
CN112732194B (en) * 2021-01-13 2022-08-19 同盾科技有限公司 Irregular data storage method, device and storage medium
CN113148507B (en) * 2021-03-11 2022-08-26 上海电气慧程智能系统有限公司 Planning method and device for biological sample access path and electronic equipment
CN113407741B (en) * 2021-06-04 2022-09-20 北京三快在线科技有限公司 Material management method, device, electronic equipment and storage medium
CN113778342B (en) * 2021-09-17 2024-03-29 土巴兔集团股份有限公司 Data storage method and related equipment thereof
CN114130032A (en) * 2021-12-06 2022-03-04 珠海金山数字网络科技有限公司 Data update method and device
CN118799167A (en) * 2024-06-29 2024-10-18 深圳个元科技有限公司 Processing method, device and storage medium of raw images of machine vision inspection equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4435752A (en) * 1973-11-07 1984-03-06 Texas Instruments Incorporated Allocation of rotating memory device storage locations
WO2005066761A2 (en) * 2003-12-29 2005-07-21 Intel Corporation Method, system, and program for managing parity raid data reconstruction
US9112818B1 (en) * 2010-02-05 2015-08-18 Marvell Isreal (M.I.S.L) Ltd. Enhanced tail dropping in a switch
KR101754348B1 (en) * 2016-06-17 2017-07-06 고려대학교 산학협력단 Analyzing system for managing information storage table control method thereof
CN109683809A (en) * 2018-11-19 2019-04-26 深圳市艾锐达光电有限公司 A kind of date storage method and terminal
CN110968549A (en) * 2019-11-18 2020-04-07 Oppo(重庆)智能科技有限公司 File storage method and device, electronic equipment and medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7146466B2 (en) * 2004-03-23 2006-12-05 International Business Machines System for balancing multiple memory buffer sizes and method therefor
US9898213B2 (en) * 2015-01-23 2018-02-20 Commvault Systems, Inc. Scalable auxiliary copy processing using media agent resources
US9996404B2 (en) * 2016-09-01 2018-06-12 Oracle International Corporation Message cache management for message queues

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4435752A (en) * 1973-11-07 1984-03-06 Texas Instruments Incorporated Allocation of rotating memory device storage locations
WO2005066761A2 (en) * 2003-12-29 2005-07-21 Intel Corporation Method, system, and program for managing parity raid data reconstruction
US9112818B1 (en) * 2010-02-05 2015-08-18 Marvell Isreal (M.I.S.L) Ltd. Enhanced tail dropping in a switch
KR101754348B1 (en) * 2016-06-17 2017-07-06 고려대학교 산학협력단 Analyzing system for managing information storage table control method thereof
CN109683809A (en) * 2018-11-19 2019-04-26 深圳市艾锐达光电有限公司 A kind of date storage method and terminal
CN110968549A (en) * 2019-11-18 2020-04-07 Oppo(重庆)智能科技有限公司 File storage method and device, electronic equipment and medium

Also Published As

Publication number Publication date
CN111897487A (en) 2020-11-06

Similar Documents

Publication Publication Date Title
CN111897487B (en) Method, device, electronic equipment and medium for managing data
CN110944374B (en) Communication mode selection method and device, electronic equipment and medium
CN112256425B (en) Load balancing method and system, computer cluster, information editing method and terminal
WO2020001564A1 (en) Method, apparatus, and system for processing tasks
CN108762881B (en) Interface drawing method and device, terminal and storage medium
CN110673944B (en) Method and device for executing task
CN110347520A (en) Method, apparatus, electronic equipment and the medium of message distribution
CN110046018A (en) Show method, apparatus, electronic equipment and the medium of message
CN112749590B (en) Target detection method, device, computer equipment and computer-readable storage medium
CN115766490B (en) Method for acquiring calibration data, method, device and equipment for storing calibration data
CN113127181A (en) Memory management method, device and storage medium
CN108717365A (en) The method and apparatus for executing function in the application
CN108845777A (en) The method and apparatus for playing frame animation
CN111265885A (en) Resource display method, resource sending method, device, equipment and storage medium
CN111275607A (en) Interface display method and device, computer equipment and storage medium
CN114785766A (en) Control method of intelligent equipment, terminal and server
CN116842047A (en) Cache updating method, device, equipment and computer readable storage medium
CN110032421B (en) Method and device for managing atlas in memory, terminal and storage medium
CN111191254B (en) Access verification method, device, computer equipment and storage medium
CN112000899A (en) Display method, device, electronic device and storage medium for scenic spot information
CN111897488B (en) Method, device, electronic device and medium for managing data
CN114510440B (en) Business processing method, electronic device, electronic equipment and medium
CN110851435B (en) Data storage method and device
CN115344537A (en) Storage space allocation method and device, file system and storage medium
CN109871411B (en) Method, device, electronic device and medium for synchronizing data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 100081 room 2505, Ziyuan West building, 46 Haidian Road, Haidian District, Beijing

Patentee after: BEIJING HANNUO SEMICONDUCTOR TECHNOLOGY Co.,Ltd.

Country or region after: China

Patentee after: Peking University

Patentee after: Zijinshan Laboratory

Address before: 100081 room 2505, Ziyuan West building, 46 Haidian Road, Haidian District, Beijing

Patentee before: BEIJING HANNUO SEMICONDUCTOR TECHNOLOGY Co.,Ltd.

Country or region before: China

Patentee before: Peking University

Patentee before: Purple Mountain Laboratories