Movatterモバイル変換


[0]ホーム

URL:


CN109344091B - A buffer array regularization method, device, terminal and readable medium - Google Patents

A buffer array regularization method, device, terminal and readable medium
Download PDF

Info

Publication number
CN109344091B
CN109344091BCN201811147158.6ACN201811147158ACN109344091BCN 109344091 BCN109344091 BCN 109344091BCN 201811147158 ACN201811147158 ACN 201811147158ACN 109344091 BCN109344091 BCN 109344091B
Authority
CN
China
Prior art keywords
array
data information
buffer
linked list
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
CN201811147158.6A
Other languages
Chinese (zh)
Other versions
CN109344091A (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.)
Zhongshengjun (Beijing) Technology Co.,Ltd.
Original Assignee
Wuhan Douyu Network Technology Co Ltd
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 Wuhan Douyu Network Technology Co LtdfiledCriticalWuhan Douyu Network Technology Co Ltd
Priority to CN201811147158.6ApriorityCriticalpatent/CN109344091B/en
Publication of CN109344091ApublicationCriticalpatent/CN109344091A/en
Application grantedgrantedCritical
Publication of CN109344091BpublicationCriticalpatent/CN109344091B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本发明实施例公开了一种缓冲数组规整方法、装置、终端及可读介质,其中该方法包括:根据接收的规整指令对缓冲数组对应的缓存队列组中的各缓存队列进行扫描,其中缓存队列可存储缓冲数组内每次更新后的数据信息;当扫描所得的数据信息不为空时,将数据信息添加至预定义的链表对象中;当缓存队列组中的各缓存队列扫描结束时,获取链表对象中的数据信息并存储至临时数组中;当链表对象中全部数据信息存储至临时数组中时,将临时数组的数据信息回传至缓冲组数中。本发明实施例提供的一种缓冲数组规整方法、装置、终端及可读介质,实现了缓冲数组规整,提高了缓冲数组规整效率,且避免了规整过程中数据丢失。

Figure 201811147158

The embodiment of the present invention discloses a buffer array regularization method, device, terminal and readable medium, wherein the method includes: scanning each cache queue in a cache queue group corresponding to the buffer array according to a received regularization instruction, wherein the cache queue It can store the data information after each update in the buffer array; when the data information obtained by scanning is not empty, add the data information to the predefined linked list object; when the scanning of each cache queue in the cache queue group ends, get The data information in the linked list object is stored in the temporary array; when all the data information in the linked list object is stored in the temporary array, the data information of the temporary array is returned to the buffer group number. The buffer array regularization method, device, terminal and readable medium provided by the embodiments of the present invention realize buffer array regularization, improve the buffer array regularization efficiency, and avoid data loss during the regularization process.

Figure 201811147158

Description

Buffer array regulation method, device, terminal and readable medium
Technical Field
The embodiment of the invention relates to computer technology, in particular to a buffer array regulation method, a buffer array regulation device, a terminal and a readable medium.
Background
In an Android terminal, a buffer area (e.g., a buffer array) of a data stream is often required to be opened up for buffering the data stream, and the buffer array is often required to be normalized so as to facilitate operations such as reading data in the data stream. The regularization processing can be understood as processing operation in which data is sequentially stored into an array according to the sequence of index sequence numbers of the array of 0, 1, 2. Currently, a common buffer array regulation method is to migrate data in an array one by one. The operation of transferring large amount of data one by one is long in time consumption and slow in speed, so that the buffer array arrangement efficiency is low. In addition, when the data in the buffer array is updated faster, the buffer array is not completely structured, and the original data is replaced by the new data, which results in the data loss phenomenon.
Disclosure of Invention
In view of this, embodiments of the present invention provide a buffer array normalization method, apparatus, terminal and readable medium, which implement buffer array normalization, improve buffer array normalization efficiency, and avoid data loss in the normalization process.
In a first aspect, an embodiment of the present invention provides a buffer array normalization method, including:
receiving a normalization instruction, and sequentially scanning each cache queue in a cache queue group corresponding to a buffer array according to the normalization instruction, wherein when data information in the buffer array is updated, the updated data information is migrated to the cache queue in the cache queue group;
when the scanned data information is not empty, adding the data information into a predefined linked list object, and emptying a buffer queue after scanning;
when scanning of each cache queue in the cache queue group is finished, sequentially acquiring data information in a linked list object, and storing the acquired data information in the linked list object into a temporary array, wherein the array length of the temporary array is the same as the array length of the buffer array;
when all the data information in the linked list object is stored in the temporary array, the data information of the temporary array is transmitted back to the buffer array, and the data information of the temporary array is emptied when the data information transmission is finished.
Optionally, the sequentially scanning, according to the normalization instruction, each buffer queue in the buffer queue group corresponding to the buffer array includes:
acquiring information of each cache queue in a cache queue group corresponding to the buffer array according to the regular instruction;
and scanning each buffer queue in sequence according to the information of each buffer queue and the priority of each buffer queue.
Optionally, the buffer queue information includes a buffer queue head address and a queue length of the buffer queue;
correspondingly, the sequentially scanning each buffer queue according to the information of each buffer queue and the priority of each buffer queue includes:
determining the last address of each buffer queue according to the first address of each buffer queue and the queue length of each buffer queue;
and scanning the buffer queues from the first address to the last address in sequence according to the sequence of the priorities of the buffer queues from high to low.
Optionally, when the data information in the buffer array is updated, migrating the updated data information to a buffer queue in the buffer queue group, where the migrating includes:
when the data information in the buffer array is updated, determining a target buffer queue from the buffer queue which does not store the data information in the buffer array in the buffer queue group;
and storing the updated data information in the buffer array into a target buffer queue, and emptying the buffer array.
Optionally, adding the data information to a predefined linked list object when the scanned data information is not empty, where the adding includes:
acquiring data information obtained by scanning, and judging whether the data information is empty or not;
and when the data information is not empty, calling an adding method of the linked list object to add the data information into the linked list object.
Optionally, the sequentially obtaining the data information in the linked list object and storing the obtained data information in the linked list object in the temporary array includes:
calling a linked list object acquisition method to sequentially acquire data information in the linked list object;
and calling an array storage method to store the acquired data information in the linked list object into a temporary array.
Optionally, after the receiving the warping instruction, the method includes:
calling a chain table definition method to define a chain table object;
judging whether the residual memory meets the requirement of defining a temporary array, and calling an array definition method to define the temporary array when the residual memory meets the requirement of defining the temporary array;
correspondingly, when the scanning of each cache queue in the cache queue group is finished, if the temporary array is defined, sequentially acquiring the data information in the linked list object, and storing the acquired data information in the linked list object into the temporary array;
when the scanning of the buffer array is finished, if the temporary array is undefined, when the temporary array is successfully defined, the data information in the linked list object is sequentially acquired, and the acquired data information in the linked list object is stored in the temporary array.
In a second aspect, an embodiment of the present invention provides a buffer array arrangement apparatus, including:
the buffer queue scanning module is used for receiving a normalization instruction and sequentially scanning each buffer queue in a buffer queue group corresponding to the buffer array according to the normalization instruction, wherein when the data information in the buffer array is updated, the updated data information is migrated to the buffer queue in the buffer queue group;
the data adding module is used for adding the data information into a predefined linked list object and emptying a buffer queue after scanning when the scanned data information is not empty;
the data storage to temporary array module is used for sequentially acquiring data information in a linked list object when the scanning of each cache queue in the cache queue group is finished, and storing the acquired data information in the linked list object into a temporary array, wherein the array length of the temporary array is the same as the array length of the buffer array;
and the data returning module is used for returning the data information of the temporary array to the buffer array when all the data information in the linked list object is stored in the temporary array, and emptying the data information of the temporary array when the data information returning is finished.
In a third aspect, an embodiment of the present invention provides a terminal, including:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a buffer array arrangement method as in any one of the embodiments of the invention.
In a fourth aspect, an embodiment of the present invention provides a readable medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a buffer array arrangement method according to any embodiment of the present invention.
According to the buffer array regulating method, the buffer array regulating device, the terminal and the readable medium, each buffer queue in a buffer queue group corresponding to a buffer array is scanned according to a received regulating instruction, wherein the buffer queue can store data information updated in the buffer array every time; when the scanned data information is not empty, adding the data information into a predefined linked list object; when the scanning of each cache queue in the cache queue group is finished, acquiring data information in a linked list object and storing the data information in a temporary array; and when all the data information in the linked list object is stored into the temporary array, returning the data information of the temporary array to the buffer array. Therefore, the buffer array is structured, the efficiency of structuring the buffer array is improved, and data loss in the structuring process is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief description will be given below of the drawings required for the embodiments or the technical solutions in the prior art, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flowchart of a buffer array normalization method according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a buffer array organizing device according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a terminal according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described through embodiments with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Fig. 1 is a flowchart of a buffer array arrangement method according to an embodiment of the present invention, where the embodiment is applicable to a buffer array arrangement situation, and the method may be implemented by a terminal, and may specifically be implemented by software and/or hardware in the terminal. Referring to fig. 1, the buffer array normalization method includes the following steps:
s110, receiving a normalization instruction, and sequentially scanning each cache queue in the cache queue group corresponding to the buffer array according to the normalization instruction, wherein when the data information in the buffer array is updated, the updated data information is migrated to the cache queue in the cache queue group.
The normalization command may be a command generated by a user by pressing a physical key of the terminal or a virtual key on a screen of the terminal. The normalization instruction may also be generated after the bottom-layer program automatically detects a trigger condition, for example, the normalization instruction may be generated by triggering when empty data exists between data stored in the buffer array, or the normalization instruction may be generated by triggering when data stored in the buffer array is detected but the initial position of the buffer array is empty.
Each buffer array can be provided with a buffer queue group corresponding to the buffer array, and the buffer queue group can comprise a plurality of buffer queues. The corresponding relationship between the buffer array group and the buffer queue group may be stored in a global variable, or may be stored in a text document, which is not specifically limited herein. The corresponding relationship between the buffer array group and the buffer queue group may include information such as the number of buffer queues in the buffer queue group corresponding to the buffer array, a storage address, and a queue length of the buffer queue. The number of the buffer queues included in the buffer queue group may be related to the average update rate of the data information in the buffer array, specifically, the higher the update rate is, the larger the number of the buffer queues is, so as to ensure that the data in the buffer array can be backed up to the buffer queue in time after being updated each time, and avoid loss of the updated information data. The length of each buffer queue in the buffer queue group may be the same or different, and preferably, the queue lengths may all be equal to the array length of the buffer array, so as to ensure that data information (including null information) in all storage spaces in the buffer array can be backed up to the buffer queue at one time.
Optionally, sequentially scanning each cache queue in the cache queue group corresponding to the buffer array according to the normalization instruction, including:
acquiring information of each cache queue in a cache queue group corresponding to the buffer array according to the regular instruction; and scanning each buffer queue in sequence according to the information of each buffer queue and the priority of each buffer queue.
The information of each cache queue in the cache queue group corresponding to the buffer array can be obtained by inquiring the corresponding relation between the buffer array and the cache queue group. The scanning of each buffer queue is performed in sequence, which can be understood as performing polling scanning on the buffer queues. In the polling loop structure, data information of one scanning position in the cache queue can be acquired every time the loop structure is circulated.
Optionally, the buffer queue information may include a buffer queue first address and a queue length of the buffer queue;
correspondingly, the method for scanning the buffer queues in sequence according to the information of the buffer queues and the priorities of the buffer queues comprises the following steps:
determining the last address of each buffer queue according to the first address of each buffer queue and the queue length of each buffer queue; and scanning the buffer queues from the first address to the last address in sequence according to the sequence of the priorities of the buffer queues from high to low.
The last address of each buffer queue can be obtained by adding the first address of each buffer queue to the queue length of each buffer queue. The buffer queue capable of storing the data information updated for the first time by the buffer array is marked as a buffer queue with a first priority, the buffer queue capable of storing the data information updated for the second time by the buffer array is marked as a buffer queue with a second priority, and so on, the earlier the buffer queue stores the data information in the updated buffer array, the higher the priority of the data information is. The first address to the last address of the buffer queue are scanned according to the sequence of the priorities from high to low, so that the scanning sequence can be ensured to be the sequence of updating the data information in the buffer array, and the ordering correctness of the data information in the buffer array after the ordering can be ensured.
Optionally, when the data information in the buffer array is updated, migrating the updated data information to a buffer queue in the buffer queue group, where the migrating includes:
when the data information in the buffer array is updated, determining a target buffer queue from the buffer queue which does not store the data information in the buffer array in the buffer queue group; and storing the updated data information in the buffer array into a target buffer queue, and emptying the buffer array.
When the buffer array is updated each time, the data information in the buffer array can be completely backed up to the buffer queue. In order to ensure that the updated information of each buffer array can be accurately acquired, the updated information of each buffer array can be stored in a new buffer queue. Therefore, when the data information in the buffer array is updated, which buffer queues do not store the data information in the buffer array are searched from the buffer queue group, and any one of the buffer queues which do not store the data information in the buffer array is selected as a target buffer queue, and the priority of the target buffer queue is marked. After the updated information in the buffer array is stored in the target buffer queue, the data information of the buffer array may be emptied by calling a byte-null method, where byte is a name of the buffer array and may represent the buffer array, and the name of the buffer array is not limited to byte. The garbage recoverer in the empty bottom program can automatically release the memory space of the empty buffer array, so that the effective use of memory resources is realized, and the regular data information is favorably transmitted back to the buffer array.
And S120, when the scanned data information is not empty, adding the data information into a predefined linked list object, and emptying the scanned buffer queue.
When the data information of the scanned buffer queue is not empty, the data information can be used as effective data information and added to the linked list object. When the polling scanning of each cache queue in the cache queue group is finished, all the effective data in the cache queue group can be added into the linked list object, and therefore the cleaning of the space data of the effective data information in the cache queue group is achieved. Because the data information in the buffer array group is the backup data information of the updated information in the buffer array every time, the work of primarily clearing the empty data regularly by the buffer array can be considered to be finished. When scanning of one buffer queue is finished, the data in the buffer queue can be emptied, so that storage of data information after next updating of the buffer array is facilitated.
Optionally, when the scanned data information is not empty, adding the data information to a predefined linked list object includes:
acquiring data information obtained by scanning, and judging whether the data information is empty or not; and when the data information is not empty, calling an adding method of the linked list object to add the data information into the linked list object.
The index sequence numbers of the 1 st, 2 nd and 3. n positions in the buffer queue are respectively 0, 1 st and 2. n-1, so that the index sequence numbers from the first address to the last address of the buffer queue are 0, 1 st and 2. size-1 in sequence; wherein the size may represent the queue length of each buffer queue. In the process of scanning the location from the location with index sequence number index ═ 0 to the location with index sequence number index ═ size-1 of the cache queue, the data information at the location corresponding to the index sequence number, that is, the data information at the scanning location, can be obtained by calling a cacheArray [ index ], where cacheArray is the name of the cache queue, and can represent the cache queue, and the name of the cache queue is not limited to cacheArray.
After the data information is acquired, whether the data information is empty or not may be determined by calling a method of "null | | | cacheArray [ index ] =", and a return value is true when the data information is empty and false when the data information is not empty. When the data is judged not to be empty, the data information can be added to the linked list object.
The method for adding the linked list object may specifically be:
linkList.add(cacheArray[index]);
the linkList is the name of the linked list object and can represent the linked list object, and the name of the linked list object is not limited to the linkList; wherein, cacheArray [ index ] can be added to linkList by add method. The data information is added to the linked list object by the add method, the insertion position of the linked list object is not required to be instructed during insertion, and the data information can be guaranteed to be stored in the storage unit pointed by the pointer of the previous storage unit of the linked list object every time during addition, so that the data information addition speed is high, the addition efficiency is high, and the array arrangement efficiency is improved.
S130, when scanning of each cache queue in the cache queue group is finished, sequentially acquiring data information in the linked list object, and storing the acquired data information in the linked list object into a temporary array, wherein the array length of the temporary array is the same as the array length of the buffer array.
When the scanning of each cache queue in the cache queue group is finished, all non-empty data information in the cache queue group is added to the linked list object, and when the memory space of the temporary array is successfully developed, the data in the linked list object can be transferred to the temporary array. The temporary array length is defined to be equal to the buffer array length so as to facilitate the data information to be transmitted back to the buffer array by the temporary array. The data information can be more efficiently transmitted back from the temporary array to the buffer array by the transmission back method among the arrays.
Optionally, the obtaining the data information in the linked list object in sequence, and storing the obtained data information in the linked list object into a temporary array includes:
calling a linked list object acquisition method to sequentially acquire data information in the linked list object; and calling an array storage method to store the acquired data information in the linked list object into a temporary array.
The method specifically includes the steps that a linkedlist.get (index1) method is called to obtain data information in a linked list object; the index1 may represent an index sequence number of the linked list object, and the data information at a position corresponding to the index sequence number may be obtained by calling the get method. After the data information at the position corresponding to the index sequence number of the linked list object is obtained, the data information can be assigned to a numerical variable, and the numerical variable is assigned to the temporary array, so that the data information in the linked list object can be stored in the temporary array. Illustratively, the storage of the data information in the linked list object into the temporary array is realized by assigning linkedlist.get (index1) to the variable item and storing the value variable to the position of the temporary array with the index sequence number of index2 by calling the method of tmpbyte [ index2] ═ item.
The acquired data information in the linked list object is assigned to the variable, and the value of the variable is added to the position in the corresponding index serial number of the temporary array, so that the data reading and adding operation is completed through one polling, and the data processing efficiency is improved.
And S140, when all the data information in the linked list object is stored in the temporary array, returning the data information of the temporary array to the buffer array, and emptying the data information of the temporary array when the data information is returned.
When all data in the linked list object are stored to the temporary array, the data information of the temporary array can be transmitted back to the buffer array by calling a byte-tmpbyte method, the temporary array can be completely copied to the buffer array, and the data information transmission between the data is completed. And emptying the temporary array after the data information of the buffer array is completely returned, so that the effective use of system memory resources can be realized.
Optionally, after receiving the warping instruction, the method includes:
calling a chain table definition method to define a chain table object; judging whether the residual memory meets the requirement of defining a temporary array, and calling an array definition method to define the temporary array when the residual memory meets the requirement of defining the temporary array;
correspondingly, when the scanning of each cache queue in the cache queue group is finished, if the temporary array is defined, sequentially acquiring the data information in the linked list object, and storing the acquired data information in the linked list object into the temporary array; when the scanning of the buffer array is finished, if the temporary array is undefined, when the temporary array is successfully defined, the data information in the linked list object is sequentially acquired, and the acquired data information in the linked list object is stored in the temporary array.
The method for defining the linked list specifically may be:
LinkedList linkList=new LinkedList();
the linkList is the name of the linked list object and can represent the linked list object, and the name of the linked list object is not limited to the linkList; wherein, a linked list object of LinkedList type can be newly created by a new method.
Wherein, the remaining memory satisfies the requirement of defining the temporary array, including: the remaining memory has a continuous memory space of an array length equal to or greater than the temporary array.
When opening up the array memory space, the continuous storage unit with the array length of the defined array needs to be searched in the residual memory space, and the opening up of the array memory space can be carried out only when the continuous memory space with the array length being more than or equal to the array length exists in the residual memory, so that the definition of the array is realized. Therefore, after the data information of the buffer array is emptied, the time consumption for waiting for opening up the memory space of the temporary array is short, the probability of successfully defining the temporary array is high, the memory space opening up of the temporary array is easily realized, and the array arrangement efficiency can be improved.
Wherein a temporary array may be defined by calling private tmpbyte [1024 × 5] { } method; 1024 × 5 indicates that the size of the temporary array tmpbyte is 5M, the length of the temporary array is equal to the length of the buffer array, and the temporary array may be changed according to the length of the buffer array, and is not limited to 5M.
The temporary array may be defined after the normalization instruction is received, and when a continuous memory space with an array length greater than or equal to that of the temporary array exists in the remaining memory, the array definition method may be invoked to define the temporary array. When the scanning of the buffer array is finished, namely all non-empty data information of the buffer array is added to the linked list object, if the temporary array is defined, the opening up of the memory space is finished, the step of storing the data information in the linked list to the temporary array can be directly carried out, so that the time for defining the temporary array is saved, and the array arrangement efficiency is further improved; if the definition of the temporary array is not finished, namely the opening of the memory space is not finished, the array definition method is called to define the temporary array only when the remaining memory meets the requirement of defining the temporary array.
In the buffer array normalization method provided by this embodiment, each buffer queue in the buffer queue group corresponding to the buffer array is scanned according to the received normalization instruction, where the buffer queue can store data information updated in the buffer array each time, so as to avoid a situation that the data information in the buffer array is lost due to too fast update; when the scanned data information is not empty, adding the data information into a predefined linked list object; when the scanning of each cache queue in the cache queue group is finished, acquiring data information in a linked list object and storing the data information in a temporary array; and when all the data information in the linked list object is stored into the temporary array, returning the data information of the temporary array to the buffer array. Therefore, the buffer array is structured, the efficiency of structuring the buffer array is improved, and data loss in the structuring process is avoided.
Example two
Fig. 2 is a schematic structural diagram of a buffer array organizing device according to a second embodiment of the present invention, which is applicable to buffer array organizing in this embodiment.
Referring to fig. 2, the buffer array organizing apparatus in this embodiment includes:
the bufferqueue scanning module 210 is configured to receive a normalization instruction, and sequentially scan each buffer queue in a buffer queue group corresponding to the buffer array according to the normalization instruction, where when data information in the buffer array is updated, the updated data information is migrated to the buffer queue in the buffer queue group;
a data adding to linkedlist object module 220, configured to add the data information to a predefined linked list object and empty the scanned buffer queue when the scanned data information is not empty;
the data storage totemporary array module 230, when the scanning of each cache queue in the cache queue group is finished, sequentially obtaining data information in the linked list object, and storing the obtained data information in the linked list object into a temporary array, wherein the array length of the temporary array is the same as the array length of the buffer array;
thedata returning module 240 returns the data information of the temporary array to the buffer array when all the data information in the linked list object is stored in the temporary array, and clears the data information of the temporary array when the data information returning is finished.
Optionally, the bufferqueue scanning module 210 includes:
the queue information acquisition submodule is used for acquiring the information of each cache queue in the cache queue group corresponding to the buffer array according to the regular instruction;
and the buffer queue scanning submodule is used for scanning each buffer queue in sequence according to the information of each buffer queue and the priority of each buffer queue.
Further, the cache queue scanning submodule is specifically configured to:
determining the last address of each buffer queue according to the first address of each buffer queue and the queue length of each buffer queue;
and scanning the buffer queues from the first address to the last address in sequence according to the sequence of the priorities of the buffer queues from high to low.
Optionally, the buffer array arranging device further includes:
the target buffer queue determining module is used for determining a target buffer queue from the buffer queues which do not store the data information in the buffer array group when the data information in the buffer array is updated;
and the data storage to buffer queue module is used for storing the updated data information in the buffer array into the target buffer queue and emptying the buffer array.
Optionally, the data adding to linkedlist object module 220 includes:
the judging submodule is used for acquiring the data information obtained by scanning and judging whether the data information is empty or not;
and the data adding to linked list object submodule is used for calling a linked list object adding method to add the data information to the linked list object when the data information is not empty.
Optionally, the data is stored in thetemporary array module 230, which includes:
the data information acquisition submodule is used for calling an acquisition method of the linked list object to sequentially acquire the data information in the linked list object;
and the data storage to temporary array submodule is used for calling an array storage method to store the acquired data information in the linked list object to a temporary array.
Optionally, the buffer array arranging device further includes:
the linked list object definition module is used for calling a linked list definition method to define linked list objects after receiving a normalization instruction;
the temporary array definition module is used for judging whether the residual memory meets the requirement of defining the temporary array and calling an array definition method to define the temporary array when the residual memory meets the requirement of defining the temporary array;
correspondingly, the data is stored in thetemporary array module 230, which is specifically configured to:
when scanning of each cache queue in the cache queue group is finished, if the temporary array is defined, sequentially acquiring data information in the linked list object, and storing the acquired data information in the linked list object into the temporary array;
when the scanning of the buffer array is finished, if the temporary array is undefined, when the temporary array is successfully defined, the data information in the linked list object is sequentially acquired, and the acquired data information in the linked list object is stored in the temporary array.
The buffer array organizing device provided in this embodiment is the same as the buffer array organizing method provided in the first embodiment, and the technical details not described in detail in this embodiment can be referred to in the first embodiment.
EXAMPLE III
The embodiment provides a terminal which can be used for buffering the condition of array regulation. Fig. 3 is a schematic structural diagram of a terminal according to a third embodiment of the present invention. Referring to fig. 3, the terminal includes:
one ormore processors 310;
amemory 320 for storing one or more programs;
when executed by the one ormore processors 310, cause the one ormore processors 310 to implement a buffer array normalization method as set forth in one embodiment.
In FIG. 3, aprocessor 310 is illustrated as an example; theprocessor 310 and thememory 320 may be connected by a bus or other means, such as the bus connection shown in FIG. 3.
Thememory 320 is a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the buffer array normalization method in the embodiment of the present invention. Theprocessor 310 executes various functional applications of the terminal and data processing by executing software programs, instructions and modules stored in thememory 320, that is, implements the buffer array arrangement method described above.
Thememory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, thememory 320 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, thememory 320 may further include memory located remotely from theprocessor 310, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The terminal proposed in this embodiment and the buffer array warping method proposed in the first embodiment belong to the same inventive concept, and the technical details that are not described in detail in this embodiment can be referred to in the first embodiment, and this embodiment and the first embodiment have the same beneficial effects.
Example four
The present embodiment provides a readable medium, on which a computer program is stored, which when executed by a processor implements the buffer array regularization method as set forth in one embodiment.
The readable medium proposed by the embodiment and the buffer array normalization method proposed by the first embodiment belong to the same inventive concept, and technical details not described in detail in the embodiment can be referred to in the first embodiment, and the first embodiment and the second embodiment have the same beneficial effects.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

Translated fromChinese
1.一种缓冲数组规整方法,其特征在于,包括:1. a buffer array regularization method, is characterized in that, comprises:接收规整指令,根据所述规整指令对缓冲数组对应的缓存队列组中的各缓存队列依次进行扫描,其中当缓冲数组内数据信息进行更新时,将更新后数据信息迁移至缓存队列组中的缓存队列中;Receive the regularization instruction, and sequentially scan each cache queue in the cache queue group corresponding to the buffer array according to the regularization instruction, wherein when the data information in the buffer array is updated, the updated data information is migrated to the cache in the cache queue group. in the queue;当扫描所得的数据信息不为空时,将所述数据信息从缓存队列组中的缓存队列内添加至预定义的链表对象中,并将完成扫描的缓存队列进行清空;When the data information obtained by scanning is not empty, the data information is added from the cache queue in the cache queue group to the predefined linked list object, and the scanned cache queue is emptied;当缓存队列组中的各缓存队列扫描结束时,依次获取链表对象中的数据信息,并将获取到的链表对象中的数据信息存储至临时数组中,其中所述临时数组的数组长度与所述缓冲数组的数组长度相同;When the scanning of each cache queue in the cache queue group is completed, the data information in the linked list object is sequentially obtained, and the obtained data information in the linked list object is stored in a temporary array, wherein the array length of the temporary array is the same as the length of the temporary array. The array lengths of the buffer arrays are the same;当链表对象中全部数据信息存储至临时数组中时,将临时数组的数据信息回传至缓冲组数中,并在数据信息回传结束时将临时数组的数据信息清空。When all the data information in the linked list object is stored in the temporary array, the data information of the temporary array is returned to the buffer group number, and the data information of the temporary array is emptied at the end of the return of the data information.2.根据权利要求1所述的方法,其特征在于,所述根据所述规整指令对缓冲数组对应的缓存队列组中的各缓存队列依次进行扫描,包括:2. The method according to claim 1, characterized in that, according to the regularization instruction, sequentially scanning each cache queue in the cache queue group corresponding to the buffer array, comprising:根据所述规整指令获取缓冲数组对应的缓存队列组中各缓存队列信息;Acquire each cache queue information in the cache queue group corresponding to the buffer array according to the regular instruction;根据各缓存队列信息以及各缓存队列的优先级对各缓存队列依次进行扫描。Each cache queue is scanned sequentially according to the information of each cache queue and the priority of each cache queue.3.根据权利要求2所述的方法,其特征在于,所述缓存队列信息包括缓存队列首地址以及缓存队列的队列长度;3. method according to claim 2, is characterized in that, described buffer queue information comprises buffer queue head address and the queue length of buffer queue;相应的,所述根据各缓存队列信息以及各缓存队列的优先级对各缓存队列依次进行扫描,包括:Correspondingly, according to the information of each cache queue and the priority of each cache queue, scanning each cache queue in sequence includes:根据各缓存队列首地址以及各缓存队列的队列长度,确定各缓存队列末地址;Determine the end address of each cache queue according to the first address of each cache queue and the queue length of each cache queue;按照各缓存队列的优先级从高到低的顺序,对各缓冲队列从首地址到末地址依次进行扫描。According to the order of priority of each buffer queue from high to low, each buffer queue is scanned sequentially from the first address to the last address.4.根据权利要求1所述的方法,其特征在于,所述当缓冲数组内数据信息进行更新时,将更新后数据信息迁移至缓存队列组中的缓存队列中,包括:4. The method according to claim 1, wherein when the data information in the buffer array is updated, the updated data information is migrated to the buffer queue in the buffer queue group, comprising:当缓冲数组内数据信息进行更新时,从缓存队列组中未存储缓冲数组内数据信息的缓冲队列中确定目标缓冲队列;When the data information in the buffer array is updated, the target buffer queue is determined from the buffer queue in the buffer queue group that does not store the data information in the buffer array;将缓冲数组内更新后的数据信息存储至目标缓冲队列中,并将缓冲数组清空。Store the updated data information in the buffer array into the target buffer queue, and clear the buffer array.5.根据权利要求1所述的方法,其特征在于,所述当扫描所得的数据信息不为空时,将所述数据信息添加至预定义的链表对象中,包括:5. The method according to claim 1, wherein when the data information obtained by scanning is not empty, adding the data information to a predefined linked list object, comprising:获取扫描所得的数据信息,并判断所述数据信息是否为空;Obtain the data information obtained by scanning, and determine whether the data information is empty;当所述数据信息不为空时,调用链表对象的添加方法将所述数据信息添加至链表对象中。When the data information is not empty, the adding method of the linked list object is called to add the data information to the linked list object.6.根据权利要求1所述的方法,其特征在于,所述依次获取链表对象中的数据信息,并将获取到的链表对象中的数据信息存储至临时数组中,包括:6. The method according to claim 1, characterized in that, obtaining the data information in the linked list object successively, and storing the data information in the obtained linked list object in a temporary array, comprising:调用链表对象的获取方法依次获取链表对象中的数据信息;Call the acquisition method of the linked list object to obtain the data information in the linked list object in turn;调用数组存储方法将获取到的链表对象中的数据信息存储至临时数组中。Call the array storage method to store the data information in the obtained linked list object into a temporary array.7.根据权利要求1所述的方法,其特征在于,在所述接收规整指令之后,包括:7. The method according to claim 1, characterized in that, after said receiving the regularization instruction, comprising:调用链表定义方法定义链表对象;Call the linked list definition method to define the linked list object;判断剩余内存是否满足定义临时数组需求,并在剩余内存满足定义临时数组需求时,调用数组定义方法定义临时数组;Determine whether the remaining memory meets the requirements for defining a temporary array, and when the remaining memory meets the requirements for defining a temporary array, call the array definition method to define a temporary array;相应的,当缓存队列组中的各缓存队列扫描结束时,若临时数组已定义,则依次获取链表对象中的数据信息,并将获取到的链表对象中的数据信息存储至临时数组中;Correspondingly, when the scanning of each cache queue in the cache queue group ends, if the temporary array has been defined, the data information in the linked list object is sequentially obtained, and the obtained data information in the linked list object is stored in the temporary array;当缓冲数组扫描结束时,若临时数组未定义,则当临时数组成功定义时,依次获取链表对象中的数据信息,并将获取到的链表对象中的数据信息存储至临时数组中。When the buffer array scan ends, if the temporary array is not defined, when the temporary array is successfully defined, the data information in the linked list object is obtained in turn, and the obtained data information in the linked list object is stored in the temporary array.8.一种缓冲数组规整装置,其特征在于,包括:8. a buffer array regularization device, is characterized in that, comprises:缓存队列扫描模块,用于接收规整指令,根据所述规整指令对缓冲数组对应的缓存队列组中的各缓存队列依次进行扫描,其中当缓冲数组内数据信息进行更新时,将更新后数据信息迁移至缓存队列组中的缓存队列中;The cache queue scanning module is configured to receive a regularization instruction, and sequentially scan each cache queue in the cache queue group corresponding to the buffer array according to the regularization instruction, wherein when the data information in the buffer array is updated, the updated data information is migrated to the cache queue in the cache queue group;数据添加至链表对象模块,用于当扫描所得的数据信息不为空时,将所述数据信息从缓存队列组中的缓存队列内添加至预定义的链表对象中,并将完成扫描的缓存队列进行清空;The data is added to the linked list object module, for when the data information obtained by scanning is not empty, the data information is added from the cache queue in the cache queue group to the predefined linked list object, and the scanned cache queue is completed. to clear;数据存储至临时数组模块,当缓存队列组中的各缓存队列扫描结束时,依次获取链表对象中的数据信息,并将获取到的链表对象中的数据信息存储至临时数组中,其中所述临时数组的数组长度与所述缓冲数组的数组长度相同;The data is stored in the temporary array module. When the scanning of each cache queue in the cache queue group ends, the data information in the linked list object is sequentially obtained, and the obtained data information in the linked list object is stored in the temporary array, wherein the temporary The array length of the array is the same as the array length of the buffer array;数据回传模块,当链表对象中全部数据信息存储至临时数组中时,将临时数组的数据信息回传至缓冲组数中,并在数据信息回传结束时将临时数组的数据信息清空。The data return module, when all the data information in the linked list object is stored in the temporary array, returns the data information of the temporary array to the buffer group number, and clears the data information of the temporary array when the data information return ends.9.一种终端,其特征在于,所述终端包括:9. A terminal, wherein the terminal comprises:一个或多个处理器;one or more processors;存储器,用于存储一个或多个程序;memory for storing one or more programs;当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-7中任一所述的缓冲数组规整方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the buffer array warping method according to any one of claims 1-7.10.一种可读介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1-7中任一所述的缓冲数组规整方法。10. A readable medium on which a computer program is stored, characterized in that, when the program is executed by a processor, the buffer array regularization method according to any one of claims 1-7 is implemented.
CN201811147158.6A2018-09-292018-09-29 A buffer array regularization method, device, terminal and readable mediumActiveCN109344091B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201811147158.6ACN109344091B (en)2018-09-292018-09-29 A buffer array regularization method, device, terminal and readable medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201811147158.6ACN109344091B (en)2018-09-292018-09-29 A buffer array regularization method, device, terminal and readable medium

Publications (2)

Publication NumberPublication Date
CN109344091A CN109344091A (en)2019-02-15
CN109344091Btrue CN109344091B (en)2021-03-12

Family

ID=65307366

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201811147158.6AActiveCN109344091B (en)2018-09-292018-09-29 A buffer array regularization method, device, terminal and readable medium

Country Status (1)

CountryLink
CN (1)CN109344091B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN115033501B (en)*2022-06-302025-02-28苏州浪潮智能科技有限公司 A system, method, device and medium for invalidating cache data

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101621478A (en)*2009-08-072010-01-06中兴通讯股份有限公司Method and device for array dispatch
CN103544110A (en)*2013-10-082014-01-29华中科技大学Block-level continuous data protection method based on solid-state disc
CN104125168A (en)*2013-04-272014-10-29中兴通讯股份有限公司A scheduling method and system for shared resources
CN106095587A (en)*2016-06-242016-11-09北京金山安全软件有限公司Cache scanning method and device of application program and electronic equipment
US9900632B1 (en)*2016-12-302018-02-20Echostar Technologies L.L.C.Viewing suggestions based on closed-captioned content from multiple tuners

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US8656494B2 (en)*2012-02-282014-02-18Kaspersky Lab, ZaoSystem and method for optimization of antivirus processing of disk files
US9547604B2 (en)*2012-09-142017-01-17International Business Machines CorporationDeferred RE-MRU operations to reduce lock contention

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101621478A (en)*2009-08-072010-01-06中兴通讯股份有限公司Method and device for array dispatch
CN104125168A (en)*2013-04-272014-10-29中兴通讯股份有限公司A scheduling method and system for shared resources
CN103544110A (en)*2013-10-082014-01-29华中科技大学Block-level continuous data protection method based on solid-state disc
CN106095587A (en)*2016-06-242016-11-09北京金山安全软件有限公司Cache scanning method and device of application program and electronic equipment
US9900632B1 (en)*2016-12-302018-02-20Echostar Technologies L.L.C.Viewing suggestions based on closed-captioned content from multiple tuners

Also Published As

Publication numberPublication date
CN109344091A (en)2019-02-15

Similar Documents

PublicationPublication DateTitle
US10831547B2 (en)Accelerator control apparatus for analyzing big data, accelerator control method, and program
CN110427256B (en)Priority-based job scheduling optimization method, device, storage medium and apparatus
CN109597818A (en)Data-updating method, device, storage medium and equipment
CN113485822A (en)Memory management method, system, client, server and storage medium
CN115237582B (en)Method for processing multiple tasks, processing equipment and heterogeneous computing system
WO2020052322A1 (en)Data processing method, device and computing node
CN112114984B (en) Graph data processing method and device
US20160232037A1 (en)Latency-hiding context management for concurrent distributed tasks
CN113031864A (en)Data processing method and device, electronic equipment and storage medium
CN110543359A (en)Task queue running device
CN112559116B (en)Memory migration method and device and computing equipment
CN108304272B (en)Data IO request processing method and device
CN114218135A (en)Source end flow control method and system based on Redis cache
CN109344091B (en) A buffer array regularization method, device, terminal and readable medium
CN115617474A (en)Dependency task scheduling method for starting time perception facing edge calculation
CN120045298A (en)Front-end task scheduling and event processing method, device, equipment and storage medium
CN109284311B (en)Method and device for acquiring database connection
JP2016509306A (en) System and method for supporting work sharing multiplexing in a cluster
CN109992575A (en) Distributed storage system for big data
WO2025044585A1 (en)Memory-based data interaction method, processor, device, and medium
CN109062929A (en)A kind of query task communication means and system
CN108595270B (en)Memory resource recovery method and device
CN109408491B (en)Group regulation method, device, terminal and readable medium
CN105045938A (en) Method and system for concurrent access to metadata
CN116028226A (en)Quantum computing device-based DPDK component image data ordering method, storage device and intelligent terminal

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
TR01Transfer of patent right
TR01Transfer of patent right

Effective date of registration:20250115

Address after:806, 8th Floor, Building 7, No. 25 Xinyuan Street, Daxing District, Beijing 102600

Patentee after:Zhongshengjun (Beijing) Technology Co.,Ltd.

Country or region after:China

Address before:11 / F, building B1, phase 4.1, software industry, No.1, Software Park East Road, Wuhan East Lake Development Zone, Wuhan City, Hubei Province, 430070

Patentee before:WUHAN DOUYU NETWORK TECHNOLOGY Co.,Ltd.

Country or region before:China


[8]ページ先頭

©2009-2025 Movatter.jp