Communication method and computing device

By monitoring and dynamically coordinating the working status and load rate of the communication bus, the problem of low transit communication efficiency of the relay object is solved, and a more efficient communication process is achieved.

CN119271435APending Publication Date: 2025-01-07XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411392159.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

In the communication process based on relay object relay, the communication efficiency is low, resulting in a decrease in communication efficiency between the communication objects.

Method used

By monitoring the operating state and communication load rate of the first communication bus, dynamically coordinate the communication bus between the first object and the second object, and create a second communication bus to replace or coordinate the first communication when the non-available state or the load rate is high. Bus, avoid waste of resources and reduced efficiency.

Benefits of technology

It improves the communication efficiency between communication objects, reduces resource overhead, and ensures the stability and efficiency of the communication process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271435A_ABST
    Figure CN119271435A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a communication method and computing equipment, a first object and a second object run in the computing equipment, the method comprises the following steps: determining a communication load rate and a working state of a first communication bus, the first communication bus being used for independent communication between the first object and the second object, the communication load rate is used for indicating the resource occupation proportion of the first communication bus; and under the condition that the working state is a non-available state or the communication load rate is greater than a first threshold value, establishing a second communication bus for independent communication between the first object and the second object, and performing coordination processing on the first communication bus through the second communication bus, the non-available state is used for indicating that the first object cannot normally communicate with the second object through the first communication bus. According to the communication method, the communication bus between the first object and the second object can be dynamically coordinated, so that efficient communication between the first object and the second object is realized on the basis of occupying less resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communication technology, and in particular, to a communication method and a computing device. Background Art

[0002] The communication bus can be used to implement various complex inter-object communication tasks in a computing device. For example, the communication bus can be a D-Bus bus, which is an advanced inter-process communication mechanism that can be used to implement various complex inter-process communication tasks in a computing device.

[0003] In the related art, a communication bus may be connected to multiple communication objects and relay objects, and the communication messages of multiple communication objects may be transferred through the relay object to realize the communication process between multiple communication objects. For example, the relay object may be a D-Bus daemon.

[0004] However, when the communication messages between any two communication objects are transferred based on the relay object, the communication efficiency between the two communication objects may be low. Summary of the invention

[0005] The embodiments of the present application provide a communication method and a computing device, which can improve the communication efficiency between communication objects.

[0006] In a first aspect, an embodiment of the present application provides a communication method, which is applied to a computing device, wherein a first object and a second object are running in the computing device, and the method includes:

[0007] Determine a communication load rate and a working state of a first communication bus, the first communication bus being used for independent communication between a first object and a second object, the communication load rate being used to indicate a resource occupancy ratio of the first communication bus;

[0008] When the working state is an unavailable state or the communication load rate is greater than a first threshold, a second communication bus for independent communication between the first object and the second object is established, and the first communication bus is coordinated through the second communication bus. The unavailable state is used to indicate that the first object cannot communicate normally with the second object through the first communication bus.

[0009] In the above technical solution, the communication bus between the first object and the second object can be dynamically coordinated by monitoring the working state and communication load rate of the first communication bus, so as to realize efficient communication between the first object and the second object on the basis of occupying fewer resources. When the working state is an available state or the communication load rate of the first communication bus is less than or equal to the first threshold, it is not necessary to establish a second communication bus between the first object and the second object, so as to avoid the communication process between the first object and the second object occupying more resources, which is conducive to reducing resource overhead; when the working state is an unavailable state or the communication load rate of the first communication bus is greater than the first threshold, the second communication bus is created in time, and the first communication bus is coordinated by the second communication bus, which can avoid the first communication bus being unavailable or the processing efficiency being low, resulting in a decrease in the communication efficiency of the first object and the second object, which is conducive to improving communication efficiency.

[0010] In a possible implementation, determining a communication load rate and an operating state of the first communication bus includes:

[0011] Obtaining request durations and request results of multiple threads connected to the first communication bus within a target duration;

[0012] Determine the communication load rate according to the request time of each thread in the multiple threads;

[0013] The work status is determined according to the request duration and request result of each thread in multiple threads.

[0014] In the above technical scheme, the communication load rate and working status of the first communication bus can be accurately determined by the request duration and request results of multiple threads connected to the first communication bus within the target time length, so that the computing device can dynamically coordinate the communication bus between the first object and the second object according to the communication load rate and working status of the first communication bus, so as to achieve efficient communication between the first object and the second object on the basis of occupying fewer resources.

[0015] In a possible implementation, determining the communication load rate according to the request time of each thread in the multiple threads includes:

[0016] Determine the bus time consumption of the first communication bus within the target time length based on the request time consumption of each thread;

[0017] Determine the communication load rate based on the bus time and target duration.

[0018] In the above technical scheme, the bus consumption of the first communication bus can be determined according to the request consumption of each thread, and the communication load rate of the first communication bus can be accurately determined in combination with the target duration, so that the computing device can dynamically coordinate the communication bus between the first object and the second object according to the communication load rate of the first communication bus, so as to achieve efficient communication between the first object and the second object on the basis of occupying fewer resources.

[0019] In a possible implementation, determining the working status according to the request duration and request result of each thread in the multiple threads includes:

[0020] Determine a first number according to the request duration of each thread and the corresponding preset duration, the first number being the number of threads whose request duration is greater than the corresponding preset duration;

[0021] Determine a second number according to the request result of each thread, where the second number is the number of threads whose request result is request failure;

[0022] When the first number is greater than or equal to the first preset number or the second number is greater than or equal to the second preset number, determining that the working state is an unavailable state;

[0023] When the first number is less than the first preset number and the second number is less than the second preset number, it is determined that the working state is an available state.

[0024] In the above technical scheme, the working state of the first communication bus can be accurately determined according to the request duration and request result of each thread, so that the computing device can dynamically coordinate the communication bus between the first object and the second object according to the working state of the first communication bus, so as to achieve efficient communication between the first object and the second object on the basis of occupying fewer resources.

[0025] In a possible implementation, when the working state is an unavailable state, coordinating the first communication bus through the second communication bus includes:

[0026] Disconnecting the plurality of threads from the first communication bus;

[0027] A connection between the plurality of threads and the second communication bus is established.

[0028] In the above technical solution, when the first communication bus is in an unavailable state, the first communication bus will not be able to normally carry out the communication process between the first object and the second object. At this time, multiple threads in the first communication bus can be transferred to the second communication bus to replace the first communication bus, thereby avoiding wasting a lot of communication time when using the first communication bus for communication between the first object and the second object, and stably ensuring the communication efficiency of the first object and the second object.

[0029] In a possible implementation, when the communication load rate is greater than the first threshold, the first communication bus is coordinated through the second communication bus, including:

[0030] Determine a target thread from the plurality of threads according to a second threshold and a request duration of each thread;

[0031] The connection between the target thread and the first communication bus is disconnected, and the connection between the target thread and the second communication bus is established.

[0032] In the above technical solution, the target thread may be part of the multiple threads, that is, the number of the target threads is less than the number of the multiple threads. When the communication load rate of the first communication bus is greater than the first threshold, the processing efficiency of the first communication bus is low, resulting in a decrease in the communication efficiency between the first object and the second object. At this time, part of the threads in the first communication bus may be transferred to the second communication bus to reduce the communication load rate of the first communication bus, improve the processing efficiency of the first communication bus, and further improve the communication efficiency between the first object and the second object.

[0033] In a possible implementation, when the working state is an available state and the communication load rate is greater than a first threshold, the first communication bus is coordinated through the second communication bus, including:

[0034] Determine a target thread from the plurality of threads according to a second threshold and a request duration of each thread;

[0035] The connection between the target thread and the first communication bus is disconnected, and the connection between the target thread and the second communication bus is established.

[0036] In the above technical solution, when it is determined that the working state is an available state, it is further determined whether the communication load rate of the first communication bus is greater than the first threshold. When the working state is an available state and the communication load rate is greater than the first threshold, coordination processing is performed through the second communication bus to ensure that the communication bus between the first object and the second object can be accurately dynamically coordinated.

[0037] In a possible implementation, the number of the multiple threads is M, where M is an integer greater than or equal to 2; and determining a target thread from the multiple threads according to the second threshold and a request duration of each thread includes:

[0038] According to the request time of each thread, determine the first thread among the M threads, where the first thread is the thread with the longest request time among the M threads;

[0039] Determine an initial communication load rate corresponding to the first thread according to the request duration and the target duration of the first thread;

[0040] When the initial communication load rate is less than the second threshold and M is greater than 2, a second thread is determined from the M threads according to the initial communication load rate, the second threshold and the target duration, and the sum of the communication load rate of the second thread and the initial communication load rate is greater than or equal to the second threshold and less than the first threshold, or the sum of the number of the second thread and the number of the first thread is M-1;

[0041] The first thread and the second thread are determined as target threads.

[0042] In the above technical solution, the target thread on the first communication bus can be migrated to the second communication bus to reduce the communication load rate on the first communication bus and improve the processing efficiency of other threads except the target thread among the multiple threads on the first communication bus. In addition, when migrating to the second communication bus, the communication load rate of the migrated thread can be controlled by the second threshold and the first threshold to ensure that the communication load rate of the second communication bus is within a suitable range, avoid resource waste and achieve efficient processing of the target thread.

[0043] In a possible implementation, the number of the multiple threads is M, where M is an integer greater than or equal to 2; and determining a target thread from the multiple threads according to the second threshold and a request duration of each thread includes:

[0044] According to the request time of each thread, determine the first thread among the M threads, where the first thread is the thread with the longest request time among the M threads;

[0045] Determine an initial communication load rate corresponding to the first thread according to the request duration and the target duration of the first thread;

[0046] When the initial communication load rate is greater than or equal to the second threshold, the first thread is determined as the target thread.

[0047] In the above technical solution, when the initial communication load rate is greater than or equal to the second threshold, there is no need to migrate threads to the second communication bus, so as to avoid the communication load rate of the second communication bus being too high, resulting in a decrease in the processing efficiency of the second communication bus, and it can also avoid the communication load rate of the first communication bus being too low, resulting in a waste of resources of the first communication bus.

[0048] In a possible implementation, the number of the multiple threads is M, where M is an integer greater than or equal to 2; and determining a target thread from the multiple threads according to the second threshold and a request duration of each thread includes:

[0049] According to the request time of each thread, determine the first thread among the M threads, where the first thread is the thread with the longest request time among the M threads;

[0050] Determine an initial communication load rate corresponding to the first thread according to the request duration and the target duration of the first thread;

[0051] When the initial communication load rate is less than the second threshold and M is equal to 2, the first thread is determined as the target thread.

[0052] In the above technical solution, when migrating threads from the first communication bus to the second communication bus, at least one thread must be retained on the first communication bus. When M is equal to 2, the first thread can be determined as the target thread to avoid migrating all threads of the first communication bus to the second communication bus, resulting in waste of resources of the first communication bus and excessively high communication load rate of the second communication bus.

[0053] In a possible implementation, determining the second thread from the M threads according to the initial communication load rate, the second threshold, and the target duration includes:

[0054] Sorting the M threads to obtain the sorting results of the M threads;

[0055] Determine the i-th communication load rate corresponding to the first i threads according to the request duration and target duration of the first i threads;

[0056] Among them, i is 1, 2, ... in sequence until the Nth communication load rate corresponding to the first N threads is obtained, the sum of the Nth communication load rate and the initial communication load rate is greater than or equal to the second threshold and less than the first threshold, or N is equal to M-2, the first N threads are determined as the second threads, and N is an integer greater than 1 and less than or equal to M-2.

[0057] In the above technical solution, the second thread can be determined from multiple threads based on the second threshold and the request time of each thread, the first thread and the second thread can be determined as target threads, and the target threads of the first communication bus can be coordinated to the second communication bus. This not only alleviates the current communication load of the first communication bus, so that the first communication bus can speed up the processing of threads other than the target thread among multiple threads, but also ensures the processing efficiency of the target thread through the second communication bus, which is conducive to improving the communication efficiency between the first object and the second object.

[0058] In a possible implementation, the method further includes:

[0059] determining whether a first communication bus exists between the first object and the second object;

[0060] When it is determined that the first communication bus does not exist, the first communication bus is established according to the third communication bus, the third communication bus is a communication bus established between the first object and the second object based on the relay object, and the relay object is used to forward information on the third communication bus.

[0061] In the above technical solution, a first communication bus can be established based on the third communication bus to realize independent communication between the first object and the second object through the first communication bus. There is no need for a relay object to transfer communication messages between the first object and the second object, thus avoiding the switching process between objects on the bus, saving communication time and improving communication efficiency.

[0062] In a possible implementation manner, establishing the first communication bus according to the third communication bus includes:

[0063] Controlling the relay object in the third communication bus to forward the bus creation request sent by the first object to the second object;

[0064] In response to the bus creation request, controlling the second object to generate a pairing parameter corresponding to the first communication bus, where the pairing parameter includes a first parameter and a second parameter;

[0065] Controlling the second object to generate a response message corresponding to the bus creation request, where the response message includes the first parameter or the second parameter;

[0066] Controlling the relay object in the third communication bus to forward the response message sent by the second object to the first object;

[0067] The first object is controlled to establish a first communication bus according to the response message.

[0068] In the above technical solution, the relay object of the third communication bus can be controlled to forward the communication message between the first object and the second object, so as to establish the first communication bus through the third communication bus, realize independent communication between the first object and the second object, and help improve the communication efficiency between the first object and the second object.

[0069] In a possible implementation manner, establishing the first communication bus according to the third communication bus includes:

[0070] Controlling the first object to send a bus creation request to the second object through a relay object in the third communication bus;

[0071] In response to the bus creation request, controlling the second object to generate a pairing parameter corresponding to the first communication bus, where the pairing parameter includes a first parameter and a second parameter;

[0072] Controlling the second object to generate a response message corresponding to the bus creation request, where the response message includes the first parameter or the second parameter;

[0073] Controlling the first object to receive a response message sent by the second object through a relay object in the third communication bus;

[0074] The first object is controlled to establish a first communication bus according to the response message.

[0075] In the above technical solution, the first object can request the second object to establish a first communication bus through the third communication bus. The first communication bus can realize independent communication between the first object and the second object, which is conducive to improving the communication efficiency between the first object and the second object.

[0076] In a possible implementation manner, establishing the first communication bus according to the third communication bus includes:

[0077] Controlling the first object to receive the bus creation request sent by the second object through the relay object in the third communication bus;

[0078] In response to the bus creation request, controlling the first object to generate a pairing parameter corresponding to the first communication bus, where the pairing parameter includes a first parameter and a second parameter;

[0079] Controlling the first object to generate a response message corresponding to the bus creation request, where the response message includes the first parameter or the second parameter;

[0080] Controlling the second object to receive a response message sent by the first object through a relay object in the third communication bus;

[0081] The second object is controlled to establish a first communication bus according to the response message.

[0082] In the above technical solution, the first object can receive a bus creation request sent by the second object through the third communication bus, and establish a first communication bus in response to the bus creation request. The first communication bus can realize independent communication between the first object and the second object, which is conducive to improving the communication efficiency between the first object and the second object.

[0083] In a second aspect, an embodiment of the present application provides a communication device, which is applied to a computing device, in which a first object and a second object are running, and the communication device includes:

[0084] A processing module, configured to determine a communication load rate and a working state of a first communication bus, wherein the first communication bus is used for independent communication between a first object and a second object, and the communication load rate is used to indicate a resource occupancy ratio of the first communication bus;

[0085] The processing module is also used to establish a second communication bus for independent communication between the first object and the second object when the working state is an unavailable state or the communication load rate is greater than a first threshold, and coordinate the first communication bus through the second communication bus, wherein the unavailable state is used to indicate that the first object cannot communicate normally with the second object through the first communication bus.

[0086] The communication device provided in the embodiment of the present application can execute the technical solution as described in any one of the first aspects, and its beneficial effects are similar, which will not be repeated here.

[0087] In a possible implementation, the processing module is specifically used for:

[0088] Obtaining request durations and request results of multiple threads connected to the first communication bus within a target duration;

[0089] Determine the communication load rate according to the request time of each thread in the multiple threads;

[0090] The work status is determined according to the request duration and request result of each thread in multiple threads.

[0091] In a possible implementation, the processing module is further configured to:

[0092] Determine the bus time consumption of the first communication bus within the target time length based on the request time consumption of each thread;

[0093] Determine the communication load rate based on the bus time and target duration.

[0094] In a possible implementation, the processing module is further configured to:

[0095] Determine a first number according to the request duration of each thread and the corresponding preset duration, the first number being the number of threads whose request duration is greater than the corresponding preset duration;

[0096] Determine a second number according to the request result of each thread, where the second number is the number of threads whose request result is request failure;

[0097] When the first number is greater than or equal to the first preset number or the second number is greater than or equal to the second preset number, determining that the working state is an unavailable state;

[0098] When the first number is less than the first preset number and the second number is less than the second preset number, it is determined that the working state is an available state.

[0099] In a possible implementation, when the working state is an unavailable state, the processing module is further configured to:

[0100] Disconnecting the plurality of threads from the first communication bus;

[0101] A connection between the plurality of threads and the second communication bus is established.

[0102] In a possible implementation manner, when the communication load rate is greater than the first threshold, the processing module is further configured to:

[0103] Determine a target thread from the plurality of threads according to a second threshold and a request duration of each thread;

[0104] The connection between the target thread and the first communication bus is disconnected, and the connection between the target thread and the second communication bus is established.

[0105] In a possible implementation manner, when the communication load rate is greater than the first threshold, the processing module is further configured to:

[0106] Determine a target thread from the plurality of threads according to a second threshold and a request duration of each thread;

[0107] The connection between the target thread and the first communication bus is disconnected, and the connection between the target thread and the second communication bus is established.

[0108] In a possible implementation, the number of the multiple threads is M, where M is an integer greater than or equal to 2; and the processing module is further configured to:

[0109] According to the request time of each thread, determine the first thread among the M threads, where the first thread is the thread with the longest request time among the M threads;

[0110] Determine an initial communication load rate corresponding to the first thread according to the request duration and the target duration of the first thread;

[0111] When the initial communication load rate is less than the second threshold and M is greater than 2, a second thread is determined from the M threads according to the initial communication load rate, the second threshold and the target duration, and the sum of the communication load rate of the second thread and the initial communication load rate is greater than or equal to the second threshold and less than the first threshold, or the sum of the number of the second thread and the number of the first thread is M-1;

[0112] The first thread and the second thread are determined as target threads.

[0113] In a possible implementation, the number of the multiple threads is M, where M is an integer greater than or equal to 2; and the processing module is further configured to:

[0114] According to the request time of each thread, determine the first thread among the M threads, where the first thread is the thread with the longest request time among the M threads;

[0115] Determine an initial communication load rate corresponding to the first thread according to the request duration and the target duration of the first thread;

[0116] When the initial communication load rate is greater than or equal to the second threshold, the first thread is determined as the target thread.

[0117] In a possible implementation, the number of the multiple threads is M, where M is an integer greater than or equal to 2; and the processing module is further configured to:

[0118] According to the request time of each thread, determine the first thread among the M threads, where the first thread is the thread with the longest request time among the M threads;

[0119] Determine an initial communication load rate corresponding to the first thread according to the request duration and the target duration of the first thread;

[0120] When the initial communication load rate is less than the second threshold and M is equal to 2, the first thread is determined as the target thread.

[0121] In a possible implementation, the processing module is further configured to:

[0122] Sorting the M threads to obtain the sorting results of the M threads;

[0123] Determine the i-th communication load rate corresponding to the first i threads according to the request duration and target duration of the first i threads;

[0124] Among them, i is 1, 2, ... in sequence until the Nth communication load rate corresponding to the first N threads is obtained, the sum of the Nth communication load rate and the initial communication load rate is greater than or equal to the second threshold and less than the first threshold, or N is equal to M-2, the first N threads are determined as the second threads, and N is an integer greater than 1 and less than or equal to M-2.

[0125] In a possible implementation, the processing module is further configured to:

[0126] determining whether a first communication bus exists between the first object and the second object;

[0127] When it is determined that the first communication bus does not exist, the first communication bus is established according to the third communication bus, the third communication bus is a communication bus established between the first object and the second object based on the relay object, and the relay object is used to forward information on the third communication bus.

[0128] In a possible implementation, the processing module is further configured to:

[0129] Controlling the relay object in the third communication bus to forward the bus creation request sent by the first object to the second object;

[0130] In response to the bus creation request, controlling the second object to generate a pairing parameter corresponding to the first communication bus, where the pairing parameter includes a first parameter and a second parameter;

[0131] Controlling the second object to generate a response message corresponding to the bus creation request, where the response message includes the first parameter or the second parameter;

[0132] Controlling the relay object in the third communication bus to forward the response message sent by the second object to the first object;

[0133] The first object is controlled to establish a first communication bus according to the response message.

[0134] In a possible implementation, the processing module is further configured to:

[0135] Controlling the first object to send a bus creation request to the second object through a relay object in the third communication bus;

[0136] In response to the bus creation request, controlling the second object to generate a pairing parameter corresponding to the first communication bus, where the pairing parameter includes a first parameter and a second parameter;

[0137] Controlling the second object to generate a response message corresponding to the bus creation request, where the response message includes the first parameter or the second parameter;

[0138] Controlling the first object to receive a response message sent by the second object through a relay object in the third communication bus;

[0139] The first object is controlled to establish a first communication bus according to the response message.

[0140] In a possible implementation, the processing module is further configured to:

[0141] Controlling the first object to receive the bus creation request sent by the second object through the relay object in the third communication bus;

[0142] In response to the bus creation request, controlling the first object to generate a pairing parameter corresponding to the first communication bus, where the pairing parameter includes a first parameter and a second parameter;

[0143] Controlling the first object to generate a response message corresponding to the bus creation request, where the response message includes the first parameter or the second parameter;

[0144] Controlling the second object to receive a response message sent by the first object through a relay object in the third communication bus;

[0145] The second object is controlled to establish a first communication bus according to the response message.

[0146] In a third aspect, an embodiment of the present application provides a computing device, including: a processor and a memory; the processor and the memory are coupled;

[0147] The memory is used to store computer instructions;

[0148] The processor is used to execute computer instructions stored in the memory to perform the method as described in any one of the first aspects.

[0149] The computing device provided in the embodiment of the present application can execute the technical solution as described in any one of the first aspects, and its beneficial effects are similar, which will not be repeated here.

[0150] In a fourth aspect, an embodiment of the present application provides a chip, wherein the chip is used to implement the method as described in any one of the first aspects.

[0151] The chip provided in the embodiment of the present application can execute the technical solution as described in any one of the first aspects, and its beneficial effects are similar, which will not be repeated here.

[0152] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a computer, a method as described in any one of the first aspects is implemented.

[0153] The computer-readable storage medium provided in the embodiment of the present application can execute the technical solution as described in any one of the first aspects, and its beneficial effects are similar and will not be repeated here.

[0154] In a sixth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the method described in any one of the first aspects.

[0155] The computer program product provided in the embodiment of the present application can execute the technical solution as described in any one of the first aspects, and its beneficial effects are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0156] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0157] Figure 1 A schematic diagram of the architecture of a communication bus provided in an embodiment of the present application;

[0158] Figure 2 A schematic diagram of an application scenario provided in an embodiment of the present application;

[0159] Figure 3 A schematic diagram of the architecture of a computing device provided in an embodiment of the present application;

[0160] Figure 4 One of the exemplary flow charts of the communication method provided in the embodiment of the present application;

[0161] Figure 5 The second exemplary flow chart of the communication method provided in the embodiment of the present application;

[0162] Figure 6 The third exemplary flow chart of the communication method provided in the embodiment of the present application;

[0163] Figure 7 A fourth exemplary flow chart of a communication method provided in an embodiment of the present application;

[0164] Figure 8 A fifth exemplary flow chart of a communication method provided in an embodiment of the present application;

[0165] Fig. 9 A schematic diagram of the communication process on the communication bus provided in an embodiment of the present application;

[0166] Fig.10 A schematic diagram of the structure of a communication device provided in an embodiment of the present application;

[0167] Fig.11 A schematic diagram of the hardware structure of a computing device provided in an embodiment of the present application.

[0168] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0169] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the appended claims.

[0170] First, the relevant terms involved in the embodiments of the present application are introduced.

[0171] D-Bus (Desktop Bus): is an advanced inter-process communication mechanism that can be used to provide communication for multiple processes running in the desktop environment of the computing device's operating system (e.g., Linux operating system), and can also pass the operating system's desktop environment and system kernel events as messages to each process. A process registered on the D-Bus can receive or pass messages through the D-Bus, and a registered process can also wait for a system kernel event response, for example, a registered process can wait for a network status change or a computer shutdown command.

[0172] Daemon: It can be used as a message transfer hub for the D-Bus bus. Daemon can be used to transfer communication messages between all processes on the D-Bus bus.

[0173] Currently, multiple objects can be running in a computing device, and these multiple objects can communicate and interact through a communication bus. Exemplarily, the object can be a business process or an application process running in the computing device. Figure 1 , taking the D-Bus bus as an example, the structure of the communication bus provided in the embodiment of the present application is explained.

[0174] Figure 1 The present application provides a schematic diagram of the architecture of a communication bus. Figure 1 , a plurality of communication objects and relay objects are connected to the D-Bus bus, and the relay object can transfer communication messages between any two communication objects. It should be noted that each communication object can be a business process connected to the D-Bus bus, and the relay object can be a Daemon of the D-Bus bus.

[0175] The embodiment of the present application provides a communication method, which can be applied to a computing device, in which a first object and a second object can be run, the method comprising: determining a communication load rate and a working state of a first communication bus, the first communication bus being used for independent communication between the first object and the second object, the communication load rate being used to indicate the resource occupancy ratio of the first communication bus; when the working state is an unavailable state or the communication load rate is greater than a first threshold, establishing a second communication bus for independent communication between the first object and the second object, and coordinating the first communication bus through the second communication bus, the unavailable state being used to indicate that the first communication bus needs to be replaced. The communication method can dynamically coordinate the communication bus between the first object and the second object by monitoring the working state and the communication load rate of the first communication bus, so as to achieve efficient communication between the first object and the second object on the basis of occupying fewer resources.

[0176] When the working state is an available state or the communication load rate of the first communication bus is less than or equal to the first threshold, there is no need to establish a second communication bus between the first object and the second object, so as to avoid the communication process between the first object and the second object occupying more resources, which is beneficial to reducing resource overhead; when the working state is an unavailable state or the communication load rate of the first communication bus is greater than the first threshold, the second communication bus is created in time, and the first communication bus is coordinated by the second communication bus, which can avoid the failure of the first communication bus or low processing efficiency. The communication efficiency of the first object and the second object is reduced, which is beneficial to improving communication efficiency.

[0177] Below, in order to facilitate understanding of the communication method provided in the embodiment of the present application, Figure 2 , the application scenarios provided by the embodiments of the present application are introduced.

[0178] Figure 2 A schematic diagram of an application scenario provided in an embodiment of the present application. The application scenario may include the following three processes:

[0179] First process: The first object and the second object communicate independently based on the first communication bus.

[0180] Second process: The second process may include the following two situations:

[0181] The first object may include a thread, and the thread may be connected to the first communication bus. The first object may communicate with the second object via the thread connected to the first communication bus.

[0182] Case 1: When the working state of the first communication bus is unavailable, a second communication bus for independent communication between the first object and the second object is established.

[0183] In this case, the first communication bus cannot be used any more, and a new second communication bus needs to be created, and all threads connected to the first communication bus are migrated to the second communication bus, so that the first object can communicate with the second object through all threads connected to the second communication bus.

[0184] The unavailable state may be used to indicate that the first object cannot normally communicate with the second object through the first communication bus.

[0185] It can be understood that, when the request sent by the first object to the second object through the first communication bus does not time out or the request result is a successful request, it can be determined that the first object communicates normally with the second object through the first communication bus; when the request sent by the first object to the second object through the first communication bus times out or the request result is a failed request, it can be determined that the first object cannot communicate normally with the second object through the first communication bus.

[0186] Case 2: When the communication load rate of the first communication bus is greater than the first threshold, a second communication bus for independent communication between the first object and the second object is established.

[0187] In this case, the first communication bus can still be used, a new second communication bus can be created, and some threads connected to the first communication bus can be migrated to the second communication bus to reduce the communication load rate of the first communication bus and improve the communication efficiency of each thread on the first communication bus. In this case, the first object and the second object can communicate normally through the first communication bus and the second communication bus.

[0188] Figure 3 This is a schematic diagram of the architecture of a computing device provided in an embodiment of the present application. Figure 3 , the computing device includes a first object and a second object, wherein the first object may include a bus selection unit 1, a bus monitoring unit 1 and a bus management unit 1, and the second object may include a bus selection unit 2, a bus monitoring unit 2 and a bus management unit 2. Wherein:

[0189] (1) Bus selection unit: Bus selection unit 1 or bus selection unit 2

[0190] For any object, the bus selection unit in the object can be used to select a suitable bus for the object to communicate when the object initiates a communication request to other objects.

[0191] The bus selection unit may obtain bus information of the communication bus to which the object is connected, the bus information including object identifiers of other objects communicating with the object, identifiers of the communication bus through which the object communicates with other objects, and identifiers of threads connected to each communication bus.

[0192] For example, the bus information of object 1 may be as shown in Table 1:

[0193] Table 1

[0194]

[0195] According to the bus information shown in Table 1, if thread 10001 of object 1 needs to access object 2, the bus selection unit may select bus 2; if thread 10004 of object 1 needs to access object 4, the bus selection unit may select bus 4.

[0196] (2) Bus monitoring unit: Bus monitoring unit 1 and bus monitoring unit 2

[0197] For any object, the bus monitoring unit in the object can be used to monitor the communication load and working status of the bus. The bus monitoring unit can be used to record the identity document (ID) of the thread corresponding to the communication request, the bus identity of the communication bus, the request duration and the request result when the object initiates a communication request to other objects.

[0198] The thread identifier may include but is not limited to the name or number of the thread. For example, the thread identifier may be thread 1 or 10001.

[0199] The bus identifier may be the name or number of the communication bus. For example, the bus identifier may be bus 2.

[0200] The request duration is used to indicate the time taken from initiating the communication request to ending the communication request. For example, the request duration may be 2 seconds.

[0201] The request result can be either a success or a failure.

[0202] (3) Bus management unit: bus management unit 1 and bus management unit 2

[0203] For any object, the bus management unit in the object can be used to manage the bus, including the creation and destruction of the bus.

[0204] It is understandable that the first object can interact with the bus management unit 2 in the second object through the bus management unit 1 to create a communication bus for independent communication between the first object and the second object. If the first object initiates a bus creation request to the second object, the bus management unit 1 can act as a client and the bus management unit 2 can act as a server.

[0205] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0206] Figure 4 This is one of the exemplary flow charts of the communication method provided in the embodiment of the present application. Figure 4 , the method specifically comprises:

[0207] S401: Determine the communication load rate and working status of the first communication bus.

[0208] This step can be done by Figure 3 The computing device in the embodiment executes, and the first object and the second object are running in the computing device.

[0209] Exemplarily, the first object may be an application or process running in the computing device, and the second object may also be an application or process running in the computing device.

[0210] The number of the first communication buses may be one or more. If the number of the first communication buses is more than one, it is necessary to determine the communication load rate and working status of each first communication bus.

[0211] The first communication bus can be used for independent communication between the first object and the second object. The independent communication between the first object and the second object means that the first object can directly send communication information to the second object, or the first object can directly receive communication information sent by the second object without forwarding the communication information between the first object and the second object through a relay object.

[0212] The first object and the second object can communicate based on the first communication bus. During the communication between the first object and the second object based on the first communication bus, this step can be performed by the bus monitoring unit in the object that initiates the communication request. If the communication request is initiated by the first object, this step can also be performed by Figure 3 The bus monitoring unit 1 in the embodiment is executed; if the communication request is initiated by the second object, this step can also be performed by Figure 3 The bus monitoring unit 2 in the embodiment executes.

[0213] The communication load rate may be used to indicate the resource occupancy ratio of the first communication bus.

[0214] In some embodiments, the resources of the first communication bus may include the time domain resources of the first communication bus. The first object may include one or more threads, which may be connected to the first communication bus. When the first object communicates through any one of the multiple threads connected to the first communication bus, the thread will occupy the time domain resources of the first communication bus, so that other threads except the thread cannot use the first communication bus.

[0215] In some embodiments, the communication load rate may be the ratio of the request time of each thread to the target duration. For example, assuming the target duration is 60 seconds and the request time of thread 1 is 15 seconds, the communication load rate of thread 1 is 25%.

[0216] It can be understood that, if the communication load rate of the first communication bus is greater, the processing efficiency of the first communication bus is lower; if the communication load rate of the first communication bus is smaller, the processing efficiency of the first communication bus is higher.

[0217] The work status can be available or unavailable.

[0218] The available state is used to indicate that the first object can communicate normally with the second object through the first communication bus; the unavailable state is used to indicate that the first object cannot communicate normally with the second object through the first communication bus.

[0219] It can be understood that, when the request sent by the first object to the second object through the first communication bus does not time out or the request result is a successful request, it is determined that the first object can communicate normally with the second object through the first communication bus; when the request sent by the first object to the second object through the first communication bus times out or the request result is a failed request, it is determined that the first object cannot communicate normally with the second object through the first communication bus.

[0220] It should be noted that the process of determining the communication load rate and working state of the first communication bus will be Figure 5 The details are described in the examples.

[0221] S402: When the working state is unavailable or the communication load rate is greater than a first threshold, establish a second communication bus for independent communication between the first object and the second object, and coordinate the first communication bus through the second communication bus.

[0222] This step can be done by Figure 3 The computing device of an embodiment executes.

[0223] In some embodiments, the process of establishing the second communication bus can also be performed by Figure 3The bus management unit 1 and the bus management unit 2 in the embodiment are executed interactively.

[0224] In some embodiments, if the communication process is initiated by the first object, the process of coordinating the first communication bus through the second communication bus can also be performed by Figure 3 The bus selection unit 1 in the embodiment is executed; if the communication process is initiated by the second object, the process of coordinating the first communication bus through the second communication bus can also be performed by Figure 3 The bus selection unit 2 in the embodiment executes.

[0225] It can be understood that there may be multiple first communication buses between the first object and the second object, and at least one target first communication bus is determined among these multiple first communication buses, and the working state of the target first communication bus is unavailable or the communication load rate is greater than the first threshold; a second communication bus corresponding to each target first communication bus is established.

[0226] For example, it is assumed that there are three first communication buses between the first object and the second object, namely, the first communication bus 1, the first communication bus 2 and the first communication bus 3, wherein the working state of the first communication bus 1 is unavailable, the working state of the first communication bus 2 is available and the communication load rate is greater than the first threshold, and the working state of the first communication bus 3 is normal and the communication load rate is less than the first threshold. Based on the above situation, the computing device needs to establish a corresponding second communication bus 1 for the first communication bus 1, and establish a corresponding second communication bus 2 for the first communication bus 2.

[0227] The computing device may set a first threshold based on the demand information input by the user. For example, the first threshold may be 80%.

[0228] It is understandable that when the first communication bus is in an unavailable state, the first communication bus will not be able to normally implement the communication process between the first object and the second object. At this time, a second communication bus for independent communication between the first object and the second object can be established, and all threads in the first communication bus can be transferred to the second communication bus to replace the first communication bus, thereby avoiding wasting a lot of communication time by using the first communication bus for communication between the first object and the second object, and stably ensuring the communication efficiency of the first object and the second object.

[0229] When the communication load rate of the first communication bus is greater than the first threshold, the processing efficiency of the first communication bus is low, which leads to a decrease in the communication efficiency between the first object and the second object. At this time, some threads in the first communication bus can be transferred to the second communication bus to reduce the communication load rate of the first communication bus, improve the processing efficiency of the first communication bus, and then improve the communication efficiency between the first object and the second object.

[0230] It should be noted that the process of coordinating the first communication bus through the second communication bus will be Figure 5 The details are described in the examples.

[0231] The communication method provided in the embodiment of the present application can dynamically coordinate the communication bus between the first object and the second object by monitoring the working state and communication load rate of the first communication bus, so as to realize efficient communication between the first object and the second object on the basis of occupying less resources. When the working state is an available state or the communication load rate of the first communication bus is less than or equal to the first threshold, it is not necessary to establish a second communication bus between the first object and the second object, so as to avoid the communication process between the first object and the second object occupying more resources, which is conducive to reducing resource overhead; when the working state is an unavailable state or the communication load rate of the first communication bus is greater than the first threshold, the second communication bus is created in time, and the first communication bus is coordinated by the second communication bus, so as to avoid the first communication bus failure or low processing efficiency causing the communication efficiency of the first object and the second object to decrease, which is conducive to improving communication efficiency.

[0232] Figure 5 This is a second exemplary flow chart of the communication method provided in the embodiment of the present application. Figure 5 , the method specifically comprises:

[0233] S501: Determine whether there is a first communication bus for independent communication between a first object and a second object.

[0234] This step can be done by Figure 3 The computing device in the embodiment is executed, or the step can also be performed by Figure 3 The bus management unit 1 or the bus management unit 2 in the embodiment executes.

[0235] The first communication bus can be established based on the third communication bus. The third communication bus can be a communication bus established between the first object and the second object based on the relay object, and the relay object can be used to forward the information on the second communication bus. Specifically, the third communication bus can be expressed as "first object-relay object-second object", and the first object and the second object can respectively call a function (for example, sd_bus_default) to connect with the relay object (for example, daemon1), so that the first object can establish a third communication bus with the second object through the relay object.

[0236] In some embodiments, the first communication bus and the third communication bus may be D-Bus buses, and the relay object may be a Daemon of the D-Bus bus.

[0237] Independent communication may be used to indicate that the first object and the second object may directly exchange communication messages without forwarding the communication messages via a relay object.

[0238] In some embodiments, terms such as "first object", "second object", "first process", "second process", "first application", "second application", etc. can be used interchangeably.

[0239] In the case where it is determined that the first communication bus exists, step S502 may be continued;

[0240] In the case where it is determined that the first communication bus does not exist, a first communication bus for independent communication between the first object and the second object may also be established first.

[0241] It should be noted that the process of establishing the first communication bus for independent communication between the first object and the second object will be Figure 8 The details are described in the examples.

[0242] S502: When it is determined that the first communication bus exists, obtain request durations and request results of multiple threads connected to the first communication bus within a target duration.

[0243] This step can be done by Figure 3 In the process of the first object and the second object communicating based on the first communication bus, this step can also be performed by the bus monitoring unit in the initiating object that initiates the communication request. For example, if the first object initiates a communication request to the second object, this step is performed by Figure 3 The bus monitoring unit 1 in the embodiment executes this step.

[0244] The target duration may be determined based on the configuration information input by the user. For example, the target duration may be 1 minute.

[0245] In some embodiments, communication information of the first communication bus may be obtained, and request times and request results of multiple threads may be determined based on the communication information.

[0246] The communication information may include identifiers of multiple threads connected to the first communication bus, and request duration and request result of each thread.

[0247] The request result can be either a success or a failure.

[0248] In some embodiments, the bus monitoring unit may store communication information of different communication buses. For example, the communication information may be as shown in Table 2:

[0249] Table 2

[0250]

[0251] For any object (first object or second object), the bus monitoring unit in the object can periodically obtain the communication information of the first communication bus from the bus management unit in the object based on the target duration. For example, the first communication bus is bus 2. According to Table 2, the communication information corresponding to bus 2 includes: the identifiers, request durations, and request results of threads 10001, 10002, 10003, 10004, and 10006.

[0252] S503: Determine a communication load rate according to the request duration of each thread in the multiple threads.

[0253] In a possible implementation, the communication load rate may be determined in the following manner: based on the request time of each thread, determining the bus time of the first communication bus within the target duration; and determining the communication load rate according to the bus time and the target duration.

[0254] The request time consumption of each thread may be summed up to obtain the bus time consumption of the first communication bus within the target time length.

[0255] In some embodiments, the ratio of bus time to target duration can be determined as the communication load rate, that is, communication load rate = bus time / target duration. It should be noted that the communication load rate can be in any of the following forms: percentage, decimal and fraction.

[0256] For example, assuming that the target duration is 60 seconds, according to Table 2, bus 2 includes 5 threads (10001, 10002, 10003, 10004 and 10006), and the request times of these 5 threads are added together to obtain a bus time of 49 seconds, and the communication load rate of bus 2 is 81.67%; bus 3 includes 5 threads (10011, 10012, 10013, 10014 and 10016), and the request times of these 5 threads are added together to obtain a bus time of 54 seconds, and the communication load rate of bus 3 is 90%.

[0257] S504: When the communication load rate is greater than the first threshold, establish a second communication bus for independent communication between the first object and the second object.

[0258] It can be understood that if there are M first communication buses, these M first communication buses include N target first communication buses, and the communication load rate of the target first communication bus is greater than the first threshold, where N is an integer greater than or equal to 1, and M is an integer greater than or equal to N.

[0259] If N is equal to M, it is necessary to establish a second communication bus based on the third communication bus. The third communication bus is a communication bus established between the first object and the second object based on the relay object. The relay object is used to forward information on the third communication bus.

[0260] If N is less than M, then the first communication bus with the smallest communication load rate can be found among the other MN first communication buses, and the second communication bus corresponding to the N target first communication buses can be established through the first communication bus with the smallest communication load rate; alternatively, the second communication bus can also be established based on the third communication bus.

[0261] It should be noted that the process of establishing the second communication bus according to the third communication bus can refer to the subsequent Figure 8 In an embodiment, a process of establishing a first communication bus according to a third communication bus.

[0262] S505. When the communication load rate is greater than the first threshold, determine a target thread from multiple threads according to the second threshold and the request time of each thread, disconnect the target thread from the first communication bus, and establish a connection between the target thread and the second communication bus.

[0263] It is understandable that the target thread may be one or more, and the number of the target threads is less than the number of the plurality of threads. For example, if the number of the plurality of threads is five, the number of the target threads may be any value between 1 and 4.

[0264] It should be noted that the process of determining the target thread will be in Figure 6 The details are described in the examples.

[0265] S506: Determine the working status according to the request duration and request result of each thread in the multiple threads.

[0266] In a possible implementation, the working status can be determined in the following manner: a first number is determined based on the request duration of each thread and the corresponding preset duration, where the first number is the number of threads whose request duration is greater than the preset duration; a second number is determined based on the request result of each thread, where the second number is the number of threads whose request result is a failed request; when the first number is greater than or equal to the first preset number or the second number is greater than or equal to the second preset number, the working status is determined to be an unavailable status; when the first number is less than the first preset number and the second number is less than the second preset number, the working status is determined to be an available status.

[0267] It can be understood that for any thread, the preset duration of the thread can be obtained; if the request duration of the thread is greater than the preset duration of the thread, it is determined that the request duration of the thread has timed out; if the request duration of the thread is less than or equal to the preset duration of the thread, it is determined that the request duration of the thread has not timed out.

[0268] Optionally, the preset duration may be determined based on multiple historical request durations corresponding to multiple historical request information within a historical period of the thread. For example, the preset duration may be an average value of the multiple historical request durations.

[0269] The user can determine the first preset number and the second preset number based on business needs. The first preset number and the second preset number can be the same or different. For example, the first preset number and the second preset number can both be 3; or the first preset number is 3 and the second preset number is 4.

[0270] In some embodiments, it is assumed that M threads may be connected to the first communication bus, where M is an integer greater than or equal to 1. The first preset number may be less than or equal to M, and the second preset number may also be less than or equal to M.

[0271] It is understandable that, for any thread, the thread may experience a request timeout and a request failure at the same time, or the thread may experience a request timeout and a request success at the same time.

[0272] It can be understood that, in any communication bus, among the multiple threads connected to the communication bus, when only one thread request times out or fails, and the requests of other threads have not timed out and their requests are successful, it is impossible to determine whether the request timeout or request failure of the thread is caused by the unavailability of the communication bus; when there are more than a first preset number of threads with request timeouts or there are more than a second preset number of threads with request failures, it can be determined that the current working state of the communication bus may be an unavailable state. In order to avoid affecting the communication of the threads connected to the communication bus, it is necessary to establish a new communication bus to replace the communication bus to ensure that the multiple threads connected to the communication bus can communicate normally.

[0273] For example, the second preset number is 3, see Table 2, the number of threads whose requests fail in bus 2 is 3, and it can be determined that the working state of bus 2 is unavailable.

[0274] In some examples, for any one of the multiple threads, it can be determined whether the thread has a request timeout based on the request time of the thread and the preset duration of the thread. When each thread has a request timeout, and / or the request result of each thread is a request failure, it can be determined that the working state is a fault state in a non-available state. When at least one thread among the multiple threads does not have a request timeout, and / or the request result of at least one thread among the multiple threads is a request success, it can be determined that the working state is a normal state.

[0275] S507: When the working state is a non-available state, establish a second communication bus for independent communication between the first object and the second object.

[0276] It should be noted that the specific implementation process of establishing the second communication bus in step S507 can refer to the specific implementation process of establishing the second communication bus in step S504, and will not be repeated here.

[0277] In some embodiments, when the working state is an available state, the communication load rate can also be determined based on the request time of each thread in multiple threads; when it is determined that the communication load rate is greater than a first threshold, a second communication bus for independent communication between the first object and the second object is established; and based on the second threshold and the request time of each thread, a target thread is determined among multiple threads; the connection between the target thread and the first communication bus is disconnected, and a connection between the target thread and the second communication bus is established.

[0278] It should be noted that the process of determining the target thread will be in Figure 6 The details are described in the examples.

[0279] The method can further determine whether a new second communication bus needs to be created based on the communication load rate of the first communication bus when the working state is an available state, so as to ensure that the communication bus between the first object and the second object can be accurately dynamically coordinated.

[0280] S508: When the working state is an unavailable state, disconnect the multiple threads from the first communication bus, and establish connections between the multiple threads and the second communication bus.

[0281] It can be understood that in some embodiments, one thread can be connected to the first communication bus. When the working state of the first communication bus is unavailable, the connection between the one thread and the first communication bus can be disconnected, and a connection between the one thread and the second communication bus can be established.

[0282] In the following, in conjunction with Table 3, an example is given of the coordination process between the first communication bus and the second communication bus when the working state is the unavailable state.

[0283] Table 3

[0284]

[0285]

[0286] For example, in Table 3, when bus 2 fails, the connection between bus 2 and the above five threads (thread 10001, thread 10002, thread 10003, thread 10004, thread 10006) can be disconnected, and the above five threads (thread 10001, thread 10002, thread 10003, thread 10004, thread 10006) can be connected to bus 3 instead.

[0287] It should be noted that the communication method involved in the embodiment of the present application may include at least one of steps S501 to S508. For example, steps S501 to S505 may be implemented as independent embodiments; steps S501, S502, S506 to S508 may be implemented as independent embodiments; steps S501 to S508 may be implemented as independent embodiments.

[0288] The communication method provided in the embodiment of the present application can create a second communication bus in a timely manner when the working state of the first communication bus is unavailable or the communication load rate is greater than a first threshold, and switch multiple processes connected to the first communication bus to the second communication bus for continued operation, so as to achieve automatic recovery of bus failures, avoid business suspension caused by bus failures, and help ensure the stability of business processing.

[0289] Next, combine Figure 6 , assuming that there are M threads connected to the first communication bus, the process of determining the target thread among the M threads is described in detail.

[0290] Figure 6 This is a third exemplary flow chart of the communication method provided in the embodiment of the present application. Figure 6 , the method specifically comprises:

[0291] S601. Determine a first thread from M threads according to the request duration of each thread.

[0292] Wherein, M is an integer greater than or equal to 2.

[0293] The first thread may be a thread whose request takes the longest time among the multiple threads.

[0294] It can be understood that if two threads are connected to the first communication bus and the communication load rates of the two threads are the same, any one of the threads can be determined as the first thread.

[0295] For example, among the five threads corresponding to bus 2 shown in Table 3, the request of thread 10004 takes the longest time, and thread 10004 can be determined as the first thread.

[0296] S602: Determine an initial communication load rate corresponding to the first thread according to the request duration and the target duration of the first thread.

[0297] In some embodiments, the ratio of the request duration of the first thread to the target duration may be determined as the initial communication load rate, that is, initial communication load rate=request duration of the first thread / target duration.

[0298] For example, in Table 3, the first thread is thread 10004, and its request time is 20 seconds. Assuming that the target duration is 60 seconds, the first communication load is 33.33%.

[0299] S603: Determine whether the initial communication load rate is less than a second threshold.

[0300] If not, execute step S605;

[0301] If so, step S604 may be executed.

[0302] The user may set the second threshold based on his / her own business requirements. For example, the second threshold may be 50%.

[0303] S604: Determine whether M is greater than 2.

[0304] If not, it means that M is equal to 2. At this time, the thread on the first communication bus will not be migrated any more, but step S605 will be executed;

[0305] If yes, execute step S606.

[0306] S605: Determine the first thread as the target thread.

[0307] It is understandable that when migrating threads from the first communication bus to the second communication bus, it is necessary to ensure that at least one thread is retained on the first communication bus to avoid migrating all threads of the first communication bus to the second communication bus, causing the communication load rate of the second communication bus to exceed the first threshold.

[0308] In one scenario, when M is equal to 2, there are 2 threads on the first communication bus, thread 1 and thread 2, wherein the sum of the communication load rate of thread 1 and the communication load rate of thread 2 is greater than or equal to the first threshold, but the communication load rate of thread 1 is less than the second threshold, and the communication load rate of thread 2 is less than the second threshold.

[0309] In this scenario, if the communication load rate of thread 1 is greater than the communication load rate of thread 2, thread 1 is determined as the first thread, and thread 1 is migrated to the second communication bus, and thread 2 is retained on the first communication bus. If the communication load rate of thread 1 is equal to the communication load rate of thread 2, thread 1 (or thread 2) is determined as the first thread, and thread 1 (or thread 2) is migrated to the second communication bus, and thread 2 (or thread 1) is retained on the first communication bus; if the communication load rate of thread 1 is less than the communication load rate of thread 2, thread 2 is determined as the first thread, and thread 2 is migrated to the second communication bus, and thread 1 is retained on the first communication bus.

[0310] In one scenario, when the initial communication load rate is greater than or equal to the second threshold, there is no need to migrate threads to the second communication bus to avoid the communication load rate of the second communication bus being too high, which leads to a decrease in the processing efficiency of the second communication bus. In addition, it can also avoid the communication load rate of the first communication bus being too low, which leads to a waste of resources of the first communication bus.

[0311] After determining that the first thread is the target thread, the connection between the first thread and the first communication bus may be disconnected, and the connection between the first thread and the second communication bus may be established.

[0312] The coordination process of the first thread is described below in conjunction with Table 4.

[0313] Table 4

[0314]

[0315] For example, in Table 4, since the request of thread 10004 takes the longest time (40 seconds), thread 10004 is determined as the first thread. Assuming the target duration is 60 seconds, the first threshold is 80%, and the second threshold is 50%, after calculation, the initial communication load rate is 66.67%>50%, then thread 10004 is first disconnected from bus 2 (or unbound), and a connection (binding) between thread 10004 and bus 3 is established. After migrating thread 10004, since the communication load rate of bus 3 is greater than the second threshold, and the communication load rate of bus 2 (18.33%) is less than the first threshold (80%), there is no need to coordinate other threads in bus 2.

[0316] S606: Determine a second thread from the M threads according to the initial communication load rate, the second threshold, and the target duration.

[0317] The sum of the communication load rate of the second thread and the initial communication load rate is greater than or equal to the second threshold and less than the first threshold; or the sum of the number of the second thread and the number of the first thread is M-1.

[0318] The number of the second threads may be one or more.

[0319] When the number of the second thread is one, the communication load rate of the second thread may be determined according to the request duration and the target duration of the one second thread.

[0320] When there are multiple second threads, the request time of each second thread may be summed to obtain the total request time of the multiple second threads; and the communication load rate of the second threads may be determined according to the total request time of the multiple second threads and the target duration.

[0321] It should be noted that the process of determining the second thread in multiple threads will be Figure 7 The details are described in the examples.

[0322] S607: Determine the first thread and the second thread as target threads.

[0323] It should be noted that the communication method involved in the embodiment of the present application may include at least one of steps S601 to S607. For example, steps S601 to S603 and S605 can be implemented as independent embodiments; steps S601 to S605 can be implemented as independent embodiments; steps S601 to S604, S606 and S607 can be implemented as independent embodiments; steps S601 to S607 can be implemented as independent embodiments.

[0324] The communication method provided in the embodiment of the present application can create a second communication bus in a timely manner when the communication load rate of the first communication bus is greater than a first threshold, and migrate the target thread on the first communication bus to the second communication bus, so as to reduce the communication load rate on the first communication bus and improve the processing efficiency of other threads except the target thread among the multiple threads on the first communication bus; and when migrating to the second communication bus, the communication load rate of the migrated thread can be jointly controlled by the second threshold and the first threshold to ensure that the communication load rate of the second communication bus is within an appropriate range, avoid waste of resources and achieve efficient processing of the target thread.

[0325] Next, combine Figure 7 , assuming that M threads are connected to the first communication bus, a process of determining the second thread among the M threads is described in detail.

[0326] Figure 7 This is a fourth exemplary flow chart of the communication method provided in the embodiment of the present application. Figure 7 , the method specifically comprises:

[0327] S701 , sorting the M threads to obtain sorting results of the M threads.

[0328] In some embodiments, the M threads may be sorted in a preset order, for example, the preset order may be from short to long, or from long to short.

[0329] For example, the five threads corresponding to bus 2 shown in Table 4 are sorted in order of request duration from shortest to longest, and the sorting results are: thread 10006, thread 10001, thread 10002, thread 10003, and thread 10004.

[0330] S702: Initialize i to 1.

[0331] Among them, i is 1, 2, ... in sequence.

[0332] S703: Determine the i-th communication load rate corresponding to the first i threads according to the request duration and the target duration of the first i threads.

[0333] In some embodiments, the request time of each thread in the first i threads may be summed up to obtain the i-th total time; and the ratio of the i-th total time to the target duration may be determined as the i-th communication load rate.

[0334] For example, according to the sorting result shown in S701, if i is 1, the first thread includes thread 10006, and the first communication load rate is: 1 / 60=1.67%; if i is 2, the first two threads include thread 10006 and thread 10001, and the second communication load is: (1+2) / 60=5%.

[0335] S704: Determine whether the sum of the i-th communication load rate and the initial load rate is greater than or equal to a second threshold.

[0336] If not, execute step S705;

[0337] If yes, execute step S707.

[0338] It can be understood that, when it is determined that the sum of the i-th communication load rate and the initial load rate is greater than or equal to the second threshold, the first i threads can be determined as the second thread.

[0339] S705: Determine whether i is less than M-2.

[0340] If yes, execute step S706;

[0341] If not, execute step S707.

[0342] It can be understood that, when it is determined that the first thread needs to be migrated to the second communication bus and at least one thread is guaranteed to be retained in the first communication bus, the maximum number of threads that can be migrated to the second communication bus is M-2. After i is M-2, even if the sum of the i-th communication load rate and the initial load rate is less than the second threshold, at this time, the first M-2 threads can be determined as the second thread.

[0343] S706: Update i to i+1.

[0344] After executing step S706, return to execute step S703.

[0345] S707: Determine the first i threads as the second thread.

[0346] The communication method provided in the embodiment of the present application can continue to determine the second thread from the remaining multiple threads when the initial communication load rate of the first thread is less than the first threshold value, so as to ensure that the communication load rate of the second communication bus is within a suitable range, avoid waste of resources and achieve efficient processing of the target thread.

[0347] In the following, in conjunction with Table 5, the process of determining the target thread and the process of coordinating the target thread are described.

[0348] Table 5

[0349]

[0350] In Table 5, among the five threads corresponding to bus 2 (thread 10011, thread 10012, thread 10013, thread 10014, thread 10016), thread 10014 is determined as the first thread because the request time of thread 10014 is the longest (15 seconds). Assuming the target duration is 60 seconds, the first threshold is 80%, and the second threshold is 50%, after calculation, the first communication load of the first thread is 25%<50%. At this time, it is necessary to continue to determine the second thread. According to the order of request time from short to long, the above five threads are sorted, and the sorting result is: thread 10011, thread 10012, thread 10016, thread 10013, thread 10014. According to the sorting result, thread 10011 is determined as the first thread, and the request time of thread 10011 and the request time of thread 10014 are added together to obtain the first total time of 23 seconds and the first communication load of 38.33%. Since the first communication load is less than the second threshold, the second total time is calculated. The second total time is 8+9+15=32 seconds, and the second communication load is 53.33%>50%. At this time, there is no need to coordinate other threads in bus 2 to bus 3.

[0351] The communication method provided in the embodiment of the present application can determine the second thread among multiple threads according to the second threshold and the request time of each thread, determine the first thread and the second thread as target threads, and coordinate these target threads of the first communication bus to the second communication bus. This not only alleviates the current communication load of the first communication bus, so that the first communication bus can speed up the processing of threads other than the target thread among multiple threads, but also ensures the processing efficiency of the target thread through the second communication bus, which is beneficial to improving the communication efficiency between the first object and the second object.

[0352] It is understandable that, in the process of executing the communication method involved in the above embodiment, it is necessary to first determine whether there is a first communication bus between the first object and the second object; if it is determined that the first communication bus does not exist, the first communication bus is established according to the third communication bus. Figure 8 , a process of establishing the first communication bus based on the third communication bus is described in detail.

[0353] Figure 8 This is a fifth exemplary flow chart of the communication method provided in the embodiment of the present application. Figure 8 The method specifically includes: determining whether there is a first communication bus for independent communication between the first object and the second object.

[0354] S801. Control a relay object in a third communication bus to forward a bus creation request sent by a first object to a second object.

[0355] The bus creation request may include an identifier of the first object and a service identifier requested by the first object, wherein the service identifier is used by the relay object to determine the second object.

[0356] The identifier of the first object may be, but is not limited to, the name or address of the first object.

[0357] The service identifier may be, but is not limited to, the name and number of the service.

[0358] In some embodiments, the computing device may control the first object to send a bus creation request to the second object through a relay object in the third communication bus; or control the first object to receive a bus creation request sent by the second object through the relay object.

[0359] In some embodiments, the first object can send a bus creation request to the relay object via a third communication bus; the relay object can determine the target service and the second object corresponding to the target service based on the service identifier in the bus creation request; the relay object can forward the bus creation request to the first object via the third communication bus.

[0360] It is understandable that before executing S801, it is necessary to create a third communication bus. In some embodiments, a target function can be called to create a third communication bus. When the programming language is different, the target function called can be different. For example, the third communication bus can be created based on the target function of the C language version provided in the library file (e.g., libsystemd.so). In some examples, if the second communication bus is a D-Bus bus, sd_bus_default can be called to create the third communication bus.

[0361] S802: In response to the bus creation request, control the second object to generate pairing parameters corresponding to the first communication bus.

[0362] The pairing parameters may include a first parameter and a second parameter.

[0363] In some embodiments, the "pairing parameter" may also be referred to as a "socket handle" and the "first parameter" may also be referred to as "socket handle 1" and "socket handle 2".

[0364] The second object may generate pairing parameters using a preconfigured pairing parameter generation method. For example, the pairing parameter generation method may be a socketpair method.

[0365] The first parameter or the second parameter may be used to send or receive a communication message.

[0366] S803: Control the second object to generate a response message corresponding to the bus creation request.

[0367] The response message may include the first parameter or the second parameter, and the response message may also include an identifier of the first object.

[0368] In some embodiments, when the computing device controls the first object to send a bus creation request to the second object through the relay object in the third communication bus, the computing device may control the second object to generate a response message corresponding to the bus creation request.

[0369] In some embodiments, when the computing device controls the first object to receive a bus creation request sent by the second object through the relay object, the computing device may control the first object to generate a response message corresponding to the bus creation request.

[0370] S804: Control the relay object in the third communication bus to forward the response message sent by the second object to the first object.

[0371] In some embodiments, the second object can send a response message to the relay object via the third communication bus; the relay object can determine the first object based on the identifier of the first object in the bus creation request; the relay object can forward the response message to the first object via the third communication bus.

[0372] S805: Control the first object to establish a first communication bus according to the response message.

[0373] In some embodiments, the first object may establish the first communication bus according to the first parameter or the second parameter in the response message.

[0374] It can be understood that after the first communication bus is established, the first object and the second object can communicate based on the first communication bus.

[0375] Next, combine Fig. 9 , the communication process between any two objects on the third communication bus is described.

[0376] Fig. 9 This is a schematic diagram of the communication process on the communication bus provided in the embodiment of the present application. Fig. 9 , including object 1, object 2, object 3 and a relay object, wherein object 1 and object 3, object 1 and object 2, and object 2 and object 3 can communicate through the relay object. For example, object 1 can create a communication bus with object 3 through the relay object to communicate, object 1 can create a communication bus with object 2 through the relay object to communicate, and object 2 can create a communication bus with object 3 through the relay object to communicate.

[0377] Next, taking object 1 and object 3 as an example, the communication process between any two objects is described.

[0378] For a communication process between object 1 and object 3, when the communication message in the communication process is transferred based on the relay object, the following four switching processes between objects are involved:

[0379] Process 1: Object 1 sends a request message to the relay object, which involves a context switch from object 1 to the relay object.

[0380] Process 2: The relay object forwards the request message to object 3, which involves a context switching process from the relay object to object 3;

[0381] Process 3: Object 3 sends a response message to the request message to the relay object, which involves a context switching process from object 3 to the relay object;

[0382] Process 4: The relay object forwards the response message to object 1. This process involves a context switching process from the relay object to object 1.

[0383] based on Fig. 9 In the communication process shown, any two objects in the computing device need to involve multiple object switching processes when using the third communication bus, resulting in a long communication time, which in turn leads to low communication efficiency between any two objects. Therefore, after the first communication bus is established, the third communication bus can be used as a backup communication bus for the first communication bus and will be suspended.

[0384] In order to facilitate understanding of the interaction process between the first object and the second object based on the communication bus, the interaction process between the first object and the second object is described in detail below.

[0385] In some embodiments, when the first object communicates with the second object through the target thread, the first communication bus corresponding to the target thread can be searched through a pre-stored hash table. Optionally, the pre-stored hash table can include identifiers of multiple threads and an identifier of the first communication bus corresponding to each thread.

[0386] When the first communication bus exists, the communication bus can be called to implement the processing of the target thread. During the process of the communication bus implementing the processing of the target thread, the first communication bus will be in a locked state, and other threads will not be able to call the first communication bus.

[0387] In order to speed up the processing efficiency, when forwarding the communication message of the target thread through the first communication bus, an asynchronous call method can be adopted, so that after the first communication bus sends the service request of the target thread to the second object, the first communication bus can change from a locked state to an unlocked state, so that the first communication bus can continue to forward the processing requests of other threads in the first object. Specifically, the first communication bus can send the processing request sent by the first object based on the target thread to the second object through an asynchronous call. After the second object receives the processing request through the first communication bus, it can call the processing method corresponding to the processing request in the thread pool, and process the processing request based on the processing method, and generate a response message of the processing request after the processing is completed, and send the response message to the first object through the first communication bus. The first communication bus can adopt an asynchronous message response method to obtain the response message, and release the response message so that the first object receives the response message.

[0388] In the case where the first communication bus does not exist, the steps shown in steps S801 to S805 can be referred to, the first communication bus can be established through the third communication bus, and after the first communication bus is successfully established, the information of the first communication bus can be recorded in a preset hash table. The information of the first communication bus can include the identifier of the first communication bus, the objects and threads connected to the first communication bus.

[0389] In the case where the first communication bus is not successfully established, the third communication bus can also be used to send the processing request of the target thread of the first object to the second object. In this process, the third communication bus will be in a locked state, and other threads will not be able to call the third communication bus. The second object can receive the processing request of the target thread through the third communication bus, call the processing method corresponding to the processing request in the thread pool, process the processing request based on the processing method, generate a response message of the processing request after the processing is completed, and send the response message to the first object through the third communication bus. Until the first object receives the response message through the third communication bus, the third communication bus can change from a locked state to an unlocked state.

[0390] During the interaction between the first object and the second object, each object can act as a server or a client.

[0391] When each object is a server, the following modules can be created in each object:

[0392] Public bus processing thread: The public bus processing thread may process processing requests on the public communication bus. For example, the public communication bus may be a third communication bus, and the public bus processing thread may be sd_bus_process.

[0393] Independent bus processing thread (server): The independent bus processing thread is used to process the request received by the server through the independent communication bus. The independent bus processing thread of the server can receive the processing request sent by the client through the independent communication bus, and forward the processing request to the thread pool processing module so that the thread pool processing module processes the processing request.

[0394] Method processing thread pool (server): The method processing thread pool can store multiple processing methods. After receiving a processing request, the thread pool module can determine the processing method corresponding to the processing request from multiple processing methods, process the processing request based on the processing method, and generate a response message corresponding to the processing request.

[0395] Method call module (server): The method call module can be used to create an independent communication bus between the first object and the second object. For example, the independent communication bus can be the first communication bus or the second communication bus. The method call module can be used to obtain a bus creation request sent by the client and generate a pairing parameter, which can include a first parameter and a second parameter; the independent bus creation module can also create a communication bus for independent communication between the first object and the second object based on the pairing parameter, and store the bus information of the created communication bus in a preset hash table.

[0396] When each object is a client, each object can include the following modules:

[0397] Independent bus creation module (client): This module can be used to send a bus creation request to the independent communication bus creation module of the server, and to obtain the configuration parameters sent by the independent communication bus creation module of the server, and to establish an independent communication bus based on the configuration parameters, and to store the bus information of the established independent communication bus into a preset hash table, so as to facilitate the subsequent quick search for the bus information of the independent communication bus.

[0398] Independent bus processing thread (client): The independent bus processing thread is used to process requests received by the client through the independent communication bus. For example, after monitoring the independent bus call request of the target thread, the independent bus processing thread can find the independent communication bus corresponding to the target thread and process the processing request of the target thread in an asynchronous processing manner.

[0399] Request processing module: After receiving the processing request of the target thread through the independent communication bus, the module can lock the independent communication bus, call the asynchronous processing method to process the processing request, and release the independent communication bus after calling the asynchronous processing method. The module can also be used to obtain the response message of the processing request sent by the independent bus processing thread.

[0400] The communication method provided in the embodiment of the present application can establish a first communication bus based on a third communication bus to realize independent communication between the first object and the second object through the first communication bus, without the need for a relay object to transfer the communication message between the first object and the second object, avoiding the switching process between the objects on the bus, saving communication time, and improving communication efficiency; it can also monitor the working state and current communication load of the first communication bus, and when the working state is unavailable or the communication load rate is greater than the first threshold, timely create a second communication bus, and coordinate the first communication bus through the second communication bus to avoid the first communication bus being unavailable or the processing efficiency being low, resulting in a decrease in the communication efficiency of the first object and the second object, thereby further improving the communication efficiency. The communication method can connect multiple threads of communication interaction between the first object and the second object through a first communication bus, avoid creating a bus for each thread separately, and help save resources; and the communication method can coordinate multiple threads connected to multiple first communication buses between the first object and the second object to avoid the current communication load of each first communication bus being too high, resulting in the problem of blocking each thread in the first communication bus.

[0401] Fig.10 This is a schematic diagram of the structure of a communication device provided in an embodiment of the present application. Fig.10The communication device 10 may be applied to a computing device in which a first object and a second object are running. The communication device 10 includes:

[0402] The processing module 11 is used to determine the communication load rate and working state of the first communication bus, the first communication bus is used for independent communication between the first object and the second object, and the communication load rate is used to indicate the resource occupation ratio of the first communication bus;

[0403] The processing module 11 is also used to establish a second communication bus for independent communication between the first object and the second object when the working state is an unavailable state or the communication load rate is greater than a first threshold, and coordinate the first communication bus through the second communication bus. The unavailable state is used to indicate that the first object cannot communicate normally with the second object through the first communication bus.

[0404] The communication device provided in the embodiment of the present application can execute the technical solution described in the above method embodiment, and its beneficial effects are similar, which will not be repeated here.

[0405] In a possible implementation, the processing module 11 is specifically configured to:

[0406] Obtaining request durations and request results of multiple threads connected to the first communication bus within a target duration;

[0407] Determine the communication load rate according to the request time of each thread in the multiple threads;

[0408] The work status is determined according to the request duration and request result of each thread in multiple threads.

[0409] In a possible implementation, the processing module 11 is further configured to:

[0410] Determine the bus time consumption of the first communication bus within the target time length based on the request time consumption of each thread;

[0411] Determine the communication load rate based on the bus time and target duration.

[0412] In a possible implementation, the processing module 11 is further configured to:

[0413] Determine a first number according to the request duration of each thread and the corresponding preset duration, the first number being the number of threads whose request duration is greater than the corresponding preset duration;

[0414] Determine a second number according to the request result of each thread, where the second number is the number of threads whose request result is request failure;

[0415] When the first number is greater than or equal to the first preset number or the second number is greater than or equal to the second preset number, determining that the working state is an unavailable state;

[0416] When the first number is less than the first preset number and the second number is less than the second preset number, it is determined that the working state is an available state.

[0417] In a possible implementation, when the working state is an unavailable state, the processing module 11 is further configured to:

[0418] Disconnecting the plurality of threads from the first communication bus;

[0419] A connection between the plurality of threads and the second communication bus is established.

[0420] In a possible implementation, when the communication load rate is greater than the first threshold, the processing module 11 is further configured to:

[0421] Determine a target thread from the plurality of threads according to a second threshold and a request duration of each thread;

[0422] The connection between the target thread and the first communication bus is disconnected, and the connection between the target thread and the second communication bus is established.

[0423] In a possible implementation, when the working state is an available state and the communication load rate is greater than a first threshold, the processing module 11 is further configured to:

[0424] Determine a target thread from the plurality of threads according to a second threshold and a request duration of each thread;

[0425] The connection between the target thread and the first communication bus is disconnected, and the connection between the target thread and the second communication bus is established.

[0426] In a possible implementation, the number of the multiple threads is M, where M is an integer greater than or equal to 2; the processing module 11 is further configured to:

[0427] According to the request time of each thread, determine the first thread among the M threads, where the first thread is the thread with the longest request time among the M threads;

[0428] Determine an initial communication load rate corresponding to the first thread according to the request duration and the target duration of the first thread;

[0429] When the initial communication load rate is less than the second threshold and M is greater than 2, a second thread is determined from the M threads according to the initial communication load rate, the second threshold and the target duration, and the sum of the communication load rate of the second thread and the initial communication load rate is greater than or equal to the second threshold and less than the first threshold, or the sum of the number of the second thread and the number of the first thread is M-1;

[0430] The first thread and the second thread are determined as target threads.

[0431] In a possible implementation, the number of the multiple threads is M, where M is an integer greater than or equal to 2; the processing module 11 is further configured to:

[0432] According to the request time of each thread, determine the first thread among the M threads, where the first thread is the thread with the longest request time among the M threads;

[0433] Determine an initial communication load rate corresponding to the first thread according to the request duration and the target duration of the first thread;

[0434] When the initial communication load rate is greater than or equal to the second threshold, the first thread is determined as the target thread.

[0435] In a possible implementation, the number of the multiple threads is M, where M is an integer greater than or equal to 2; the processing module 11 is further configured to:

[0436] According to the request time of each thread, determine the first thread among the M threads, where the first thread is the thread with the longest request time among the M threads;

[0437] Determine an initial communication load rate corresponding to the first thread according to the request duration and the target duration of the first thread;

[0438] When the initial communication load rate is less than the second threshold and M is equal to 2, the first thread is determined as the target thread.

[0439] In a possible implementation, the processing module 11 is further configured to:

[0440] Sorting the M threads to obtain the sorting results of the M threads;

[0441] Determine the i-th communication load rate corresponding to the first i threads according to the request duration and target duration of the first i threads;

[0442] Among them, i is 1, 2, ... in sequence until the Nth communication load rate corresponding to the first N threads is obtained, the sum of the Nth communication load rate and the initial communication load rate is greater than or equal to the second threshold and less than the first threshold, or N is equal to M-2, the first N threads are determined as the second threads, and N is an integer greater than 1 and less than or equal to M-2.

[0443] In a possible implementation, the processing module 11 is further configured to:

[0444] determining whether a first communication bus exists between the first object and the second object;

[0445] When it is determined that the first communication bus does not exist, the first communication bus is established according to the third communication bus, the third communication bus is a communication bus established between the first object and the second object based on the relay object, and the relay object is used to forward information on the third communication bus.

[0446] In a possible implementation, the processing module 11 is further configured to:

[0447] Controlling the relay object in the third communication bus to forward the bus creation request sent by the first object to the second object;

[0448] In response to the bus creation request, controlling the second object to generate a pairing parameter corresponding to the first communication bus, where the pairing parameter includes a first parameter and a second parameter;

[0449] Controlling the second object to generate a response message corresponding to the bus creation request, where the response message includes the first parameter or the second parameter;

[0450] Controlling the relay object in the third communication bus to forward the response message sent by the second object to the first object;

[0451] The first object is controlled to establish a first communication bus according to the response message.

[0452] In a possible implementation, the processing module 11 is further configured to:

[0453] Controlling the first object to send a bus creation request to the second object through a relay object in the third communication bus;

[0454] In response to the bus creation request, controlling the second object to generate a pairing parameter corresponding to the first communication bus, where the pairing parameter includes a first parameter and a second parameter;

[0455] Controlling the second object to generate a response message corresponding to the bus creation request, where the response message includes the first parameter or the second parameter;

[0456] Controlling the first object to receive a response message sent by the second object through a relay object in the third communication bus;

[0457] The first object is controlled to establish a first communication bus according to the response message.

[0458] In a possible implementation, the processing module 11 is further configured to:

[0459] Controlling the first object to receive the bus creation request sent by the second object through the relay object in the third communication bus;

[0460] In response to the bus creation request, controlling the first object to generate a pairing parameter corresponding to the first communication bus, where the pairing parameter includes a first parameter and a second parameter;

[0461] Controlling the first object to generate a response message corresponding to the bus creation request, where the response message includes the first parameter or the second parameter;

[0462] Controlling the second object to receive a response message sent by the first object through a relay object in the third communication bus;

[0463] The second object is controlled to establish a first communication bus according to the response message.

[0464] Fig.11 A hardware structure diagram of a computing device provided in an embodiment of the present application. Fig.11 The computing device 20 may include a processor 21 and a memory 22, and the processor 21 and the memory 22 are coupled. The processor 21 and the memory 22 may communicate with each other; illustratively, the processor 21 and the memory 22 communicate with each other via a communication bus 23.

[0465] The memory 22 is used to store computer instructions;

[0466] The processor 21 is used to execute the computer instructions stored in the memory 22 to implement the technical solution shown in the above method embodiment.

[0467] Optionally, the computing device 20 may further include a communication interface, which may include a transmitter and / or a receiver.

[0468] Optionally, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.

[0469] An embodiment of the present application provides a computer-readable storage medium, on which computer-executable instructions are stored; when the computer-executable instructions are executed by a processor, they are used to implement the communication method described in the above embodiment.

[0470] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the computer executes the communication method described in the above embodiment.

[0471] All or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned memory (storage medium) includes: read-only memory (English: read-only memory, abbreviated: ROM), RAM, flash memory, hard disk, solid state drive, magnetic tape (English: magnetic tape), floppy disk (English: floppy disk), optical disc (English: optical disc) and any combination thereof.

[0472] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable terminal device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0473] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0474] These computer program instructions can also be loaded onto a computer or other programmable terminal device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0475] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present application, rather than to limit them. Although the embodiments of the present application have been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A communication method, characterized in that: Applied to a computing device, wherein a first object and a second object are running on the computing device, the method comprises: Determining a communication load rate and a working state of a first communication bus, wherein the first communication bus is used for independent communication between the first object and the second object, and the communication load rate is used to indicate a resource occupancy ratio of the first communication bus; When the working state is an unavailable state or the communication load rate is greater than a first threshold, a second communication bus for independent communication between the first object and the second object is established, and the first communication bus is coordinated through the second communication bus, wherein the unavailable state is used to indicate that the first object cannot communicate normally with the second object through the first communication bus.

2. The method according to claim 1, characterized in that The determining of the communication load rate and the working state of the first communication bus includes: Obtaining request durations and request results of multiple threads connected to the first communication bus within a target duration; Determining the communication load rate according to the request time consumption of each thread in the multiple threads; The working status is determined according to the request duration and request result of each thread in the multiple threads.

3. The method according to claim 2, characterized in that The determining the communication load rate according to the request time consumption of each thread in the multiple threads includes: Determine the bus time consumption of the first communication bus within the target time length based on the request time consumption of each thread; The communication load rate is determined according to the bus time consumption and the target time length.

4. The method according to claim 2 or 3, characterized in that: The determining the working state according to the request duration and request result of each thread in the multiple threads includes: Determine a first number according to the request duration of each thread and the corresponding preset duration, where the first number is the number of threads whose request duration is greater than the corresponding preset duration; Determine a second number according to the request result of each thread, where the second number is the number of threads whose request result is request failure; When the first number is greater than or equal to a first preset number or the second number is greater than or equal to a second preset number, determining that the working state is an unavailable state; In a case where the first number is smaller than the first preset number and the second number is smaller than the second preset number, it is determined that the working state is an available state.

5. The method according to any one of claims 1 to 4, characterized in that: When the working state is the unavailable state, the coordinating process of the first communication bus through the second communication bus includes: Disconnecting the plurality of threads from the first communication bus; A connection between the plurality of threads and the second communication bus is established.

6. The method according to any one of claims 1 to 4, characterized in that: When the communication load rate is greater than the first threshold, the coordinating process of the first communication bus through the second communication bus includes: Determine a target thread from the plurality of threads according to a second threshold and a request duration of each thread; The connection between the target thread and the first communication bus is disconnected, and the connection between the target thread and the second communication bus is established.

7. The method according to claim 6, characterized in that The number of the plurality of threads is M, where M is an integer greater than or equal to 2; Determining a target thread from the multiple threads according to the second threshold and the request time consumption of each thread includes: Determine a first thread among the M threads according to the request time consumed by each thread, where the first thread is a thread having the longest request time consumed among the M threads; Determining an initial communication load rate corresponding to the first thread according to the request duration and the target duration of the first thread; When the initial communication load rate is less than the second threshold and M is greater than 2, a second thread is determined from the M threads according to the initial communication load rate, the second threshold and the target duration, the sum of the communication load rate of the second thread and the initial communication load rate is greater than or equal to the second threshold and less than the first threshold, or the sum of the number of the second thread and the number of the first thread is M-1; The first thread and the second thread are determined as the target threads.

8. The method according to claim 7, characterized in that The determining the second thread from the M threads according to the initial communication load rate, the second threshold, and the target duration includes: Sorting the M threads to obtain a sorting result of the M threads; Determine the i-th communication load rate corresponding to the first i threads according to the request duration of the first i threads and the target duration; wherein i is sequentially taken as 1, 2, ..., until the N-th communication load rate corresponding to the first N threads is obtained, and the sum of the N-th communication load rate and the initial communication load rate is greater than or equal to the second threshold and less than the first threshold, or, N is equal to M-2, and the first N threads are determined as the second threads, and N is an integer greater than 1 and less than or equal to M-2.

9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: determining whether the first communication bus exists between the first object and the second object; When it is determined that the first communication bus does not exist, the first communication bus is established according to a third communication bus, wherein the third communication bus is a communication bus established between the first object and the second object based on a relay object, and the relay object is used to forward information on the third communication bus.

10. A computing device, characterized in that include: Processor and memory; The processor is coupled to the memory; The memory is used to store program instructions; The processor is used to execute the program instructions to implement the method according to any one of claims 1 to 9.