Methods, structures, electronic devices, and storage media for preserving order of multi-user events

By establishing multiple nodes in the storage structure to form a user chain, the problem of excessive storage space consumption in high-concurrency scenarios is solved, achieving user isolation and efficient storage space utilization.

CN120578348BActive Publication Date: 2025-10-28沐曦科技(成都)有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511072856.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-01
Publication Date
2025-10-28
Estimated Expiration
2045-08-01

AI Technical Summary

Technical Problem

In heterogeneous computing architectures, existing technologies suffer from excessive storage space consumption due to the increased number of queues in high-concurrency scenarios, which affects GPU performance and stability and limits the application expansion of GPUs in large-scale user concurrency scenarios.

Method used

By establishing multiple nodes in the storage structure, each node includes a first domain segment and a second domain segment, forming a user chain. The user chains are independent of each other, and the node operations are also independent, reducing the storage space occupation.

Benefits of technology

While achieving user isolation, it significantly reduces storage space usage and improves memory resource utilization and processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120578348B_ABST
    Figure CN120578348B_ABST
Patent Text Reader

Abstract

This invention relates to the field of chip design technology, and in particular to a method, structure, electronic device, and storage medium for pre-ordered storage of multi-user events. It establishes multiple nodes in the storage structure, each node including a first field segment of the address of the previous node in the current user chain, a service field segment, and a second field segment of the address of the next node in the current user chain. When a new node is added to the user chain, a free space in the storage structure is allocated to the new node. When the service of the node to be deleted or released is a thread, the position of the node is obtained, the previous node is found based on the first field segment, and the next node is found based on the second field segment. The previous and next nodes are then associated through their corresponding field segments to complete the deletion or release of the node. p,i When the node to be deleted or released is an event and the first field is the default value, the node is released, which significantly reduces the storage space occupied while achieving user isolation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of chip design technology, and in particular to a method, structure, electronic device, and storage medium for preserving order of multi-user events. Background Technology

[0002] In heterogeneous computing architectures, GPUs, as high-concurrency computing units, need to process computing tasks submitted by multiple users simultaneously. Each user instance can be allocated N asynchronous events and a maximum of M execution threads. However, GPU hardware has physical constraints on thread resources, limiting the maximum parallel thread capacity for all users to M. In this scenario, the current mainstream resource management solution adopts a user-based queue architecture, meaning that each user maintains its own independent queue. This approach, to a certain extent, ensures the independence and orderliness of user business processes, allowing each user's events and threads to be processed sequentially according to their own logical order, avoiding interference between different user business processes.

[0003] While the aforementioned queue isolation mechanism ensures the independence of user-level resource scheduling, it faces a severe storage resource bottleneck in high-concurrency scenarios. As the number of users increases, the number of queues that need to be created also grows linearly. Each user's queue requires a certain amount of storage space to store the elements in the queue and the queue's own management information. When the number of users reaches a certain scale, the storage space occupied by these queues becomes extremely large. This not only puts enormous pressure on the GPU's memory resources but may even lead to memory shortages, severely impacting the overall performance and stability of the GPU and limiting its application expansion in large-scale user concurrency scenarios. Therefore, a storage method with a smaller storage footprint is urgently needed. Summary of the Invention

[0004] To address the aforementioned technical problems, the present invention adopts the following technical solution: a method for preserving the order of multi-user events, the method comprising the following steps:

[0005] S100, establish multiple nodes in the storage structure, each node including a first domain segment of the address of the previous node in the user chain, a business domain segment, and a second domain segment of the address of the next node in the current user chain; configure default values ​​for the first and second domain segments of each node; wherein, the business is an event or a thread; all nodes in the chain are the business of the same user.

[0006] S200, when the user chain of the p-th user... p Add the i-th node p,i When this occurs, free locations in the storage structure are allocated to the node. p,i , will the node p,iThe first domain segment is updated to chain p The (i-1)th node p,i-1 The address; and the chain p Node p,i-1 The second domain segment is updated to the node. p,i The address; where 1≤p≤P, and P is the total number of users.

[0007] S300, when a node is to be deleted or released. p,i When the business is a thread, obtain the node. p,i The position, according to the node p,i Find the node in the first segment p,i-1 According to the node p,i Find the chain in the second field p The (i+1)th node p,i+1 , will the node p,i-1 The second domain segment is updated to the node. p,i+1 The address of the node p,i+1 The first domain segment is updated to the node. p,i-1 The address is used to complete the deletion or release of the node. p,i When the node to be deleted or released p,i When the event is an event, when the node p,i When the first domain segment is the default value, release the node. p,i .

[0008] Furthermore, this invention also provides a pre-ordered storage structure for multi-user events. The storage structure includes multiple nodes, each node comprising a first field segment of the address of the previous node in the user chain, a business field segment, and a second field segment of the address of the next node in the current user chain. The first and second field segments of each node are configured with default values. The business is an event or a thread. All nodes in the chain represent the business of the same user. A new node operation unit is added, used when the user chain of the p-th user... p Add the i-th node p,i When this occurs, free locations in the storage structure are allocated to the node. p,i , will the node p,i The first domain segment is updated to chain p The (i-1)th node p,i-1 The address; and the chain p Node p,i-1 The second domain segment is updated to the node. p,iThe address of the node. The delete and release node operation unit, used when a node is to be deleted or released. p,i When the business is a thread, obtain the node. p,i The position, according to the node p,i Find the node in the first segment p,i-1 According to the node p,i Find the chain in the second field p The (i+1)th node p,i+1 , will the node p,i-1 The second domain segment is updated to the node. p,i+1 The address of the node p,i+1 The first domain segment is updated to the node. p,i-1 The address is used to complete the deletion or release of the node. p,i When the node to be deleted or released p,i When the event is an event, when the node p,i When the first domain segment is the default value, release the node. p,i .

[0009] Furthermore, the present invention also provides a non-transitory computer-readable storage medium storing at least one instruction or at least one program segment, wherein the at least one instruction or the at least one program segment is loaded and executed by a processor to implement the above-described method.

[0010] In addition, the present invention provides an electronic device including a processor and the aforementioned non-transitory computer-readable storage medium.

[0011] The present invention has at least the following beneficial effects:

[0012] This invention provides a method, structure, electronic device, and storage medium for preserving the order of multi-user events. It establishes multiple nodes in the storage structure, each node including a first domain segment, a business domain segment, and a second domain segment. Nodes linked by the first and second domain segments form a user chain, with each user chain being independent of the others. Operations on nodes within a user chain are also independent. Compared to a scheme that establishes a storage structure for each user, this invention significantly reduces the storage space occupied while achieving user isolation. Attached Figure Description

[0013] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1 A flowchart of a multi-user event preservation storage method provided in an embodiment of the present invention;

[0015] Figure 2 The node provided in the embodiments of the present invention p,i When the business is a thread, delete or release the node. p,i A schematic diagram. Detailed Implementation

[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0017] Unless otherwise defined, all technical and scientific terms used in the embodiments of this invention have the same meaning as commonly understood by those skilled in the art.

[0018] Please see Figure 1 This invention provides a flowchart of a method for preserving the order of multi-user events, the method comprising the following steps:

[0019] S100, establish multiple nodes in the storage structure, each node including a first domain segment of the address of the previous node in the user chain, a business domain segment, and a second domain segment of the address of the next node in the current user chain; configure default values ​​for the first and second domain segments of each node; wherein, the business is an event or a thread; all nodes in the chain are the business of the same user.

[0020] In this storage structure, all nodes of the same user are linked together through the first and second domain segments of each node, thus establishing a user chain for each user. The user chains of different users are independent and do not interfere with each other. Due to the association between the first and second domain segments of a node, all nodes of the same user can be arbitrarily allocated positions in the storage structure without affecting the order of nodes in the user chain.

[0021] An event is an abstract representation of something that happens in the system, including external input, system state changes, or specific actions within the program. For example, external input could be a mouse click or keyboard input, system state changes could be file read / write completion or network connection establishment, and specific actions within the program could be function call completion or variable value change.

[0022] A thread is the smallest unit of program execution. As an example, a thread might perform data calculations or process a request.

[0023] In this system, the first and second domain segments of different user chains are independent of each other. That is, each domain segment includes its own start node and end node, with the first domain segment of the start node being the default value and the second domain segment of the end node being the default value.

[0024] In one implementation, the number of nodes in each user chain satisfies: 0 ≤ sum_node(chain) p )≤M+N, where sum_node(chain) p ) is the user chain of user p. p The total number of nodes in the chain, N is the chain number. p The maximum number of events is M, where M is the maximum number of business threads for nodes in a chain of P users, and P is the total number of users. It should be noted that the GPU's computing resources support a maximum of M threads. Therefore, P users can share M thread resources; either one user can occupy M thread resources while other users do not, or multiple users can share M thread resources—there is no limitation.

[0025] In one implementation, the first field stores a pointer to the address of the previous node in the chain, and the second field stores a pointer to the address of the next node in the chain.

[0026] As an example, the nodes stored sequentially in the storage structure are que={node 1,1 ,node 1,2 ,node 1,3 ,node 2,1 ,node 2,2 ,node 3,1 ,node 3,2 ,node 3,3 ,node 2,3 ,node 1,4 ,……}, where node p,i For the p-th user's user chain p The i-th node, where {node 1,1 ,node 1,2 ,node 1,3 ,node 1,4 The user chain for the first user is associated with the first and second domain segments in each node, where node 1,3 The business logic is event-driven, the rest are thread-driven; {node 2,1 ,node 2,2 ,node2,3} represents the user chain of the second user, and the business logic of each node is thread-based; {node 3,1 ,node 3,2 ,node 3,3 The `que` represents the user chain for the second user, where all nodes' business logic is thread-based. This example demonstrates that nodes from different users are stored together in the `que`, and nodes from the same user are linked into a user chain via the first and second domain segments. By creating a single storage structure for all users and storing all their business logic within that structure, compared to creating a separate storage structure for each user, user isolation is achieved while significantly reducing the storage space required.

[0027] For each user's user chain, the storage order of threads and events in the storage structure is based on preset rules.

[0028] S200, when the user chain of the p-th user... p Add the i-th node p,i When this occurs, free locations in the storage structure are allocated to the node. p,i , will the node p,i The first domain segment is updated to chain p The (i-1)th node p,i-1 The address; and the chain p Node p,i-1 The second domain segment is updated to the node. p,i The address; where 1≤p≤P, and P is the total number of users.

[0029] Wherein, the node p,i The second field is the default value; you only need to use node... p,i The first domain segment and node p,i-1 The second field segment will node p,i Related to chain p The S200 can associate each user's new node with the end of the corresponding user chain, thus completing the node addition. It should be noted that the end node of the user chain is not the end node in the storage structure.

[0030] In one implementation, in step S200, a free location in the storage structure is allocated to the node. p,iThe steps also include: finding a free position in the storage structure and allocating the least significant free position to the newly added node. For a single user chain, when a node is released, the position of the released node is updated to a free position; since nodes from multiple user chains are stored together in the same storage structure, the free position left after a node is released may appear in any position in the storage structure. Adding a node by finding a free position can effectively fill the free position, making the elements in the queue more compact and improving the utilization of memory space. At the same time, using the search for the least significant free position can directly utilize the existing free position, without the need for data migration to remove free positions, thus improving the efficiency of the addition operation.

[0031] S300, when a node is to be deleted or released. p,i When the business is a thread, obtain the node. p,i The position, according to the node p,i Find the node in the first segment p,i-1 According to the node p,i Find the chain in the second field p The (i+1)th node p,i+1 , will the node p,i-1 The second domain segment is updated to the node. p,i+1 The address of the node p,i+1 The first domain segment is updated to the node. p,i-1 The address is used to complete the deletion or release of the node. p,i When the node to be deleted or released p,i When the event is an event, when the node p,i When the first domain segment is the default value, release the node. p,i Please see. Figure 2 It shows when node p,i When the business is a thread, delete or release the node. p,i A schematic diagram, Figure 2 In the middle of the node p,i-1 The second field points to node p,i The gray arrow, and the node p,i The second field points to node p,i+1 The gray arrow indicates that a node has been deleted or released. p,i The previous user chain structure, marked with an "X" on the gray arrow, indicates a broken association after the update. (By node) p,i-1 The second field points to node p,i+1 The arrow indicates the deletion or release of a node. p,i Then recreate the node p,i-1 and nodep,i+1 The updated user chain structure is obtained from the relationships between them.

[0032] It should be noted that nodes whose business is thread-based can be released directly without preserving their order; after release, the previous and next nodes of the current node are simply associated. Events in a user chain can only be released after all business processes in that chain have been released, and the release of events must preserve their order. Preserving the order means that events are released sequentially according to their storage order. This invention identifies whether the first field of the event node to be released is a default value. When the first field is a default value, it indicates that the current event node is the first node in the current user chain, satisfying the requirement of preserving order, and can be released directly.

[0033] In one implementation, during step S300, the user chains of P users delete or release corresponding nodes in parallel, where P is the total number of users. This means the user chains are independent of each other and can execute related operations in parallel without interference, significantly improving processing efficiency.

[0034] In one implementation, in S300, when the node p,i Update to the chain p When the first node is, the node p,i The first field is the default value.

[0035] In summary, the embodiments of the present invention provide a method for preserving the order of multi-user events. This method establishes multiple nodes in the storage structure, each node including a first domain segment, a business domain segment, and a second domain segment. The nodes associated with the first and second domain segments form a user chain, and the user chains are independent of each other. The operations on the nodes in the user chains are also independent of each other. Compared with the scheme of establishing a storage structure for each user, the present invention significantly reduces the storage space occupied while achieving user isolation.

[0036] Based on the same inventive concept as the storage structure, the present invention also provides an ordered storage structure for multi-user events, the storage structure comprising: multiple nodes, a node addition operation unit, and node deletion and release operation units.

[0037] Furthermore, each of the multiple nodes includes a first domain segment of the address of the previous node in the user chain, a business domain segment, and a second domain segment of the address of the next node in the current user chain; the first and second domain segments of each node are configured with default values; wherein, the business is an event or a thread; all nodes in the chain are the business of the same user.

[0038] Furthermore, a new node operation unit is added for use when the p-th user's user chain... pAdd the i-th node p,i When this occurs, free locations in the storage structure are allocated to the node. p,i , will the node p,i The first domain segment is updated to chain p The (i-1)th node p,i-1 The address; and the chain p Node p,i-1 The second domain segment is updated to the node. p,i The address.

[0039] In one embodiment, the new node operation unit further includes a position allocation submodule, which is used to find a free position in the storage structure and allocate the least significant free position to the new node.

[0040] Furthermore, the delete and release node operation unit is used when a node is to be deleted or released. p,i When the business is a thread, obtain the node. p,i The position, according to the node p,i Find the node in the first segment p,i-1 According to the node p,i Find the chain in the second field p The (i+1)th node p,i+1 , will the node p,i-1 The second domain segment is updated to the node. p,i+1 The address of the node p,i+1 The first domain segment is updated to the node. p,i-1 The address is used to complete the deletion or release of the node. p,i When the node to be deleted or released p,i When the event is an event, when the node p,i When the first domain segment is the default value, release the node. p,i .

[0041] In one implementation, the node deletion and release operation unit further includes a concurrent processing module for deleting or releasing nodes on each user chain in parallel.

[0042] In summary, the embodiments of the present invention provide an ordered storage structure for multi-user events, which includes multiple nodes, a node addition operation unit, and node deletion and release operation units. Each node includes a first domain segment, a business domain segment, and a second domain segment. Nodes linked by the first and second domain segments form a user chain. The user chains are independent of each other, and the operations on nodes in the user chains are also independent of each other. Compared with the scheme of establishing a storage structure for each user, the present invention significantly reduces the storage space occupied while achieving user isolation.

[0043] Embodiments of the present invention also provide a non-transitory computer-readable storage medium that can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a method in the method embodiments, wherein the at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiments.

[0044] Embodiments of the present invention also provide an electronic device, including a processor and the aforementioned non-transitory computer-readable storage medium.

[0045] Embodiments of the present invention also provide a computer program product including program code, which, when the program product is run on an electronic device, causes the electronic device to perform the steps of the methods described above in various exemplary embodiments of the present invention.

[0046] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0047] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of this invention is defined by the appended claims.

Claims

1. A method for preserving the order of multi-user events, characterized in that, The method includes the following steps: S100, multiple nodes are established in the storage structure. Each node includes a first field segment of the address of the previous node in the user chain, a business field segment, and a second field segment of the address of the next node in the current user chain. Default values ​​are configured for the first and second field segments of each node. These default values ​​are used to identify the start or end of the chain. The business is an event or a thread. All nodes in the chain represent the business of the same user, and chains from different users are stored together in the storage structure. S200, when the user chain of the p-th user... p Add the i-th node p,i When this occurs, free locations in the storage structure are allocated to the node. p,i , will the node p,i The first domain segment is updated to chain p The (i-1)th node p,i-1 The address; and the chain p Node p,i-1 The second domain segment is updated to the node. p,i The address; where 1≤p≤P, and P is the total number of users; S300, when a node is to be deleted or released. p,i When the business is a thread, obtain the node. p,i The position, according to the node p,i Find the node in the first segment p,i-1 According to the node p,i Find the chain in the second field p The (i+1)th node p,i+1 , will the node p,i-1 The second domain segment is updated to the node. p,i+1 The address of the node p,i+1 The first domain segment is updated to the node. p,i-1 The address is used to complete the deletion or release of the node. p,i When the node to be deleted or released p,i When the event is an event, when the node p,i When the first domain segment is the default value, release the node. p,i .

2. The method according to claim 1, characterized in that, In S200, free locations in the storage structure are allocated to the node. p,i The steps also include: finding a free location in the storage structure and allocating the least significant free location to the newly added node.

3. The method according to claim 1, characterized in that, In S300, the user chains of P users delete or release the corresponding nodes in parallel.

4. The method according to claim 1, characterized in that, In S300, when the node p,i Update to the chain p When the first node is, the node p,i The first field is the default value.

5. The method according to claim 1, characterized in that, The number of nodes in each user chain satisfies: 0 ≤ sum_node(chain) p )≤M+N, where sum_node(chain) p ) is the user chain of user p. p The total number of nodes in the chain, N is the chain number. p The maximum number of events in the chain, M is the maximum number of business threads for nodes in the P user chains.

6. A multi-user event-preserving storage structure, characterized in that, The storage structure includes: Multiple nodes, each node including a first field segment of the address of the previous node in the user chain, a business field segment, and a second field segment of the address of the next node in the current user chain; the first and second field segments of each node are configured with default values, which are used to identify the start or end of the chain; wherein, the business is an event or a thread; all nodes in the chain are the business of the same user, and chains of different users are stored together in the storage structure; A new node operation unit is added to handle the user chain of the p-th user. p Add the i-th node p,i When this occurs, free locations in the storage structure are allocated to the node. p,i , will the node p,i The first domain segment is updated to chain p The (i-1)th node p,i-1 The address; and the chain p Node p,i-1 The second domain segment is updated to the node. p,i The address; The delete and release node operation unit is used when a node is to be deleted or released. p,i When the business is a thread, obtain the node. p,i The position, according to the node p,i Find the node in the first segment p,i-1 According to the node p,i Find the chain in the second field p The (i+1)th node p,i+1 , will the node p,i-1 The second domain segment is updated to the node. p,i+1 The address of the node p,i+1 The first domain segment is updated to the node. p,i-1 The address is used to complete the deletion or release of the node. p,i When the node to be deleted or released p,i When the event is an event, when the node p,i When the first domain segment is the default value, release the node. p,i .

7. The storage structure according to claim 6, characterized in that, The new node operation unit also includes a position allocation submodule, which is used to find a free position in the storage structure and allocate the least significant free position to the new node.

8. The storage structure according to claim 6, characterized in that, The node deletion and release operation unit also includes a concurrent processing module for deleting or releasing nodes on each user chain in parallel.

9. A non-transitory computer-readable storage medium, wherein the storage medium stores at least one instruction or at least one program segment, characterized in that, The at least one instruction or the at least one program segment is loaded and executed by the processor to implement the method as described in any one of claims 1-5.

10. An electronic device, characterized in that, Includes a processor and the non-transitory computer-readable storage medium as described in claim 9.

Citation Information

Patent Citations

  • Data storage method and device and block chain system

    CN111611321A

  • Management method and device of linked list queue, task management method and storage medium

    CN114579812A

  • Data order preserving method and device, computer equipment and storage medium

    CN119201835A