Distributed arbitration method and system, chip, equipment and storage medium
Through the distributed arbitration method, each node determines the arbitration result by itself, solving the problem of system unavailability caused by the failure of the centralized arbiter and improving the stability and reliability of the system.
Patent Information
- Application Number
- CN202310232631.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2024-09-10
Smart Images

Figure CN118626237A
Abstract
Description
Technical Field
[0001] The present disclosure relates to, but is not limited to, the field of computer technology, and in particular to a distributed arbitration method, system, chip, electronic device, and storage medium. Background Art
[0002] In the field of computer technology, when multiple modules share the same resource, an arbitrator is needed to decide who can use the shared resource, such as memory, processor, etc., input arbitration requests from each module, and output the determined authorization permission.
[0003] In some feasible solutions, an arbitrator is usually used for centralized arbitration. The requesting party initiates an arbitration request (req) to the arbiter, and the arbiter responds (ack) to the requesting party that succeeds in the arbitration according to the arbitration result. Figure 1 As shown in the figure, it can be seen that the centralized arbitration scheme requires the additional design of an arbitrator. Once the arbitrator crashes, the relevant arbitration requesters cannot work normally. In order to meet the design needs of more and more parallel and shared systems, it is necessary to provide an arbitration scheme with higher fault tolerance to improve the stability and reliability of the overall system. Summary of the invention
[0004] The embodiments of the present disclosure provide a distributed arbitration method, system, chip, electronic device and storage medium. No central arbitrator is required. Each request node aggregates arbitration requests and determines the arbitration result by itself. The distributed self-arbitration method avoids the unavailability of the entire system caused by the failure of the central arbitrator, significantly improves the fault tolerance of the arbitration scheme, and thus improves the reliability of the entire system.
[0005] The present disclosure provides a distributed arbitration method, which is applied to a first node and includes:
[0006] receiving a second arbitration request from a second node;
[0007] An arbitration result is determined according to the priority of the first arbitration request generated by the first node and the priority of the second arbitration request.
[0008] The present disclosure also provides a distributed arbitration system, including:
[0009] a first node, one or more second nodes;
[0010] The first node is configured to receive an arbitration request from the second node;
[0011] The first node is further configured to determine an arbitration result according to a priority of an arbitration request generated by itself and a priority of an arbitration request of the second node.
[0012] The present disclosure also provides a chip, including a processor, wherein the processor is configured to:
[0013] Execute the distributed arbitration method as described in any embodiment of the present disclosure.
[0014] The present disclosure also provides an electronic device, including:
[0015] one or more processors;
[0016] a storage device for storing one or more programs,
[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the distributed arbitration method as described in any embodiment of the present disclosure.
[0018] An embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the distributed arbitration method as described in any embodiment of the present disclosure is implemented.
[0019] Other aspects will be apparent upon reading and understanding the drawings and detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0021] Figure 1 Schematic diagrams of some feasible arbitration schemes;
[0022] Figure 2 A flow chart of a distributed arbitration method provided by an embodiment of the present invention;
[0023] Figure 3 A flow chart of another distributed arbitration method provided by an embodiment of the present invention;
[0024] Figure 4 A flow chart of another distributed arbitration method provided by an embodiment of the present invention;
[0025] Figure 5 A flow chart of another distributed arbitration method provided by an embodiment of the present invention;
[0026] Figure 6 A flow chart of another distributed arbitration method provided by an embodiment of the present invention;
[0027] Figure 7 A flow chart of another distributed arbitration method provided by an embodiment of the present invention;
[0028] Figure 8 A schematic diagram of a distributed arbitration system provided by an embodiment of the present invention;
[0029] Fig. 9 A schematic diagram of another distributed arbitration system provided by an embodiment of the present invention;
[0030] Fig.10 A schematic diagram of multi-node arbitration results in a distributed arbitration system provided by an embodiment of the invention.
[0031] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] It should be noted that in the present invention, descriptions such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0034] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0035] like Figure 1In the central arbitrator scheme shown, each module A, B, and C competing for public resources (also called requesting public resources) sends an arbitration request to the central arbitrator (Arbiter), which determines the arbitration result according to the relevant arbitration rules and returns a permission response to the requester A, B, or C who has obtained the arbitration permission (grant). The requester who has obtained the permission response obtains the right to use the public resources. When the arbitrator (Arbiter) fails, it cannot process the arbitration requests of all parties and determine the arbitration result, which will result in the inability of each requester to obtain the authorization license normally, and the subsequent functions cannot continue to be executed, resulting in the overall unavailability of the relevant system.
[0036] The embodiment of the present disclosure provides a distributed arbitration solution, which does not require a central arbitrator, and each requesting node determines the arbitration result in a distributed manner, thereby eliminating the risk of system crash caused by a central arbitrator failure.
[0037] The embodiment of the present disclosure provides a distributed arbitration method, which is applied to a first node, such as Figure 2 As shown, including:
[0038] Step 210, receiving a second arbitration request from a second node;
[0039] Step 220: Determine an arbitration result according to the priority of the first arbitration request generated by the first node and the priority of the second arbitration request.
[0040] In some exemplary embodiments, the second node includes one or more nodes, and accordingly, the received second arbitration request also includes one or more nodes.
[0041] It should be noted that the first arbitration request, the second arbitration request, the third arbitration request and the fourth arbitration request in the disclosed embodiment represent arbitration requests generated or sent by nodes in different scenarios, without any priority difference, and are collectively referred to as arbitration requests. The first node, the second node and the third node in the disclosed embodiment represent different logical nodes for initiating arbitration requests or executing arbitration tasks, which are relative concepts without any priority difference, and are collectively referred to as nodes; each node can be coupled or associated with one or more electronic devices, smart terminals or network interconnection devices. In some embodiments, each node can be specifically implemented as a software module, a process or a hardware module, an electronic device, etc., and is not limited to a specific aspect.
[0042] In some exemplary embodiments, in step 220, determining an arbitration result according to the priority of the first arbitration request generated by the first node and the priority of the second arbitration request includes:
[0043] determining an arbitration result according to the priorities of the first arbitration request and all received valid second arbitration requests;
[0044] The valid arbitration request includes: an arbitration request received within the set arbitration validity period, or an arbitration request that has not been revoked.
[0045] The set arbitration validity period is determined as needed and is not limited to specific aspects. It can be understood that in this embodiment, if the arbitration request of a node is not received again after the arbitration validity period, it is determined that the node does not need to participate in arbitration temporarily, that is, it does not participate in the competition for public resources temporarily. Alternatively, if a revocation request is received from a node, it is determined that the node revokes the arbitration request it has sent and does not participate in the competition for public resources temporarily; if the node needs to apply for arbitration again, it resends a new arbitration request.
[0046] In some exemplary embodiments, a set triggering event triggers the execution of step 220 .
[0047] In some exemplary embodiments, the set triggering event includes: the arrival of the periodic arbitration time. More triggering events are determined according to system design requirements and are not listed one by one here.
[0048] In some exemplary embodiments, Figure 3 As shown, the method also includes:
[0049] Step 230: Send the first arbitration request to the second node.
[0050] In some exemplary embodiments, the first node determines the priority of the first arbitration request generated by itself according to the current priority stored locally; in some exemplary embodiments, the priority of the first arbitration request generated by itself is equal to the current priority stored locally. Accordingly, the first arbitration request sent by the first node to one or more second nodes in step 230 includes the priority (information). It can be understood that the received second arbitration request also includes the priority (information).
[0051] In some exemplary embodiments, in step 230, the sending of the first arbitration request to the second node may be sent once; or may be sent multiple times according to a set sending strategy. For example, under a periodic sending strategy, the first arbitration request is sent periodically according to a set interval. More sending strategies are not exemplified here.
[0052] In some exemplary embodiments, Figure 4 As shown, the method also includes:
[0053] Step 240: if the arbitration result indicates that the first node obtains arbitration permission, update the priority of the sent first arbitration request to an occupied priority;
[0054] The occupation priority is higher than the priority of the second arbitration request.
[0055] In some exemplary embodiments, the occupancy priority is a preset priority.
[0056] In some exemplary embodiments, when there are multiple second nodes, the occupation priority is higher than the priorities of all second arbitration requests.
[0057] In some exemplary embodiments, the priority is indicated by a natural number, and the larger the number, the higher the priority. Alternatively, other methods may be used to indicate the priority, which is not limited to a specific aspect.
[0058] In some exemplary embodiments, if the priority of the arbitration request is greater than 0 and less than P, the occupied priority is greater than or equal to P, where P is an integer greater than 1. It can be seen that the occupied priority can be set to be higher than the priority of the arbitration request sent by each node. It can be seen that the priority of the first arbitration request sent after the update is the highest priority, and other nodes that receive the arbitration request cannot successfully arbitrate and obtain arbitration permission when performing their respective local arbitrations. This avoids possible arbitration permission conflicts under the distributed arbitration scheme.
[0059] In some exemplary embodiments, the method further comprises:
[0060] Based on determining that the first priority of the first arbitration request is the same as the priority of the second arbitration request and / or the first arbitration request conflicts with the second arbitration request, adjusting the first priority to a second priority;
[0061] The second priority is a random value priority that is different from the priority of the second arbitration request.
[0062] It can be understood that in some exemplary embodiments, the priority of the first arbitration request may not be fixed. The priority of the first arbitration request initiated for the same public resource contention first participates in arbitration with the first priority. When the first priority of the first arbitration request is the same as the priority of the second arbitration request and / or the first arbitration request conflicts with the second arbitration request, the priority of the first arbitration request is adjusted to the second priority. After the adjustment, the first arbitration request participates in arbitration with the second priority to determine the arbitration result. That is, the priority of the first arbitration request includes: the first priority or the second priority. Among them, the first priority includes the configuration priority or current priority of each node.
[0063] The conflict between the first arbitration request and the second arbitration request includes multiple situations, for example, judging whether the first arbitration request and the second arbitration request conflict based on the information indicating the occupancy time carried in the arbitration request; or judging whether the first arbitration request and the second arbitration request conflict based on the information indicating other occupancy attributes carried in the arbitration request. More examples of judging whether the first arbitration request and the second arbitration request conflict are not discussed in detail here, and can be judged according to relevant arbitration rules.
[0064] In some exemplary embodiments, the method further comprises:
[0065] Step 200, storing the configuration priority and current priority of the arbitration request of this node; wherein the current priority is used to determine the priority of the first arbitration request sent, and the initial value of the current priority is the configuration priority.
[0066] It can be understood that each node stores its own configuration priority and current priority. The configuration priorities of different nodes may be the same or different, and may be pre-set according to the application requirements of each node or reset after dynamic determination; or may be independently set according to the requested public resources or reset after dynamic determination. The current priority of each node indicates the priority of the arbitration request currently generated by this node. According to the scheme provided by some exemplary embodiments of the present disclosure, the current priority of each node may change according to the arbitration result and / or the end of occupation of the requested public resources. The current priorities of different nodes may be the same or different.
[0067] In some exemplary embodiments, Figure 5 As shown, the method also includes:
[0068] Step 250: when the arbitration result indicates that the first node obtains arbitration permission, based on determining that the first node releases public resources, updating the current priority of the first node to an idle priority, and starting a first timer;
[0069] Wherein, the idle priority is lower than the priority of the second arbitration request;
[0070] After the first timer times out, the current priority is restored to the configuration priority of the first node.
[0071] In some exemplary embodiments, when the first timer has not timed out, the current priority remains as the idle priority. The timeout duration of the first timer is flexibly set as needed, and can be a preset fixed duration, or a duration determined according to the occupation characteristics of the requested public resources, or a variable duration dynamically determined according to the total number of requesting nodes and / or the frequency of arbitration requests, and is flexibly selected as needed and is not limited to specific aspects.
[0072] In some exemplary embodiments, when there are multiple second nodes, the idle priority is lower than the priorities of all second arbitration requests.
[0073] In some exemplary embodiments, the priority of the arbitration request is greater than 0 and less than P, and the idle priority is less than or equal to 0. For example, the idle priority is 0. It can be seen that the idle priority can be set to be lower than the arbitration request priority sent by each node.
[0074] In some exemplary embodiments, step 250 includes: when the arbitration result indicates that the first node obtains arbitration permission, after the first node releases the public resources, the current priority is updated to the set idle priority. Accordingly, when the node generates an arbitration request next time according to the updated current priority, the first timer is started, so that the current priority remains at the idle priority before the first timer times out.
[0075] It can be seen that the node that has obtained arbitration permission updates its current priority, and starts the first timer after the update or when the arbitration request is generated again, so that before the first timer times out, the priority of the arbitration request generated again by the node is the idle priority, which is lower than or equal to the priority of the arbitration request generated by other nodes, thereby effectively preventing the node from obtaining arbitration permission again. Especially for nodes with higher configuration priorities, this method can greatly reduce the possibility of higher priority nodes monopolizing public resources, and improve the rationality of the arbitration scheme.
[0076] In some exemplary embodiments, Figure 6 As shown, the method also includes:
[0077] Step 260: When the arbitration result indicates that the first node obtains arbitration permission, the first node releases the public resources and cancels the first arbitration request. That is, after obtaining arbitration permission, the first node occupies the contested public resources, releases the public resources after the occupation ends, and cancels the arbitration request.
[0078] In some exemplary embodiments, revoking the first arbitration request includes: deleting the first arbitration request generated locally, and sending a revocation request to other nodes.
[0079] It can be understood that the withdrawal of the arbitration request indicates that the node will not participate in the competition for public resources temporarily, will not make arbitration judgments on its own, and will not obtain arbitration permission; other nodes will also exclude this node when conducting arbitration in their respective local areas, and the arbitration requests sent by this node will not participate in the arbitration conducted by other nodes in their local areas.
[0080] It should be noted that, in the embodiment of the present disclosure, each node may send an arbitration request or a revocation request to other nodes by broadcasting or by unicasting, and is not limited to a specific sending method.
[0081] In some exemplary embodiments, determining the arbitration result according to the priority of the first arbitration request generated by the first node and the priority of the second arbitration request includes:
[0082] (1) when the priority of the first arbitration request is greater than the priority of the second arbitration request, the arbitration result indicates that the first node obtains arbitration permission;
[0083] (2) when the priority of the first arbitration request is lower than the priority of the second arbitration request, the arbitration result indicates that the first node has not obtained arbitration permission;
[0084] (3) When the priority of the first arbitration request is equal to the priority of the second arbitration request, randomly select an alternative priority level different from the priority level of the second arbitration request within a priority configuration range; and determine an arbitration result based on the alternative priority level and the priority level of the second arbitration request.
[0085] In some exemplary embodiments, when the second node includes multiple nodes and receives second arbitration requests from multiple second nodes, when the priority of the first arbitration request is greater than the priorities of all the second arbitration requests, the arbitration result indicates that the first node obtains arbitration permission; when the priority of the first arbitration request is less than the priority of any second arbitration request, the arbitration result indicates that the first node does not obtain arbitration permission; when the priority of the first arbitration request is equal to the highest priority of all the second arbitration requests, an alternative priority different from the priorities of each second arbitration request is randomly selected within the priority configuration range, and the arbitration result is determined based on the alternative priority and the priority of the second arbitration request.
[0086] It can be understood that, in this case, the alternative priority is the second priority of the first arbitration request. It should be noted that the first priority, second priority, and alternative priority recorded in the embodiments of the present disclosure are used to distinguish and describe different values of the first arbitration request in different situations during the arbitration process, and do not represent the high and low relationship of specific priorities.
[0087] In some exemplary embodiments, the priority configuration range is greater than a set idle priority and less than a set occupied priority.
[0088] It can be understood that according to the priority of the first arbitration request and the priority of the second arbitration request, the above arbitration strategy is used to determine the arbitration result, which means that the node that generates the arbitration request with a higher priority will obtain arbitration permission and obtain the authorization to occupy the requested public resources; the nodes that generate the arbitration request include: the first node and one or more second nodes. As a result, the current (first) node can complete the arbitration without the help of a central arbitrator; similarly, other nodes also adopt a similar scheme to determine the arbitration result based on the priority of the first arbitration request generated by themselves and the second arbitration request received from other (second) nodes. Because it is based on the same arbitration principle, although each node performs arbitration judgment in a distributed manner, it can obtain a consistent arbitration result. It not only achieves the purpose of arbitration, but also avoids the reliability bottleneck or performance bottleneck of the central arbitrator.
[0089] In some exemplary embodiments, during the process of determining the arbitration result, when situation (3) indicates that the arbitration request of the current node and at least one of all other nodes requesting arbitration have the same highest priority, a random strategy is used to select an alternative priority temporarily adopted in this arbitration, and this alternative priority is used as the priority of the first arbitration request in the arbitration determination process, and then the arbitration result is determined according to situation (1) or (2). In a special case, when the alternative priority is still the same as the highest priority of at least one other node, another alternative priority is selected again according to the random strategy until the arbitration result is determined.
[0090] In some exemplary embodiments, the randomly selecting a replacement priority level different from the priority level of each second arbitration request within a priority configuration range comprises:
[0091] According to a set floating range and the priority of the first arbitration request, a priority different from each of the second arbitration requests is randomly selected within a priority configuration range to replace the priority.
[0092] For example, the priority configuration range is: greater than 0 and less than 16, and the floating range is 3, which means it can float up and down by 3. The priority of the first arbitration request generated by itself is 7, then the replacement priority is: a number randomly determined between 7-3 and 7+3; for another example, the priority of the arbitration request generated by itself is 14, then the replacement priority is: a number randomly determined between 14-3 and 16. More examples are not recorded here one by one. The floating range set by each node can be the same range or different ranges, and is not limited to specific aspects.
[0093] In some exemplary embodiments, the method further comprises: when the arbitration result determined according to the substitute priority indicates that the first node has not obtained arbitration permission, the first node updates the local current priority to the substitute priority and starts a second timer;
[0094] After the second timer times out, the current priority is restored to the configuration priority of the first node.
[0095] In some exemplary embodiments, the method further includes: when the arbitration result determined according to the alternative priority indicates that the first node has not obtained arbitration permission, the first node updates the priority of the first arbitration request sent to the alternative priority. It can be seen that the first node updates and sends the temporarily selected priority, so that when other nodes perform their respective local arbitrations, the probability of the same highest priority is reduced, thereby improving the execution efficiency of the overall distributed arbitration scheme. Optionally, the first node may not update the local current priority and send it, maintain the original current priority, and other nodes independently perform the highest priority conflict processing. Due to the use of a random selection strategy, there is a conflict again after random selection, or the probability of arbitration errors in the arbitration results determined after random selection of different nodes is extremely small. The random algorithm ensures that the probability of arbitration errors is less than the set availability requirements. The specific aspects of the random algorithm are not discussed in detail here.
[0096] In some exemplary embodiments, Figure 7 As shown, the method also includes:
[0097] Step 280, detecting the arbitration results of the other nodes, and determining the duration of the arbitration permission obtained by the other nodes;
[0098] Accordingly, the priority of the first arbitration request generated by the first node and the priority of the second arbitration request in step 220 determine the arbitration result, including:
[0099] After excluding the second nodes whose arbitration permission has been obtained for a time period longer than the set occupation time threshold TH, the arbitration result is determined according to the priority of the first arbitration request and the priority of the second arbitration request of the remaining second nodes after the exclusion.
[0100] In some exemplary embodiments, the other nodes include one or more.
[0101] In some exemplary embodiments, the other nodes include: a second node and / or a third node.
[0102] In some exemplary embodiments, the method further comprises:
[0103] When it is determined that the time length for which any node has obtained arbitration permission is greater than the set occupation time length threshold TH, an alarm message is generated.
[0104] It can be understood that the current node and each other node all use the solution provided by the embodiment of the present disclosure to perform their own local arbitration, and notify other nodes when obtaining arbitration permission; therefore, each node can know which node has obtained arbitration permission at the current moment, and can also know the time when it obtained arbitration permission. By detecting the arbitration results of each of the other nodes and recording the time when the node that obtained arbitration permission obtained the arbitration permission, it is possible to determine how long it has obtained arbitration permission. When a node that has obtained arbitration permission fails and fails to normally revoke the arbitration request to notify other nodes that it has released public resources, in order to avoid the unavailability of the overall arbitration mechanism, each node can eliminate the faulty node based on the detection of the arbitration results of other nodes, and then perform local arbitration.
[0105] In some exemplary embodiments, the method further comprises:
[0106] The third arbitration request from the third node and / or the fourth arbitration request from the second node are blocked until the arbitration result is determined.
[0107] Wherein, the third node includes one or more, and correspondingly, the third arbitration request also includes one or more. The third node is a node different from the first node and the second node. It can be understood that when each node has an arbitration demand, it generates an arbitration request and sends it to other nodes, and when there is no arbitration demand, it does not generate an arbitration request. The fourth arbitration request of the second node is an arbitration request different from the second arbitration request, representing a new arbitration request from the second node, such as an arbitration request with a different priority. When the first node generates a first arbitration request and receives a second arbitration request sent by one or more second nodes, it conducts arbitration. Before the arbitration result is determined, if the request of the third node and / or the fourth arbitration request of the second node is received, these requests need to be blocked and a new arbitration is conducted after the result of the previous arbitration is determined.
[0108] In some exemplary embodiments, the method further comprises:
[0109] After the fault is recovered, the arbitration request generated by itself is cancelled.
[0110] Since the current node fails, the arbitration request cannot be revoked normally. Therefore, after the failure is recovered, the previous arbitration request is revoked first to notify other nodes that it has returned to normal.
[0111] The present disclosure also provides a distributed arbitration system. Figure 8 As shown, including:
[0112] A first node 810, one or more second nodes 820;
[0113] The first node 810 is configured to receive an arbitration request from the second node 820;
[0114] The first node 810 is further configured to determine an arbitration result according to the priority of the arbitration request generated by itself and the priority of the arbitration request of the second node 820 .
[0115] In some exemplary embodiments, the first node 810 is further configured to send the arbitration request generated by itself to the second node 820 .
[0116] In some exemplary embodiments, when multiple second nodes 820 are included, the first node 810 receives arbitration requests from one or more second nodes 820, and determines the arbitration result based on the priority of the arbitration request generated by itself and the priority of all received arbitration requests from the one or more second nodes 820.
[0117] In some exemplary embodiments, the second node 820 is configured to receive arbitration requests from the first node and other second nodes 820; and is also configured to determine the arbitration result based on the priority of the arbitration request generated by itself and the priority of the arbitration requests of the first node 810 and other second nodes 820.
[0118] It can be understood that the first node and the second node in the embodiment of the present disclosure are relative concepts and are equivalent logical nodes in the arbitration scheme proposed in the present application. The "each node" recorded in the embodiment of the present disclosure includes each of the first node and the second node.
[0119] It should be noted that, unless otherwise specified, the arbitration request described in the embodiments of the present disclosure is an arbitration request for competition for the same public resource. If a node initiates arbitration for multiple public resources multiple times, arbitration is performed independently for each public resource. The specific content of the arbitration request is flexibly determined as needed and is not limited to a specific form. The specific aspects are not discussed in detail in this application. The public resources competed for by each section can be hardware resources or software resources, such as hardware modules, time slots, files, etc., and are not limited to specific aspects.
[0120] In some exemplary embodiments, when the public resource includes multiple resources, it means that multiple requesting parties can obtain arbitration permission, and the arbitration strategy used when determining the arbitration result in step 220 is adjusted accordingly, and multiple requesting parties can also succeed in local arbitration at the same time, obtain arbitration permission, and then occupy multiple public resources respectively. According to the embodiments recorded in the present disclosure, the detailed aspects of the solution can be determined.
[0121] In some exemplary embodiments, Fig. 9As shown, the requesting parties participating in the arbitration include three nodes: A, B, and C. When A is the first node, B and C are the second nodes; when B is the first node, A and C are the second nodes. When A, B, and C each generate an arbitration request, they send the arbitration request to other nodes. A, B, and C each locally execute the distributed arbitration method described in any embodiment of the present disclosure and determine the arbitration result based on the priority.
[0122] In some exemplary embodiments, the configuration priority of A (also called the default priority) is 0x3, the configuration priority of B (also called the default priority) is 0x2, and the configuration priority of C (also called the default priority) is 0x1. The priority configuration range is: greater than 0x0 and less than 0xF. The set idle priority is 0x0, and the set occupied priority is 0xF. A, B, and C generate and send arbitration requests at time T1 at the same time; each node performs arbitration judgment at each rising edge of the clock. The entire arbitration process, such as Fig.10 As shown:
[0123] A, B, and C simultaneously make arbitration requests at time point T1, and A has the highest priority. Therefore, A determines that its arbitration is successful, that is, it obtains arbitration permission, and increases the priority of the arbitration request sent to 0xF. After A completes the processing, it adjusts the current priority to the idle priority 0xF and cancels the arbitration request. After the first timer times out, arbitration is initiated with the configured priority 0x3 when there is a new arbitration request. At T1, in the arbitration judgments made locally by B and C, because the priority of the arbitration requests generated by B and C themselves is lower than the arbitration request received from A, their arbitration results are all failures, and arbitration permission is not obtained. Therefore, after obtaining arbitration permission, A begins to occupy the requested public resources for related processing (processing). B and C do not obtain arbitration permission and cannot occupy the requested public resources for related processing.
[0124] After A completes the processing at time T2, B has the highest priority, so B determines that its arbitration is successful, that is, it obtains arbitration permission, and increases the priority of the arbitration request sent to 0xF. After the processing is completed, the current priority is adjusted to the idle priority 0xF, and the arbitration request is revoked. After the first timer times out, arbitration is initiated with the configured priority 0x2 when there is a new arbitration request. At T2, because A did not generate an arbitration request, or A's first timer did not time out, C did not receive A's new arbitration request or the priority of the new arbitration request received was 0xF; in the arbitration judgment conducted locally by C, because the priority of the arbitration request generated by C itself was lower than the arbitration request received from B, its arbitration result was a failure and no arbitration permission was obtained. Therefore, after obtaining the arbitration permission, B began to occupy the requested public resources for related processing (processing). C did not obtain the arbitration permission and could not occupy the requested public resources for related processing.
[0125] After B completes the processing, at time T3, only C is requesting arbitration. C determines that it has successfully arbitrated and increases the priority to P = 0xF. After C completes the processing, it adjusts the current priority to the idle priority 0xF and cancels the arbitration request. When there is a new arbitration request, arbitration is initiated with the configured priority 0x1.
[0126] The present disclosure also provides a chip, including a processor, wherein the processor is configured to:
[0127] Execute the distributed arbitration method as described in any embodiment of the present disclosure.
[0128] The present disclosure also provides an electronic device, including:
[0129] one or more processors;
[0130] a storage device for storing one or more programs,
[0131] When the one or more programs are executed by the one or more processors, the one or more processors implement the distributed arbitration method as described in any embodiment of the present disclosure.
[0132] An embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the distributed arbitration method as described in any embodiment of the present disclosure is implemented.
[0133] The distributed arbitration method provided by the present disclosure eliminates the central arbitrator, thereby eliminating the risk of system crash caused by the failure of the central arbitrator, and significantly improving the reliability of the arbitration scheme. In some exemplary embodiments, abnormal requesting parties can be temporarily removed when detected, which can further improve the robustness of the arbitration scheme.
[0134] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0135] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.
Claims
1. A distributed arbitration method, applied to a first node, characterized in that: include: receiving a second arbitration request from a second node; An arbitration result is determined according to the priority of the first arbitration request generated by the first node and the priority of the second arbitration request.
2. The distributed arbitration method according to claim 1, characterized in that: Also includes: The first arbitration request is sent to the second node.
3. The distributed arbitration method according to claim 2, characterized in that: Also includes: When the arbitration result indicates that the first node obtains arbitration permission, updating the priority of the sent first arbitration request to an occupied priority; The occupation priority is higher than the priority of the second arbitration request.
4. The distributed arbitration method according to claim 1, characterized in that: Also includes: Based on determining that the first priority of the first arbitration request is the same as the priority of the second arbitration request and / or the first arbitration request conflicts with the second arbitration request, adjusting the first priority to a second priority; The second priority is a random value priority that is different from the priority of the second arbitration request.
5. The distributed arbitration method according to claim 1, characterized in that: Also includes: The third arbitration request from the third node and / or the fourth arbitration request from the second node are blocked until the arbitration result is determined.
6. The distributed arbitration method according to claim 2, characterized in that: Also includes: In a case where the arbitration result indicates that the first node obtains arbitration permission, based on determining that the first node releases public resources, updating the current priority of the first node to an idle priority, and starting a first timer; wherein the idle priority is lower than the priority of the second arbitration request; After the first timer times out, the current priority is restored to the configuration priority of the first node.
7. The distributed arbitration method according to any one of claims 1 to 6, characterized in that: Also includes: When the arbitration result indicates that the first node obtains arbitration permission, the first node releases the public resources and then withdraws the first arbitration request.
8. The distributed arbitration method according to any one of claims 1 to 6, characterized in that: The determining the arbitration result according to the priority of the first arbitration request generated by the first node and the priority of the second arbitration request includes: In a case where the priority of the first arbitration request is greater than the priority of the second arbitration request, the arbitration result indicates that the first node obtains arbitration permission; In a case where the priority of the first arbitration request is lower than the priority of the second arbitration request, the arbitration result indicates that the first node has not obtained arbitration permission; When the priority of the first arbitration request is equal to the priority of the second arbitration request, a substitute priority different from the priority of the second arbitration request is randomly selected within a priority configuration range; and an arbitration result is determined according to the substitute priority and the priority of the second arbitration request.
9. The distributed arbitration method according to any one of claims 1 to 3, characterized in that: Also includes: Detecting arbitration results of other nodes and determining the duration of arbitration permission obtained by the other nodes; The determining the arbitration result according to the priority of the first arbitration request generated by the first node and the priority of the second arbitration request includes: After excluding the second nodes whose arbitration permission has been obtained for a time period longer than the set occupation time threshold, the arbitration result is determined according to the priority of the first arbitration request and the priority of the second arbitration request of the remaining second nodes after the exclusion.
10. A distributed arbitration system, characterized in that: include: a first node, one or more second nodes; The first node is configured to receive an arbitration request from the second node; The first node is further configured to determine an arbitration result according to a priority of an arbitration request generated by itself and a priority of an arbitration request of the second node.
11. A chip, characterized in that: comprising a processor configured to: Execute the distributed arbitration method as described in any one of claims 1 to 9.
12. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the distributed arbitration method according to any one of claims 1 to 9.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the distributed arbitration method according to any one of claims 1 to 9 is implemented.
