Task processing method, task collaboration method and terminal device

By enabling multiple terminal devices to collaboratively process tasks and selecting the optimal target terminal and its communication method, the problem of insufficient computing resources on terminal devices is solved, thereby improving task execution efficiency and user experience.

CN120762872BActive Publication Date: 2026-07-07HONOR DEVICE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-08-16
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Insufficient computing resources on terminal devices prevent them from effectively handling tasks with high computing power requirements, resulting in long computation time delays, reduced device battery life, and a degraded user experience.

Method used

By coordinating task processing across multiple terminal devices, the optimal target terminal and its communication method are selected, and the computing resources of the target terminal are utilized to process the task, thus avoiding excessive consumption of computing resources by a single terminal device.

Benefits of technology

It increases the likelihood of successful task execution, optimizes the user experience, reduces the impact of collaborative processing on the target terminal on its own tasks, and avoids excessive consumption of device resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120762872B_ABST
    Figure CN120762872B_ABST
Patent Text Reader

Abstract

The application provides a task processing method, a task cooperation method, a terminal device, a storage medium and a program product. In the method, a target terminal cooperates with a first terminal to process a to-be-processed task under a target communication mode, which makes up for the defect of insufficient computing resources when the first terminal processes the to-be-processed task. When the target terminal and the corresponding target communication mode for cooperating with the first terminal to process the to-be-processed task are determined, the target terminal and the target communication mode are determined according to the corresponding ability performance of the second terminal when cooperating with the first terminal to process a historical task, which can improve the possibility of successfully executing the to-be-processed task. At the same time, since the ability performance of the target terminal in processing the historical task from the first terminal under the target communication mode is optimal, the scheme can greatly reduce the influence of the above-mentioned cooperation processing of the target terminal on the processing of the target terminal's own task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a task processing method, a task collaboration method, a terminal device, a storage medium, and a program product. Background Technology

[0002] With the rapid development of terminal device hardware and software technologies, the hardware computing power and software algorithm capabilities of terminal devices have seen significant improvements in recent years. This substantial increase in hardware computing power and software algorithm capabilities has provided a solid foundation for the implementation of various emerging technologies. These emerging technologies include intelligent services, ultra-high-definition audio and video processing, ultra-low latency human-computer interaction, AI large-model inference, video super-resolution, and video AI enhancement. These emerging technologies represent the future competitive advantages of terminal devices in the market.

[0003] However, while these emerging technologies enhance the user experience, they also pose new challenges to the terminal devices themselves. For example, tasks related to these emerging technologies are often computationally demanding, requiring substantial computing resources to complete. Current terminal devices, however, lack sufficient computing resources to handle these computationally intensive tasks. Summary of the Invention

[0004] This application provides a task processing method, a task collaboration method, a terminal device, a storage medium, and a program product, in which a target terminal collaborates with a first terminal to process a task to be processed, thereby compensating for the lack of computing resources when the first terminal processes tasks with high computing power requirements and avoiding excessive consumption of computing resources by a single terminal device.

[0005] To achieve the above objectives, this application adopts the following technical solution:

[0006] In a first aspect, a task processing method is provided, the method being applied to a first terminal, the first terminal having device collaboration functionality, the method comprising:

[0007] With the device collaboration function of the first terminal enabled, a second terminal capable of collaborating with the first terminal to process tasks is determined from among multiple terminals with a first communication connection to the first terminal, along with the multiple communication methods supported by the second terminal with the first terminal. Since there can be multiple second terminals capable of collaborating with the first terminal to process tasks, and multiple communication methods supported by the second terminal with the first terminal, a target terminal and its corresponding target communication method can be determined from the second terminals based on the second terminal's performance in processing historical tasks from the first terminal under its supported communication methods. The target terminal's performance in processing historical tasks from the first terminal under the target communication method is optimal. Then, when a task to be processed is determined, if the current communication method between the first terminal and the target terminal is inconsistent with the target communication method, a second communication connection needs to be established with the target terminal according to the target communication method. The task to be processed is then sent to the target terminal through the second communication connection, and the target terminal processes the task. If the current communication method between the first terminal and the target terminal is consistent with the target communication method, the task to be processed is sent to the target terminal through the current communication method, and the target terminal processes the task. The first terminal also receives the task processing result returned by the target terminal.

[0008] Based on the above technical solution, in this embodiment, the target terminal collaborates with the first terminal to process the task under the target communication mode, thus compensating for the insufficient computing resources of the first terminal when processing the task and avoiding excessive consumption of computing resources by a single terminal device. Furthermore, in determining the target terminal and its corresponding target communication mode for collaborating with the first terminal to process the task, the task is not simply randomly assigned to other terminal devices. Instead, the target terminal and target communication mode are determined based on the performance of the second terminal in collaborating with the first terminal to process historical tasks. The target terminal demonstrates optimal performance in processing historical tasks from the first terminal under the target communication mode. Therefore, when the target terminal collaborates with the first terminal to process the task, the likelihood of the task being successfully executed is increased, thereby improving the user experience of the first terminal. Simultaneously, since the target terminal demonstrates optimal performance in processing historical tasks from the first terminal under the target communication mode, this solution significantly reduces the impact of the aforementioned collaborative processing on the target terminal's own task processing, thereby avoiding deterioration of the user experience on the collaborating device.

[0009] In one possible implementation of the first aspect, the performance characteristics include latency and power consumption, and the optimal performance characteristics are a balance between latency and power consumption. This embodiment uses both latency and power consumption as factors to evaluate the terminal's task processing capabilities.

[0010] In one possible implementation of the first aspect, the task to be processed is the current subtask among a plurality of subtasks to be processed sequentially. The second terminal processes the capability performance corresponding to the historical task, including: the second terminal processes the capability performance corresponding to the subtask preceding the current subtask; after receiving the task processing result returned by the target terminal, the second terminal returns to the step of determining the target terminal and its corresponding target communication method from the second terminal based on the capability performance corresponding to the historical task from the first terminal processed by the second terminal under the multiple communication methods supported with the first terminal.

[0011] In this embodiment, after each subtask is processed, the performance of the second terminal that processed the subtask and its corresponding communication method changes. Therefore, it is necessary to update the target terminal and its corresponding target communication method in a timely manner to ensure that the performance of the currently determined target terminal in processing the current subtask under the target communication method is optimal, which greatly reduces the impact of the above-mentioned collaborative processing of the target terminal on the processing of the target terminal's own tasks.

[0012] In one possible implementation of the first aspect, determining the target terminal and its corresponding target communication method from the second terminals based on the capability performance of the second terminal in processing historical tasks from the first terminal under multiple supported communication methods with the first terminal includes: determining the actual capability gain of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal based on the capability performance of the second terminal in processing historical tasks from the first terminal under multiple supported communication methods with the first terminal; and determining the target terminal and its corresponding target communication method from the second terminals based on one or more of the actual capability gain of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal, the total number of historical tasks, and the number of historical tasks processed by the second terminal under each supported communication method with the first terminal.

[0013] In this embodiment, the actual capability benefit can be determined based on the performance of the second terminal and the communication method in executing historical tasks. The better the capability performance, the greater the corresponding actual capability benefit. Thus, the optimal combination for processing historical tasks (i.e., target terminal + target communication method) can be determined based on one or more of the following: the actual capability benefit of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal, the total number of historical tasks, and the number of historical tasks processed by the second terminal under each supported communication method with the first terminal. This provides a method for measuring the performance of processing historical tasks based on actual capability benefits.

[0014] In one possible implementation of the first aspect, determining the second terminal capable of cooperating with the first terminal to process tasks from among the plurality of terminals based on one or more of the available computing power, remaining battery power, and whether it is in a charging state includes: determining the terminal as the second terminal capable of cooperating with the first terminal to process tasks when one or more of the available computing power, remaining battery power, and whether it is in a charging state of the terminal meet a first preset condition; the first preset condition is: the available computing power of the terminal is greater than or equal to a first threshold and the remaining battery power of the terminal is greater than or equal to a second threshold; or, the available computing power of the terminal is greater than or equal to the first threshold, the remaining battery power of the terminal is less than the second threshold, and the terminal is in a charging state.

[0015] This embodiment describes how to determine a second terminal from multiple terminals that can collaborate with the first terminal to process tasks, based on device information.

[0016] In one possible implementation of the first aspect, the method further includes: if it is determined that the first terminal and the second terminal are initially connected, generating a first initialization task; transmitting the first initialization task to the second terminal through a communication method supported by the second terminal, and having the second terminal process it; receiving the task processing result returned by the second terminal, and determining the capability performance of the second terminal in processing the first initialization task under multiple communication methods supported by the first terminal; the capability performance of the second terminal in processing the historical task includes: the capability performance of the second terminal in processing the first initialization task.

[0017] In this embodiment, for the second terminal that is connecting for the first time, it has not processed any historical tasks from the first terminal. At this time, the first terminal can generate a first initialization task and transmit the first initialization task to the second terminal through the communication methods supported by the second terminal. The second terminal processes the task, and thus the capability performance of the second terminal in processing historical tasks (including the first initialization task) under the multiple communication methods supported by the first terminal can be obtained.

[0018] Secondly, a task collaboration method is provided, applied to a second terminal, the second terminal having a device collaboration function, and the second terminal having a first communication connection with a first terminal. The method includes: when the device collaboration function of the second terminal is enabled, if a connection request to establish a second communication connection is received from the first terminal, then a second communication connection is established with the first terminal based on the connection request to establish the second communication connection; receiving a task to be processed from the first terminal through the second communication connection, and processing the task to be processed; if a task to be processed is received from the first terminal through the current communication method, then the task to be processed is processed; and returning the task processing result to the first terminal.

[0019] In this embodiment, the second terminal can work with the first terminal to process the tasks to be processed from the first terminal and return the task processing results to the first terminal, thus making up for the lack of computing resources when the first terminal processes tasks with high computing power requirements and avoiding excessive consumption of computing resources of a single terminal device.

[0020] In one possible implementation of the second aspect, the method further includes: if the second terminal is initially connected to the first terminal, receiving a first initialization task from the first terminal through multiple communication methods supported by the second terminal; processing the first initialization task, and returning the task processing result to the first terminal through multiple communication methods supported by the second terminal.

[0021] In this embodiment, before determining the target terminal and its corresponding target communication method from the second terminal based on the second terminal's ability to process historical tasks from the first terminal under the supported communication methods with the first terminal, the second terminal needs to have processed historical tasks from the first terminal under the supported communication methods with the first terminal. Only in this way can the second terminal's ability to process historical tasks from the first terminal under the supported communication methods with the first terminal be known. For the second terminal connecting for the first time, it has not processed historical tasks from the first terminal. At this time, the first terminal can generate a first initialization task and transmit the first initialization task to the second terminal through the communication methods supported by the second terminal. The second terminal processes the task and returns the task processing result to the first terminal. The first terminal can then obtain the second terminal's ability to process historical tasks (including the first initialization task) under the supported communication methods with the first terminal.

[0022] In one possible implementation of the second aspect, after sending the device information of the second terminal to the first terminal through the first communication connection, the method further includes: receiving a query request from the first terminal; in response to the query request, obtaining the updated device information of the second terminal, and sending the updated device information of the second terminal to the first terminal.

[0023] In this embodiment, the first terminal periodically sends query requests to multiple terminals, and the second terminal responds to the query requests by returning its updated device information. In this way, the first terminal can promptly obtain the updated device information of multiple second terminals and update the target terminal and its corresponding target communication method accordingly. This ensures that the determined target terminal's ability to perform historical tasks under the target communication method is optimal. This scheme can significantly reduce the impact of the aforementioned collaborative processing on the target terminal's own task processing, thereby avoiding deterioration of the user experience on the collaborative devices.

[0024] In one possible implementation of the second aspect, after sending the device information of the second terminal to the first terminal through the first communication connection, the method further includes: when it is detected that the second terminal changes from being able to cooperate with the first terminal to being unable to cooperate with the first terminal to be able ... be able to cooperate with the first terminal to be able to be able to be able to be able to be able to cooperate with the first terminal to be able to be able to be able to be able to be able to cooperate with the first terminal to be able to be able to be able to be able to be able to be able to cooperate with the first terminal to be able to be able to be able to be able to be able to be able to cooperate with the first terminal to be able to be able to be able to be able to be able to be able to cooperate with the first terminal to be able to be able to be able to be able to be able to be able to be able to be able to cooperate with the first terminal to be able to be able to be able to be able to be able to be able to be able to be able to cooperate with the first terminal to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to cooperate with the first terminal to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to be able to

[0025] In this embodiment, the second terminal monitors its own device information. If, based on the detected device information, the second terminal determines that it has changed from being able to collaborate with the first terminal on tasks to not being able to collaborate (e.g., the second terminal's available computing power changes from 0% to 80%), or from not being able to collaborate on tasks to being able to collaborate (e.g., the second terminal's available computing power is 80%, remaining battery power is 35%, and it changes from being unplugged to being plugged in), the second terminal sends device change information to the first terminal. The first terminal receives device change information from multiple terminals. In this way, the first terminal can update the target terminal and its corresponding target communication method in a timely manner based on the device change information from multiple second terminals, ensuring that the target terminal's ability to execute historical tasks under the target communication method is optimal. This scheme can greatly reduce the impact of the aforementioned collaborative processing on the target terminal's own task processing, thereby avoiding deterioration of the user experience on collaborative devices.

[0026] Thirdly, a terminal device is provided, characterized in that the terminal device includes a memory and a processor, the memory being used to store instructions, which, when executed by the processor, cause the terminal device to implement the task processing method in the first aspect or any possible implementation of the first aspect, or to implement the task coordination method in the second aspect or any possible implementation of the second aspect.

[0027] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed, implement the task processing method in the first aspect or any possible implementation of the first aspect, or implement the task coordination method in the second aspect or any possible implementation of the second aspect.

[0028] Fifthly, a computer program product is provided, the computer program product comprising: computer program code, which, when executed on a computer, causes the processor to implement the task processing method in the first aspect or any possible implementation of the first aspect, or to implement the task coordination method in the second aspect or any possible implementation of the second aspect.

[0029] Based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. Attached Figure Description

[0030] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0031] Figure 2This is a software structure block diagram of an electronic device provided in an embodiment of this application;

[0032] Figure 3 This is a schematic diagram of a scenario where devices A, B, and C collaboratively process tasks, as provided in an embodiment of this application.

[0033] Figure 4 This is a flowchart illustrating the collaborative task processing of devices A, B, and C provided in an embodiment of this application.

[0034] Figure 5 This is a flowchart illustrating a task processing method provided in an embodiment of this application;

[0035] Figure 6 This is a schematic diagram of a scenario where a first terminal connects to multiple terminals, as provided in an embodiment of this application.

[0036] Figure 7 This is a flowchart illustrating a task processing method provided in an embodiment of this application;

[0037] Figure 8 This is a flowchart illustrating a task processing method provided in an embodiment of this application;

[0038] Figure 9 This is a flowchart illustrating a task collaboration method provided in an embodiment of this application;

[0039] Figure 10 This is a flowchart illustrating a task collaboration method provided in an embodiment of this application;

[0040] Figure 11 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application. Detailed Implementation

[0041] The technical solutions in this application will now be described with reference to the accompanying drawings.

[0042] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. "And / or" in this document is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone.

[0043] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "a plurality of" means two or more.

[0044] First, some terms used in the embodiments of this application will be explained to facilitate understanding by those skilled in the art.

[0045] (1)BLE

[0046] Bluetooth Low Energy (BLE) is a low-power Bluetooth technology designed for small data transfers and long battery life. Its features include low power consumption, low cost, and short-range communication (typically within 10 meters), making it suitable for Internet of Things (IoT) devices and health monitoring devices.

[0047] Devices that support BLE wireless communication technology include: smartwatches, smartphones, wireless headphones, health monitoring devices, smart home devices, etc.

[0048] (2) WiFi

[0049] Wireless Fidelity (WiFi) is a wireless network technology that allows electronic devices to connect to a wide area network, typically the Internet, via wireless signals. WiFi provides wireless local area network (WLAN) access, supports simultaneous connections of multiple devices, allows devices to roam between different access points, and usually requires a wireless access point (such as a router) to create the network.

[0050] Devices that support WiFi wireless communication technology include: smartphones, tablets, smart home devices, network devices, wearable devices, etc.

[0051] (3)BR

[0052] Bluetooth Radio (BR), also known as Bluetooth Base Rate, is the standard Bluetooth technology that predates Bluetooth Low Energy (BLE). Its characteristics include higher power consumption compared to BLE, but it supports larger data transfer volumes, such as audio streaming, and its communication range is typically around 10 meters.

[0053] Devices that support BR wireless communication technology include: wireless headsets, in-vehicle hands-free systems, wireless mice and keyboards, Bluetooth speakers, etc.

[0054] (3) P2P

[0055] Peer-to-peer (P2P) is a network communication model in which each node (called a "peer" or "peer") can act as either a client requesting services or a server providing services. In this model, there is no need for a centralized server or centralized control; nodes can communicate and exchange data directly with each other.

[0056] 2.4G P2P refers to point-to-point communication technology operating in the 2.4GHz frequency band. Its characteristics include: it is typically used in devices such as wireless mice, keyboards, and game controllers; and its communication distance is relatively short, generally within 10 meters. Devices supporting 2.4G P2P wireless communication technology include: wireless mice and keyboards, game controllers, wireless cameras, and wireless print servers.

[0057] 5G P2P refers to point-to-point communication technology operating in the 5GHz frequency band. Its characteristics include: compared to 2.4GHz, the 5GHz band has a wider bandwidth, less interference, and typically higher communication distance and speed, making it suitable for high-speed data transmission. Devices supporting 5G P2P wireless communication technology include: wireless network adapters, wireless backup cameras, and wireless multimedia transmission devices.

[0058] The above is a brief introduction to the terms used in the embodiments of this application, and will not be repeated below.

[0059] With the rapid development of terminal device hardware and software technologies, the hardware computing power and software algorithm capabilities of terminal devices have seen significant improvements in recent years. This substantial improvement has provided a solid foundation for the implementation of various emerging technologies. These emerging technologies include intelligent services, ultra-high-definition audio and video processing, ultra-low latency human-computer interaction, large-scale artificial intelligence (AI) model inference, video super-resolution, and video AI enhancement. These emerging technologies represent the future competitive advantages of terminal devices in the market.

[0060] However, while these emerging technologies enhance the user experience, they also pose new challenges to the terminal devices themselves. For example, tasks related to these emerging technologies are often computationally demanding, requiring substantial computing resources. Current terminal devices, however, lack sufficient computing resources, leading to the following pain points when handling these computationally demanding tasks:

[0061] (1) The hardware capabilities of different types, configurations and hardware platforms of terminal devices such as mobile phones, personal access devices (PADs) and personal computers (PCs) vary greatly. In particular, the computing resources of some mobile phones and PADs with low-end chip configurations are seriously insufficient when handling these high computing power tasks.

[0062] (2) For a given task with high computing power requirements, insufficient computing resources of the terminal device will inevitably lead to a large delay in the completion of the overall task, which will cause users to experience delays and stutters when using real-time applications such as voice assistant interaction and video super-resolution rendering on the terminal device, greatly reducing the user experience.

[0063] (3) Tasks with high computing power requirements will inevitably increase the usage and overhead of the device's central processing unit (CPU) and / or graphics processing unit (GPU), resulting in reduced device battery life and even overheating.

[0064] To address the performance bottleneck of insufficient computing resources in a single terminal device, future terminal devices will shift from processing tasks requiring high computing power independently to processing them collaboratively by multiple terminal devices. By coordinating the processing of tasks requiring high computing power among multiple terminal devices, the user experience can be guaranteed while avoiding excessive consumption of resources by a single terminal device.

[0065] The following is an example of two terminal devices working together to handle tasks with high computing power requirements.

[0066] (1) The mobile terminal uses a large model to understand the content of the user's current display page in order to provide more accurate smart assistant interaction and smart service recommendations. In this process, the task of understanding the content of the display page on the mobile terminal is divided into multiple sub-tasks, and some of the sub-tasks are transferred to the PC terminal to utilize the PC terminal's surplus GPU resources for calculation. After completion, the calculation results are transferred to the mobile terminal for integration. With the assistance of PC computing power, the completion time of the entire large model inference task is significantly accelerated, ensuring the user experience.

[0067] (2) Due to limitations such as network conditions, users can only obtain low-resolution video streams from the server side on their mobile devices. Then, the mobile devices can work with the PC in the near field to transmit the low-bitrate video stream to the PC side for video super-resolution and AI enhancement processing. After completion, the PC side transmits the processed high-bitrate video to the mobile devices for rendering, so that users can have a better video viewing experience even in weak network conditions.

[0068] However, when multiple terminal devices are processing tasks collaboratively, it is not simply a matter of randomly assigning tasks to other terminal devices. Instead, the impact of collaborative task processing on the user experience needs to be considered. Otherwise, not only will the user experience on the local device not be optimized, but the user experience on other collaborative devices will also be degraded.

[0069] In view of this, embodiments of this application provide a task processing method. The task processing method is applied to a first terminal, which has a device collaboration function. When the device collaboration function of the first terminal is enabled, a second terminal capable of collaborating with the first terminal to process tasks, and multiple communication methods supported by the second terminal with the first terminal, can be determined from multiple terminals with a first communication connection to the first terminal. Since there can be multiple second terminals capable of collaborating with the first terminal to process tasks, and multiple communication methods supported by the second terminal with the first terminal, embodiments of this application determine a target terminal and its corresponding target communication method from the second terminals based on the second terminal's ability to process historical tasks from the first terminal under the supported multiple communication methods. The target terminal's ability to process historical tasks from the first terminal under the target communication method is optimal. Subsequently, if the current communication method between the first terminal and the target terminal is inconsistent with the target communication method, a second communication connection needs to be established with the target terminal according to the target communication method. The task to be processed is then sent to the target terminal through the second communication connection, and the target terminal processes the task. If the current communication method between the first terminal and the target terminal is consistent with the target communication method, the task to be processed is sent to the target terminal through the current communication method, and the target terminal processes the task. The first terminal also receives the task processing result returned by the target terminal.

[0070] In this embodiment, the target terminal collaborates with the first terminal to process the task under the target communication mode, compensating for the insufficient computing resources of the first terminal when processing the task and avoiding excessive consumption of computing resources by a single terminal device. Furthermore, in determining the target terminal and its corresponding target communication mode for collaborating with the first terminal to process the task, the task is not simply randomly assigned to other terminal devices. Instead, the target terminal and target communication mode are determined based on the performance of the second terminal in collaborating with the first terminal to process historical tasks. The target terminal demonstrates optimal performance in processing historical tasks from the first terminal under the target communication mode. Therefore, when the target terminal collaborates with the first terminal to process the task, the likelihood of the task being successfully executed is increased, thereby improving the user experience of the first terminal. Simultaneously, since the target terminal demonstrates optimal performance in processing historical tasks from the first terminal under the target communication mode, this solution significantly reduces the impact of the aforementioned collaborative processing on the target terminal's own task processing, thus avoiding deterioration of the user experience on the collaborating device.

[0071] This application also provides a task collaboration method applied to a second terminal. The second terminal has a device collaboration function, and the second terminal has a first communication connection with a first terminal. The task collaboration method includes: when the device collaboration function of the second terminal is enabled, if a connection request to establish a second communication connection is received from the first terminal, a second communication connection is established with the first terminal based on the connection request; receiving and processing a task to be processed from the first terminal through the second communication connection; if a task to be processed is received from the first terminal through the current communication method, the task to be processed is processed; and returning the task processing result to the first terminal.

[0072] In this embodiment, the second terminal can work with the first terminal to process the tasks to be processed from the first terminal and return the task processing results to the first terminal, thus making up for the lack of computing resources when the first terminal processes the tasks to be processed and avoiding excessive consumption of computing resources of a single terminal device.

[0073] In this embodiment, the second terminal collaborates with the first terminal to process tasks. The task processing method is applied to the first terminal, and the task collaboration method is applied to the second terminal. The first and second terminals can be heterogeneous or non-heterogeneous terminal devices. If the first and second terminals are heterogeneous, that is, they differ significantly in hardware architecture, software platform, network capabilities, computing power, storage capacity, energy management, and user interface.

[0074] The aforementioned terminal devices can be mobile phones, wearable devices, tablets, personal computers (PCs), virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in self-driving vehicles, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, and so on. The embodiments of this application do not limit the specific technology or device form used in the terminal devices.

[0075] To better understand the embodiments of this application, the following uses a mobile phone as an example of the terminal device, combined with... Figure 1 The structure of the terminal device according to the embodiments of this application will be described.

[0076] Terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.

[0077] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the terminal device 100. In other embodiments of this application, the terminal device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0078] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.

[0079] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0080] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0081] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the terminal device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.

[0082] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.

[0083] The wireless communication function of the terminal device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor.

[0084] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. The mobile communication module 150 can provide solutions for wireless communication applications, including 2G / 3G / 4G / 5G, on the terminal device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.

[0085] The wireless communication module 160 can provide solutions for wireless communication applications on the terminal device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0086] In some embodiments, the antenna 1 of the terminal device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology.

[0087] Terminal device 100 implements display functions through a GPU, display screen 194, and application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0088] The display screen 194 is used to display images, display videos, and receive swipe operations, etc. The display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal device 100 may include one or more display screens 194.

[0089] Terminal device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0090] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's image sensor. The light signal is converted into an electrical signal, and the camera's image sensor transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0091] Camera 193 is used to capture still images or videos. An object is projected onto an image sensor through the lens, generating an optical image. The image sensor can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The image sensor converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the terminal device 100 may include one or more cameras 193.

[0092] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the terminal device 100. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.

[0093] Internal memory 121 can be used to store executable program code, including instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of the terminal device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional applications and data processing of the terminal device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory located within the processor.

[0094] Terminal device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[0095] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Terminal device 100 can receive button input and generate key signal inputs related to user settings and function control of terminal device 100.

[0096] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. Indicator 192 can be an indicator light, used to indicate charging status, battery level changes, or to indicate messages, missed calls, notifications, etc.

[0097] The SIM card interface 195 is used to connect the SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to achieve contact and separation with the terminal device 100.

[0098] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the terminal device 100. In other embodiments of this application, the terminal device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0099] For example, a "module" can be a software program, a hardware circuit, or a combination of both that implements the above functions. The hardware circuit may include an application-specific integrated circuit (ASIC), electronic circuitry, a processor (e.g., a shared processor, a proprietary processor, or a group processor) and memory for executing one or more software or firmware programs, integrated logic circuitry, and / or other suitable components that support the described functions.

[0100] Therefore, the modules of the various examples described in the embodiments of this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0101] The software system of terminal device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses the layered architecture Android system as an example to exemplify the software structure of terminal device 100. It should be noted that, in this embodiment, the operating system of the electronic device may include, but is not limited to, [other applications]. (Symbian) (Android) , (iOS) This application does not limit the scope of operating systems such as Blackberry and HarmonyOS.

[0102] Figure 2 This is a software structure block diagram of the terminal device 100 according to an embodiment of the present invention.

[0103] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0104] The application layer can include a series of application packages.

[0105] like Figure 2 As shown, the application package may include applications such as camera, calendar, maps, gallery, and video. The camera application is one that has shooting and video recording capabilities; the electronic device can respond to the user's action of opening the camera application to take photos or record videos. It is understood that the camera application's photo and video recording functions can also be invoked by other applications. The gallery stores images and videos taken by the electronic device, and may also store images or videos obtained via Bluetooth or other means.

[0106] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0107] like Figure 2 As shown, the application framework layer may include a window manager, content provider, notification manager, view system, file system, etc.

[0108] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.

[0109] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.

[0110] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of download completion or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0111] A view system includes visual controls, such as controls that display text and controls that display images. View systems can be used to build applications. A user interface can consist of one or more views. For example, a user interface that includes a text message notification icon could include views that display text and views that display images.

[0112] The file system allows applications to read the contents of the file system and display them through the applications.

[0113] The Android Runtime consists of core libraries and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.

[0114] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.

[0115] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0116] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), image processing modules, etc.

[0117] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.

[0118] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

[0119] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0120] The image processing module is used to edit and process images.

[0121] The kernel layer is the layer between hardware and software. The kernel layer includes at least display drivers, camera drivers, etc. In some embodiments, the camera driver controls the operation of the camera, and the display driver controls the display screen to show images.

[0122] The technical solution of this application and how it solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be implemented independently or in combination with each other. The same or similar concepts or processes may not be described again in some embodiments.

[0123] For ease of understanding, the embodiments of this application are combined with the appendix. Figure 3Taking device A as the first terminal and devices B and C as the second terminals as the second terminals, this paper describes a scenario where the second terminals (devices B and C) collaborate with the first terminal (device A) to process a target task (including subtasks 1, 2, and 3). It should be noted that the appendix... Figure 3 Device A is a mobile phone, Device B is a desktop computer, and Device C is a tablet computer. These are for illustrative purposes only and do not necessarily represent a complete design. Figure 3 The above is the limit.

[0124] The method by which the second terminal (device B and device C) collaborates with the first terminal (device A) to process the target task is as follows: Figure 4 As shown, the specific steps include:

[0125] Step S101: When device A detects that the device collaboration function has been enabled, it broadcasts a connection request to multiple terminals within its effective communication range.

[0126] Device A supports device collaboration functionality. Specifically, Device A can be configured with a switch control. When the switch control is turned on, the device collaboration functionality is enabled; when the switch control is turned off, the device collaboration functionality is disabled.

[0127] When device A detects that the device collaboration function is enabled, it broadcasts connection requests to multiple terminal devices within its effective communication range. The effective communication range of device A refers to the Bluetooth connection range of device A, the wireless LAN connection range of device A, etc.

[0128] It is worth noting that after the collaboration function is enabled, device A can also periodically send connection request broadcasts to terminal devices within its effective communication range, thereby proactively discovering newly added terminal devices within device A's effective communication range.

[0129] Step S102: After receiving the connection request broadcast, devices B and C establish the first communication connection with device A.

[0130] Assuming that the effective communication range of device A refers to its Bluetooth connection range, and that Bluetooth is enabled on devices B and C, and devices B and C are within the Bluetooth connection range of device A, then after device A sends a connection request broadcast to terminal devices within its Bluetooth connection range, devices B and C can receive this connection request broadcast. This connection request broadcast can be a Bluetooth discovery broadcast. After devices B and C send Bluetooth connection requests to device A based on the Bluetooth discovery broadcast, devices B and C establish a first communication connection with device A. The communication method for this first communication connection is Bluetooth communication.

[0131] Assuming that the effective communication range of device A refers to the Wi-Fi connection range of device A, and devices B and C have their Wi-Fi enabled and are within the same Wi-Fi network as device A, after device A sends a connection request broadcast to terminal devices within its Wi-Fi connection range, and devices B and C receive this connection request broadcast (which can be a CoAP discovery broadcast), devices B and C initiate TCP socket connections to device A based on the broadcast information. Thus, devices B and C establish the first communication connection with device A, and this first communication connection uses Wi-Fi communication.

[0132] Step S103: Device A sends the first device information to Device B and Device C.

[0133] Step S104: Device B sends the second device information to Device A, and Device C sends the third device information to Device A.

[0134] After device A establishes a first communication connection with device B, devices A and B can exchange their device information. Specifically, device A sends its first device information to device B, and device B sends its second device information to device A. Similarly, after device A establishes a first communication connection with device C, devices A and C can exchange their device information. Specifically, device A sends its first device information to device C, and device C sends its third device information to device A.

[0135] The first, second, and third device information include: available computing power, remaining battery power, whether it is currently charging (one or more of these), and supported communication methods. Available computing power can be the available computing power of the terminal device's CPU or GPU, expressed as a percentage. Supported communication methods can be obtained by querying the terminal device's communication capabilities and may include: Bluetooth Low Energy, traditional Bluetooth, WiFi, 2.4G point-to-point, and 5G point-to-point communication (one or more of these).

[0136] It should be noted that the specific content of the above device information is only for illustrative purposes, and can be added or deleted as needed in actual applications.

[0137] Step S105: Device A determines, from Device B and Device C, a second terminal capable of cooperating with the first terminal to process tasks, and multiple communication methods supported by the second terminal with the first terminal, based on the first device information, the second device information, and the third device information.

[0138] Device A can determine whether device B can collaborate with device A to process tasks based on one or more of the available computing power, remaining power, and whether it is in a charging state in the second device information, that is, determine whether device B is a collaborative device; Device A can determine whether device C can collaborate with device A to process tasks based on one or more of the available computing power, remaining power, and whether it is in a charging state in the third device information, that is, determine whether device C is a collaborative device.

[0139] Specifically, certain judgment conditions can be set to determine whether device B and device C are collaborative or non-collaborative devices. For example, if the available computing power of device B is greater than or equal to a first threshold and the remaining power of device B is greater than or equal to a second threshold, then device B is determined to be a collaborative device. As another example, if the available computing power of device B is greater than or equal to the first threshold and device B is in a charging state, then device B is determined to be a collaborative device. Yet another example is that if device C is in a charging state, but the available computing power of device C is less than the first threshold, then device C is determined to be a non-collaborative device.

[0140] If it is determined that both device B and device C can collaborate, then, based on the communication methods supported by device A and device B, the multiple communication methods supported by device B with the first terminal are determined. And based on the communication methods supported by device A and device C, the multiple communication methods supported by device C with the first terminal are determined.

[0141] Specifically, the communication methods supported by both device A and device B can be considered as the multiple communication methods supported by device B with the first terminal. For example, device A supports the following communication methods: Bluetooth Low Energy, traditional Bluetooth, WiFi, 2.4G point-to-point, and 5G point-to-point; while device B supports the following communication methods: Bluetooth Low Energy, WiFi, and 5G point-to-point. Therefore, the multiple communication methods supported by device B with the first terminal include: Bluetooth Low Energy, WiFi, and 5G point-to-point.

[0142] Similarly, if the communication methods supported by device C include: Bluetooth Low Energy communication, traditional Bluetooth communication, 2.4G point-to-point communication, and 5G point-to-point communication, then the multiple communication methods supported by device C with the first terminal include: Bluetooth Low Energy communication, traditional Bluetooth communication, 2.4G point-to-point communication, and 5G point-to-point communication.

[0143] Step S106: Based on the performance of devices B and C in processing historical tasks from the first terminal under the multiple communication methods supported by the first terminal, device A determines the target terminal and its corresponding target communication method from devices B and C.

[0144] Since the processing latency of tasks may vary for different terminal devices, and even for the same terminal device, the processing latency and power consumption may differ under different communication methods, this embodiment determines the target terminal and its corresponding target communication method from among devices B and C based on the performance of devices B and C in processing historical tasks from the first terminal under the multiple communication methods they support. The target terminal's performance in processing historical tasks from the first terminal under the target communication method is optimal.

[0145] It is worth noting that this solution is implemented on the assumption that devices B and C have already collaborated with device A to process historical tasks. If devices B and C have not collaborated with device A to process historical tasks, then before step S106, device A needs to publish the historical tasks to devices B and C. Devices B and C need to process the historical tasks under their supported communication methods with the first terminal, and obtain the capability performance of devices B and C in processing historical tasks under each of their supported communication methods with the first terminal.

[0146] Step S107: Device A generates the current subtask. If the current target terminal is Device B and the target communication method is 5G point-to-point communication, then Device A sends a connection request to Device B to establish a 5G point-to-point communication connection based on the 5G point-to-point communication method.

[0147] Assuming that the target task of device A includes three subtasks to be executed sequentially, namely subtask 1, subtask 2, and subtask 3, when device A generates the current subtask (subtask 1), if the current target terminal is device B and the target communication method is 5G point-to-point communication, then device A sends a connection request to device B to establish a 5G point-to-point communication connection based on the 5G point-to-point communication method.

[0148] Step S108: Device B establishes a connection with Device A based on the connection request to establish a 5G point-to-point communication connection.

[0149] Step S109: Device A sends the current subtask to Device B via a 5G point-to-point communication connection.

[0150] Step S110: Device B processes the current subtask and returns the task processing result to Device A.

[0151] It is worth noting that after device A sends the current subtask (subtask 1) to device B in step S109, the current subtask in device A changes, and the current subtask becomes the next subtask to be processed, such as subtask 2. Therefore, the "current subtask" in steps S109 and S110 is not the same subtask as the "current subtask" after steps S109 and S110.

[0152] Step S111: Based on the task processing results, device A re-determines the target terminal as device C, and the target communication method is 5G point-to-point communication. Then, device A sends a connection request to device C to establish a 5G point-to-point communication connection based on the 5G point-to-point communication method.

[0153] After device B returns the task processing result, the ability of device B to process historical tasks from the first terminal under the multiple communication methods supported by the first terminal also changes. Therefore, it is necessary to redetermine the target terminal and the target communication method.

[0154] Step S112: Device C establishes a connection with Device A based on the connection request to establish a 5G point-to-point communication connection.

[0155] Step S113: Device A sends the current subtask to Device C via a 5G point-to-point communication connection.

[0156] Assume that during the execution of steps S109 to S112, device A has already sent subtask 2 to device B via a 5G point-to-point communication connection, and device B processes subtask 2. Then, the current subtask in step S122 is subtask 3, and device A sends subtask 3 to device C via a 5G point-to-point communication connection.

[0157] Step S114: Device C processes the current subtask and returns the task processing result to device A.

[0158] Step S115: Device A integrates the results of multiple task processing received.

[0159] In this embodiment, the target terminal collaborates with the first terminal to process the task under the target communication mode, compensating for the insufficient computing resources of the first terminal when processing the task and avoiding excessive consumption of computing resources by a single terminal device. Furthermore, in determining the target terminal and its corresponding target communication mode for collaborating with the first terminal to process the task, the task is not simply randomly assigned to other terminal devices. Instead, the target terminal and target communication mode are determined based on the performance of the second terminal in collaborating with the first terminal to process historical tasks. The target terminal demonstrates optimal performance in processing historical tasks from the first terminal under the target communication mode. Therefore, when the target terminal collaborates with the first terminal to process the task, the likelihood of the task being successfully executed is increased, thereby improving the user experience of the first terminal. Simultaneously, since the target terminal demonstrates optimal performance in processing historical tasks from the first terminal under the target communication mode, this solution significantly reduces the impact of the aforementioned collaborative processing on the target terminal's own task processing, thus avoiding deterioration of the user experience on the collaborating device.

[0160] It is worth noting that the application scenarios shown in the above examples are only illustrative and can also be applied to other scenarios, which will not be elaborated on in this embodiment.

[0161] For example, Figure 5 A flowchart illustrating a task processing method provided in this application embodiment, which can be applied to a first terminal. (Refer to...) Figure 5 As shown, the task processing method in this embodiment may include the following steps:

[0162] Step S201: When the device collaboration function of the first terminal is enabled, determine from the multiple terminals that have a first communication connection with the first terminal a second terminal that can collaborate with the first terminal to process tasks, and the multiple communication methods supported by the second terminal with the first terminal.

[0163] The first terminal supports device collaboration functionality. Specifically, the first terminal can be equipped with a switch control. When the switch control is turned on, the device collaboration functionality is enabled; when the switch control is turned off, the device collaboration functionality is disabled.

[0164] When the device collaboration function of the first terminal is enabled, if the first terminal has already established a first communication connection with multiple terminals within its effective communication range, such as... Figure 6 As shown, if the first terminal is device A, and device A's device collaboration function is enabled, device A is within the same wireless local area network range as devices D and E, and device A has already established a WiFi communication connection with devices D and E; in addition, device A has already established a Bluetooth communication connection with devices B, C and E within its Bluetooth connection range. Figure 6 Solid lines indicate WiFi communication between devices, while dashed lines indicate Bluetooth communication between devices.

[0165] After the first terminal has established a first communication connection with multiple terminals within its effective communication range, the first terminal exchanges device information with the multiple terminals within its effective communication range. Based on its own device information and the device information of the multiple terminals, the first terminal determines from the multiple terminals with which it has a first communication connection a second terminal that can cooperate with the first terminal to process tasks, as well as the multiple communication methods supported by the second terminal with the first terminal.

[0166] For example, device information may include at least one or more of the following: available computing power, remaining battery power, and whether it is currently charging, as well as the supported communication methods. Available computing power can be the available computing power of the terminal device's CPU or GPU, expressed as a percentage. Supported communication methods can be obtained by querying the terminal device's communication capabilities, and may include one or more of the following: Bluetooth Low Energy, traditional Bluetooth, WiFi, 2.4G point-to-point, and 5G point-to-point communication methods.

[0167] In one possible implementation, based on the device information of the first terminal and the device information of multiple terminals, a second terminal capable of cooperating with the first terminal to process tasks is determined from among the multiple terminals that have a first communication connection with the first terminal, as well as multiple communication methods supported by the second terminal with the first terminal. This includes: determining the second terminal capable of cooperating with the first terminal to process tasks from among the multiple terminals based on one or more of the available computing power, remaining battery power, and whether it is in a charging state; and determining multiple communication methods supported by the second terminal with the first terminal based on the communication methods supported by the first terminal and the communication methods supported by the second terminal.

[0168] First, a second terminal capable of cooperating with the first terminal in processing tasks can be determined from multiple terminals in the following way.

[0169] The ability to determine whether each terminal among multiple terminals is a collaborative or non-collaborative device can be based on one or more of the following: available computing power, remaining battery power, and whether it is charging. Here, a "collaborative device" refers to a device that can collaborate with the first terminal to process tasks, while a "non-collaborative device" refers to a device that cannot collaborate with the first terminal to process tasks. In this embodiment, the collaborative device is also referred to as the "second terminal."

[0170] For example, determining a second terminal capable of collaborating with a first terminal to process tasks from multiple terminals based on one or more of the available computing power, remaining battery power, and whether it is in a charging state includes: determining a terminal as the second terminal capable of collaborating with the first terminal to process tasks when one or more of the terminal's available computing power, remaining battery power, and whether it is in a charging state meet a first preset condition. The first preset condition is: the terminal's available computing power is greater than or equal to a first threshold and the terminal's remaining battery power is greater than or equal to a second threshold; or, the terminal's available computing power is greater than or equal to the first threshold, the terminal's remaining battery power is less than the second threshold, and the terminal is in a charging state.

[0171] Among the multiple terminals that have a first communication connection with the first terminal, there may be both collaborative and non-collaborative devices. In this embodiment, a first preset condition can be set to filter out a second terminal that can collaborate with the first terminal to process tasks from among the multiple terminals that have a first communication connection with the first terminal. For example, if the available computing power of the terminal is greater than or equal to a first threshold and the remaining battery power of the terminal is greater than or equal to a second threshold, then the terminal is determined to be a collaborative device. Similarly, if the available computing power of the terminal is greater than or equal to the first threshold, the remaining battery power of the terminal is less than the second threshold, and the terminal is in a charging state, then the terminal is determined to be a collaborative device. Furthermore, if the terminal is in a charging state but the available computing power of the terminal is less than the first threshold, then the terminal is determined to be a non-collaborative device; or, if the available computing power of the terminal is greater than or equal to the first threshold, but the remaining battery power of the terminal is less than the second threshold, and the terminal is not in a charging state, then the terminal can be determined to be a non-collaborative device.

[0172] In this embodiment, the available computing power and battery power of the terminal must simultaneously meet certain conditions in the first preset condition. In practical applications, either the available computing power or the battery power of the terminal can be set to meet the condition in the first preset condition. The above-mentioned first preset condition is only an example. In practical applications, the first preset condition can be set according to the requirements, and will not be elaborated further here.

[0173] Assume that the device information of devices B, C, D, and E, which have a first communication connection with the first terminal (device A), is as shown in Table 1:

[0174] Table 1

[0175]

[0176] In Table 1 above, BLE represents Bluetooth Low Energy communication, BR represents traditional Bluetooth communication, 2.4G P2P represents 2.4G point-to-point communication, 5G P2P represents 5G point-to-point communication, and WIFI represents WiFi communication.

[0177] Assuming the first threshold is 50% and the second threshold is 40% in the aforementioned first preset conditions, since device B's remaining battery power is less than the second threshold of 40% and it is not charging, device B is a non-cooperative device. Since device C's available computing power is less than the first threshold of 50%, device C is also a non-cooperative device. Since device D's available computing power is greater than the first threshold of 50% and its remaining battery power is greater than the second threshold of 40%, device D is a cooperative device. Since device E's available computing power is greater than the first threshold of 50% and its remaining battery power is greater than the second threshold of 40%, device E is a cooperative device. In summary, devices B and C are non-cooperative devices, while devices D and E are cooperative devices. That is, among the four terminals with a first communication connection to the first terminal (device A), devices D and E are second terminals capable of cooperating with the first terminal (device A) to process tasks.

[0178] Secondly, the multiple communication methods supported by the second terminal with the first terminal can be determined in the following ways.

[0179] The communication methods supported by the first terminal and the communication methods supported by the second terminal can be identified as the multiple communication methods supported by the second terminal and the first terminal.

[0180] Assuming that the first terminal (device A) supports five communication methods: BLE, BR, 2.4G P2P, 5G P2P, and WIFI, then the communication methods supported by device D with the first terminal (device A) include 2.4G P2P, 5G P2P, and WIFI, and the communication methods supported by device E with the first terminal (device A) include BLE, BR, 2.4G P2P, 5G P2P, and WIFI.

[0181] Step S202: Based on the capability performance of the second terminal in processing historical tasks from the first terminal under multiple supported communication methods with the first terminal, determine the target terminal and its corresponding target communication method from the second terminal.

[0182] The target terminal performs optimally in processing historical tasks from the first terminal under the target communication mode.

[0183] After determining the second terminal and the multiple communication methods it supports with the first terminal, it is necessary to determine the target terminal and target communication method from the various combinations of second terminals and communication methods, so that the target terminal's ability to perform historical tasks under the target communication method is optimal. Assume the second terminal includes device D and device E. Device D supports 3 communication methods with the first terminal (device A), and device E supports 5 communication methods with the first terminal (device A). Therefore, there are a total of 8 combinations of second terminals and communication methods. It is then necessary to find the combination (i.e., target terminal + target communication method) that best performs in handling historical tasks from these 8 combinations.

[0184] In this embodiment, the performance includes latency and power consumption. Optimal performance indicates that the consumption of latency and power consumption are in balance, that is, the latency and power consumption are not too different.

[0185] Specifically, the optimal combination of capabilities for handling historical tasks (i.e., target terminal + target communication method) can be identified through the following methods.

[0186] For example, determining a target terminal and its corresponding target communication method from the second terminal based on the second terminal's ability to process historical tasks from the first terminal under multiple supported communication methods with the first terminal includes: determining the actual capability benefit of the second terminal in each supported communication method with the first terminal for processing historical tasks from the first terminal based on the second terminal's ability to process historical tasks from the first terminal under multiple supported communication methods with the first terminal; and determining the target terminal and its corresponding target communication method from the second terminal based on one or more of the following: the actual capability benefit of the second terminal in each supported communication method with the first terminal for processing historical tasks from the first terminal, the total number of historical tasks, and the number of historical tasks processed by the second terminal in each supported communication method with the first terminal.

[0187] In this embodiment, the actual capability benefit can be determined based on the performance of the second terminal and the communication method in executing historical tasks. The better the capability performance, the greater the corresponding actual capability benefit. Thus, the optimal combination for processing historical tasks (i.e., target terminal + target communication method) can be determined based on one or more of the following: the actual capability benefit of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal, the total number of historical tasks, and the number of historical tasks processed by the second terminal under each supported communication method with the first terminal. This provides a method for measuring the performance of processing historical tasks based on actual capability benefits.

[0188] The following explains how to measure the ability to handle historical tasks based on actual capability gains:

[0189] For example, based on the capability performance of the second terminal in processing historical tasks from the first terminal under multiple supported communication methods with the first terminal, the actual capability gain of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal is determined. This includes: when the latency corresponding to the historical task is less than or equal to the latency requirement, determining the actual capability gain of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal based on the latency and power consumption of the second terminal in processing historical tasks from the first terminal under multiple supported communication methods with the first terminal; when the latency corresponding to the historical task is greater than the latency requirement, determining the actual capability gain of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal based on the power consumption and a preset penalty value of the second terminal in processing historical tasks from the first terminal under multiple supported communication methods with the first terminal.

[0190] First, the latency Ta of the second terminal processing the historical task a corresponding to the first terminal under the multiple communication methods supported by the first terminal can be obtained by observing the time from when the first terminal sends the historical task a to when it receives the task processing result of the historical task a.

[0191] Secondly, the power consumption Ea of the second terminal processing historical task a from the first terminal under the multiple communication methods supported by the first terminal can be calculated by the following formula:

[0192] Ea = P k *(T a,tx +T a,rx )*2

[0193] Among them, P k T is the power consumption required to transmit data per unit time under each communication method. a,tx P is the time required to send historical task a. k ×T a,tx T represents the power consumption required to send the historical task 'a'. a,rx P is the time required to receive the processing results of historical task a. k ×T a,rx This represents the power consumption required to receive the processing results of historical task a.

[0194] In this embodiment, it is assumed that under the same communication method (e.g., BLE or P2P), the power consumption of the terminal receiving and sending the same data is the same. That is, the power consumption of the first terminal sending historical task a is the same as the power consumption of the second terminal receiving historical task a, and the power consumption of the first terminal receiving historical task a is the same as the power consumption of the second terminal sending historical task a. Therefore, multiplying by 2 in the above formula yields the sum of the power consumption of the first and second terminals sending and receiving data. In practical problems, this can also be calculated separately, which will not be elaborated upon in this embodiment.

[0195] Finally, the formula for determining the actual capability gain R(a) based on the latency Ta and power consumption Ea is as follows:

[0196]

[0197] In the above formula, ta represents the latency requirement of historical task a, and each historical task a has a corresponding latency requirement ta. For example, for multiple video stream processing tasks, if the processing result of the second video stream has not been received when the third video stream, which has been processed, starts playing, then even if the processing result of the second video stream is received later, it will not be played because the task of the second video stream has expired at this time.

[0198] Therefore, each historical task 'a' will have a corresponding latency requirement. If the latency for processing historical task 'a' does not exceed the corresponding latency requirement 'Ta', i.e., 'Ta' ≤ 'ta', then the actual capability gain 'R(a)' can be determined based on the latency 'Ta' and power consumption 'Ea', i.e., R(a) = α * 1 / Ta - β * Ea. Here, α is set as the coefficient for latency 'Ta', and β is set as the coefficient for power consumption 'Ea'. Latency 'Ta' is inversely proportional to R(a); the larger the latency 'Ta', the smaller R(a). Similarly, power consumption 'Ea' is inversely proportional to R(a); the larger the power consumption 'Ea', the smaller R(a).

[0199] If the latency of processing historical task a exceeds the corresponding latency requirement Ta (i.e., Ta > ta), then historical task a has become invalid, and the processing result of historical task a can no longer be used by the first terminal. In this case, R(a) = -β*Ea - C, where the latency-related benefit of executing historical task a is 0; power consumption Ea is inversely proportional to R(a), the larger the power consumption Ea, the smaller R(a). Additionally, a preset penalty term C can be set to penalize the power consumption-related benefits of processing historical task a.

[0200] In the above formula, the coefficients α and β, as well as the preset penalty term C, are all constants. For example, α can be set to 1000, β to 0.01, and C to 1. In practical applications, these can be set according to experience, and this embodiment does not impose any restrictions.

[0201] The following explains how to determine the target terminal and its corresponding target communication method from the second terminal:

[0202] In this embodiment, there are two ways to determine the target terminal and its corresponding target communication method from the second terminal:

[0203] Method 1: Based on the actual capability gains of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal, the total number of historical tasks, and the number of historical tasks processed by the second terminal under each supported communication method with the first terminal, determine the expected capability gains of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal; based on the expected capability gains of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal, determine the target terminal and its corresponding target communication method from the second terminals.

[0204] In this embodiment, the problem of determining the target terminal and target communication method from multiple combinations of second terminals and communication methods can be regarded as an optimal scheduling problem, that is, selecting the optimal target communication method and its corresponding target terminal for each task to be processed. However, as the number of terminals within the effective connection range of the first terminal (device A) increases, the number of selectable combinations of second terminals and communication methods grows exponentially, resulting in a very large solution space for the overall scheduling optimization problem. Rule-based algorithms are unsuitable. Therefore, this embodiment proposes an optimal task scheduling algorithm based on reinforcement learning.

[0205] Specifically, the problem of determining the optimal combination (i.e., target terminal and target communication method) for performing historical tasks from multiple combinations of second terminals and communication methods is transformed into a multi-armed bandit (MAB) problem. Each combination of second terminals and communication methods can be regarded as an "arm" in the MAB problem. For a given task, a corresponding benefit will be obtained after selecting any of the arms.

[0206] For the MAB problem, the following decision formula is proposed in this embodiment:

[0207]

[0208] Where i represents the i-th combination among multiple combinations of second terminals and communication methods. The expected capability gains for processing historical tasks using the i-th combination of second terminal and communication method. Let n be the average revenue of processing historical tasks using the i-th combination of second terminal and communication method, where N is the total number of historical tasks. iLet n be the number of historical tasks processed by the i-th combination of second terminal and communication method, where n is the number of tasks processed by the second terminal and communication method. i Less than N; U and ε are constants, where U can be 1 and ε can be 0.1.

[0209] The average revenue of the i-th combination of second terminal and communication method for processing historical tasks The actual capability benefit R of processing each historical task can be determined based on the combination of i second terminals and communication methods, and the number n of historical tasks processed by the combination of second terminals and communication methods. i This can be calculated.

[0210] Average return in the above formula The formula following this is represented as the exploration term. A larger value for the exploration term indicates a stronger encouragement to choose other combinations of the second terminal and communication method; a smaller value indicates a stronger inclination to choose the current combination of the second terminal and communication method. In practical applications, the constants U and ε can be set based on actual experience.

[0211] Based on the above decision formula, the expected capability benefit of each combination of second terminal and communication method for processing historical tasks can be determined. The combination of second terminal and communication method with the highest expected capability benefit for processing historical tasks is determined as the target terminal and target communication method.

[0212] In this implementation, the expected capability gains of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal are calculated. Based on the expected capability gains, the target terminal and its corresponding target communication method are determined from the second terminal, resulting in a more accurate outcome.

[0213] Method 2: Based on the actual capability gains of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal, and the number of historical tasks processed by the second terminal under each supported communication method with the first terminal, determine the target terminal and its corresponding target communication method from the second terminal.

[0214] Based on the actual capability gain R corresponding to each combination of second terminal and communication method for processing historical tasks, and the number of historical tasks processed by each combination of second terminal and communication method, the average gain corresponding to each combination of second terminal and communication method for processing historical tasks is calculated. The combination of second terminal and communication method with the highest average gain for processing historical tasks is determined as the target terminal and target communication method.

[0215] In this implementation, the target terminal and its corresponding target communication method are determined from the second terminal based on the actual capability gains of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal. The calculation is simple.

[0216] Step S203: If it is determined that a task to be processed has been generated, determine whether the current communication method between the first terminal and the target terminal is consistent with the target communication method. If the determination is no, proceed to step S204; if the determination is yes, proceed to step S206.

[0217] If the first terminal determines that a task to be processed has been generated, it can be determined whether the current communication method between the first terminal and the target terminal is consistent with the target communication method. If they are inconsistent, proceed to step S204 (establish a second communication connection with the target terminal according to the target communication method); if they are consistent, proceed to step S206 (send the task to be processed to the target terminal through the current communication method, and the target terminal processes the task to be processed).

[0218] Step S204: Establish a second communication connection with the target terminal according to the target communication method.

[0219] Assuming the target terminal is device D and the target communication method is 2.4G P2P, if the current communication method between the first terminal (device A) and device D is WIFI communication, then the first terminal (device A) and the target terminal (device D) need to establish a second communication connection (2.4G P2P connection) based on the target communication method (2.4G P2P).

[0220] Step S205: Send the task to be processed to the target terminal through the second communication connection, and the target terminal processes the task.

[0221] After the second communication connection between the first terminal (device A) and the target terminal (device D) is established, the task to be processed is sent to the target terminal through the second communication connection, and the target terminal (device D) processes the task.

[0222] Step S206: Send the task to be processed to the target terminal through the current communication method, and the target terminal processes the task.

[0223] Assuming the target terminal is device D and the target communication method is WIFI, if the current communication method between the first terminal (device A) and device D is also WIFI, then the task to be processed can be directly sent to the target terminal (device D) through the current communication method, and the target terminal (device D) will process the task.

[0224] After steps S205 and S206 above, step S207 is executed.

[0225] Step S207: Receive the task processing result returned by the target terminal.

[0226] The first terminal receives the task processing result returned by the target terminal.

[0227] In this embodiment, the target terminal collaborates with the first terminal to process the task under the target communication mode, compensating for the insufficient computing resources of the first terminal when processing the task and avoiding excessive consumption of computing resources by a single terminal device. Furthermore, in determining the target terminal and its corresponding target communication mode for collaborating with the first terminal to process the task, the task is not simply randomly assigned to other terminal devices. Instead, the target terminal and target communication mode are determined based on the performance of the second terminal in collaborating with the first terminal to process historical tasks. The target terminal demonstrates optimal performance in processing historical tasks from the first terminal under the target communication mode. Therefore, when the target terminal collaborates with the first terminal to process the task, the likelihood of the task being successfully executed is increased, thereby improving the user experience of the first terminal. Simultaneously, since the target terminal demonstrates optimal performance in processing historical tasks from the first terminal under the target communication mode, this solution significantly reduces the impact of the aforementioned collaborative processing on the target terminal's own task processing, thus avoiding deterioration of the user experience on the collaborating device.

[0228] The second aspect of this application provides a task processing method, such as... Figure 7 The steps shown are as follows.

[0229] Step S301: When the device collaboration function of the first terminal is enabled, determine from the multiple terminals that have a first communication connection with the first terminal a second terminal that can collaborate with the first terminal to process tasks, and the multiple communication methods supported by the second terminal with the first terminal.

[0230] Step S302: Based on the capability performance of the second terminal in processing historical tasks from the first terminal under the multiple communication methods supported by the first terminal, determine the target terminal and its corresponding target communication method from the second terminal. The capability performance of the second terminal in processing historical tasks includes: the capability performance of the second terminal in processing sub-tasks preceding the current sub-task.

[0231] Step S303: If it is determined that the current subtask has been generated, determine whether the current communication method between the first terminal and the target terminal is consistent with the target communication method. If the determination is no, proceed to step S304; if the determination is yes, proceed to step S306.

[0232] Step S304: Establish a second communication connection with the target terminal according to the target communication method.

[0233] Step S305: Send the current subtask to the target terminal through the second communication connection, and the target terminal will process the current subtask.

[0234] Step S306: Send the current subtask to the target terminal through the current communication method, and the target terminal will process the current subtask.

[0235] After steps S305 and S306 above, step S307 is executed.

[0236] Step S307: Receive the task processing result returned by the target terminal.

[0237] After step S307, return to step S302.

[0238] Steps S301 to S307 are largely the same as steps 201 to S207 in the above embodiments, and will not be repeated in this embodiment to avoid repetition. The difference between this embodiment and the above embodiments is that in this embodiment, the task to be processed is the current subtask among multiple subtasks processed sequentially. The capability performance of the second terminal in processing historical tasks includes: the capability performance of the second terminal in processing subtasks preceding the current subtask. Furthermore, after step S307, it is necessary to return to step S302.

[0239] For example, suppose that when executing the current subtask (task 1), the target terminal is determined to be device D, and the target communication method is 2.4G P2P. After completing task 1, the process returns to step S302. Based on the performance of device D in executing task 1 under the 2.4G P2P communication method, the target terminal is redefined as device E, and the target communication method is BR. In this case, the performance of device E in executing the current subtask (task 2) under the BR communication method is optimal. If device D is still chosen to execute the current subtask (task 2) under the 2.4G P2P communication method, the latency required for device D to execute the current subtask (task 2) under the 2.4G P2P communication method may be greater, or the power consumption may be higher, which would negatively impact the user experience when the first terminal or the target terminal is processing the task.

[0240] In this embodiment, after each subtask is processed, the performance of the second terminal that processed the subtask and its corresponding communication method changes. Therefore, it is necessary to update the target terminal and its corresponding target communication method in a timely manner to ensure that the performance of the currently determined target terminal in processing the current subtask under the target communication method is optimal. This solution can greatly reduce the impact of the above-mentioned collaborative processing of the target terminal on the processing of the target terminal's own tasks, thereby avoiding the deterioration of the user experience on the collaborative device.

[0241] Thirdly, embodiments of this application provide a task processing method, such as... Figure 8 The steps shown are as follows.

[0242] Step S401: When the device collaboration function is detected to be enabled, establish a first communication connection with multiple terminals within the effective communication range of the first terminal.

[0243] The effective communication range refers to the Bluetooth connection range of the first terminal and / or the wireless LAN connection range of the first terminal.

[0244] The first terminal supports device collaboration functionality. Specifically, the first terminal can be equipped with a switch control. When the switch control is turned on, the device collaboration functionality is enabled; when the switch control is turned off, the device collaboration functionality is disabled.

[0245] When the first terminal detects that the device collaboration function has been enabled, it broadcasts a connection request to multiple terminal devices within its effective communication range. The effective communication range of the first terminal refers to the Bluetooth connection range of the first terminal and / or the wireless local area network connection range of the first terminal.

[0246] Assuming the first terminal is device A, and its effective communication range refers to its Bluetooth connection range, and devices B and C have their Bluetooth enabled and are within device A's Bluetooth connection range, then after device A sends a connection request broadcast to terminal devices within its Bluetooth connection range, devices B and C can receive this connection request broadcast. This connection request broadcast can be a Bluetooth discovery broadcast. After devices B and C send Bluetooth connection requests to device A based on the Bluetooth discovery broadcast, devices B and C establish a first communication connection with device A. The communication method for this first communication connection is Bluetooth communication.

[0247] Assuming the first terminal is device A, and the effective communication range of the first terminal refers to the Wi-Fi connection range of device A, and devices B and C have their Wi-Fi enabled and are within the same Wi-Fi network as device A, then after device A sends a connection request broadcast to terminal devices within its Wi-Fi connection range, and devices B and C receive this connection request broadcast (which can be a CoAP discovery broadcast), devices B and C initiate TCP socket connections to device A based on the broadcast information. Thus, devices B and C establish the first communication connection with device A, and this first communication connection uses Wi-Fi communication.

[0248] It's worth noting that if devices B and C are not only within the Bluetooth range of device A but also on the same Wi-Fi network, then, given that device A's effective communication range includes both the Bluetooth range and the Wi-Fi range it belongs to, the first communication connection between device A and device B can use both Bluetooth and Wi-Fi. In other words, there are two communication methods between device A and device B: Bluetooth and Wi-Fi. Similarly, there are two communication methods between device A and device C: Bluetooth and Wi-Fi.

[0249] Step S402: Receive device information from multiple terminals that have a first communication connection with the first terminal.

[0250] Device information includes: available computing power, remaining battery power, whether it is currently charging (one or more of these), and supported communication methods. Available computing power can be the available computing power of the terminal device's CPU or GPU, expressed as a percentage. Supported communication methods can be obtained by querying the terminal device's communication capabilities, and may include: Bluetooth Low Energy, traditional Bluetooth, WiFi, 2.4G point-to-point, and 5G point-to-point communication (one or more of these). It is worth noting that the specific content of the above device information is for illustrative purposes only, and can be added or removed as needed in actual applications.

[0251] After the first terminal establishes a first communication connection with multiple terminals, the first terminal receives device information from the multiple terminals. For example, assuming the first terminal is device A, the multiple terminals with the first communication connection to the first terminal include device B and device C. Device A sends its first device information to devices B and C, device B sends its second device information to device A, and device C sends its third device information to device A.

[0252] The first, second, and third device information may include one or more of the following: available computing power, remaining battery power, whether it is charging, and the supported communication methods.

[0253] Step S403: Based on the device information of the first terminal and the device information of multiple terminals, determine from the multiple terminals that have a first communication connection with the first terminal a second terminal that can cooperate with the first terminal to process tasks, and the multiple communication methods supported by the second terminal with the first terminal.

[0254] After obtaining device information from multiple terminals, the first terminal can determine a second terminal that can collaborate with the first terminal to process tasks based on the device information of the multiple terminals (available computing power, remaining power, whether it is in a charging state or one or more of these).

[0255] Assume the first terminal is device A. Device A obtains second and third device information from multiple terminals (device B and device C). Device A can determine whether device B can collaborate with device A to process tasks based on one or more of the available computing power, remaining battery power, and whether it is charging, i.e., whether device B is a collaborative device. Similarly, device A can determine whether device C can collaborate with device A to process tasks based on one or more of the available computing power, remaining battery power, and whether it is charging, i.e., whether device C is a collaborative device.

[0256] Specifically, certain judgment conditions can be set to determine whether device B and device C are collaborative or non-collaborative devices. For example, if the available computing power of device B is greater than or equal to a first threshold and the remaining power of device B is greater than or equal to a second threshold, then device B is determined to be a collaborative device. As another example, if the available computing power of device B is greater than or equal to the first threshold and device B is in a charging state, then device B is determined to be a collaborative device. Yet another example is that if device C is in a charging state, but the available computing power of device C is less than the first threshold, then device C is determined to be a non-collaborative device.

[0257] If it is determined that both device B and device C can collaborate, then, based on the communication methods supported by device A and device B, the multiple communication methods supported by device B with the first terminal are determined. And based on the communication methods supported by device A and device C, the multiple communication methods supported by device C with the first terminal are determined.

[0258] Specifically, the communication methods supported by both device A and device B can be considered as the multiple communication methods supported by device B with the first terminal. For example, device A supports the following communication methods: Bluetooth Low Energy, traditional Bluetooth, WiFi, 2.4G point-to-point, and 5G point-to-point; while device B supports the following communication methods: Bluetooth Low Energy, WiFi, and 5G point-to-point. Therefore, the multiple communication methods supported by device B with the first terminal include: Bluetooth Low Energy, WiFi, and 5G point-to-point.

[0259] Similarly, if the communication methods supported by device C include: Bluetooth Low Energy communication, traditional Bluetooth communication, 2.4G point-to-point communication, and 5G point-to-point communication, then the multiple communication methods supported by device C with the first terminal include: Bluetooth Low Energy communication, traditional Bluetooth communication, 2.4G point-to-point communication, and 5G point-to-point communication.

[0260] Step S404: Based on the capability performance of the second terminal in processing historical tasks from the first terminal under multiple supported communication methods with the first terminal, determine the target terminal and its corresponding target communication method from the second terminal.

[0261] Step S405: If it is determined that a task to be processed has been generated, determine whether the current communication method between the first terminal and the target terminal is consistent with the target communication method. If the determination is no, proceed to step S406; if the determination is yes, proceed to step S408.

[0262] Step S406: Establish a second communication connection with the target terminal according to the target communication method.

[0263] Step S407: The task to be processed is sent to the target terminal through the second communication connection, and the target terminal processes the task.

[0264] Step S408: Send the task to be processed to the target terminal through the current communication method, and the target terminal processes the task.

[0265] After steps S406 and S408 above, step S409 is executed.

[0266] Step S409: Receive the task processing result returned by the target terminal.

[0267] Steps S404 to S409 are largely the same as steps S202 to S207 in the above embodiment. To avoid repetition, they will not be described again in this embodiment.

[0268] In one possible implementation, the method further includes: if it is determined that the first terminal and the second terminal are connecting for the first time, then generating a first initialization task; transmitting the first initialization task to the second terminal through a communication method supported by the second terminal and the first terminal, and having the second terminal process it; receiving the task processing result returned by the second terminal, and determining the capability performance of the second terminal in processing the first initialization task under the multiple communication methods supported by the second terminal; the capability performance of the second terminal in processing historical tasks includes: the capability performance of the second terminal in processing the first initialization task.

[0269] In this embodiment, before determining the target terminal and its corresponding target communication method from the second terminal based on the second terminal's ability to process historical tasks from the first terminal under the supported communication methods with the first terminal, the second terminal needs to have processed historical tasks from the first terminal under the supported communication methods with the first terminal. Only in this way can the second terminal's ability to process historical tasks from the first terminal under the supported communication methods with the first terminal be known. For the second terminal connecting for the first time, it has not processed historical tasks from the first terminal. At this time, the first terminal can generate a first initialization task and transmit the first initialization task to the second terminal through the communication methods supported by the second terminal. The second terminal processes the first initialization task, and thus obtains the second terminal's ability to process historical tasks (including the first initialization task) under the supported communication methods with the first terminal.

[0270] For example: If the first terminal is device A, and the second terminals include devices B and C, and if device A and device C are connecting for the first time, and device C supports four communication methods with device A: Bluetooth Low Energy, Bluetooth Classic, 2.4G point-to-point, and 5G point-to-point. Then, a first initialization task needs to be generated for device C. Device C will then process this first initialization task under each of the four communication methods to obtain its performance in processing the first initialization task under each of the four communication methods.

[0271] It is worth noting that the first initialization task can be either a simulated task or a real task, and this embodiment does not impose any limitations. Furthermore, the first terminal can generate the first initialization task when it discovers the second terminal that is connecting for the first time, and the second terminal can handle the first initialization task. This avoids the need for the first terminal to schedule tasks to be processed before generating the first initialization task for the second terminal to handle, which can improve efficiency.

[0272] Furthermore, it's worth noting that if the communication method supported by the second terminal with the first terminal appears for the first time, the first terminal also generates an initialization task. The second terminal then processes this initialization task under the newly introduced communication method, thus obtaining the second terminal's performance in handling the initialization task under that method. For example, if the first terminal is device A, and the second terminals include devices B and C, and if device C's first supported communication method with device A is WiFi, an initialization task is generated. Device C then processes this initialization task under the WiFi communication method, thus obtaining the second terminal's performance in handling the initialization task under that method.

[0273] Furthermore, because the device location and information of terminals are highly dynamic, multiple terminals within the effective communication range of the first terminal may be updated. This means new terminals may appear within the effective communication range of the first terminal, or terminals connected to the first terminal may leave its effective communication range, leading to changes in the identified collaborating second terminal. Additionally, the device information of multiple terminals within the effective communication range of the first terminal (such as available computing power, remaining battery power, charging status, supported communication methods, etc.) also frequently changes. Therefore, the identified collaborating second terminal and the communication methods supported by the second terminal with the first terminal may change. If the communication methods supported by the second terminal and the second terminal with the first terminal are not updated in a timely manner, the performance of the identified target terminal in executing historical tasks under the target communication method may not be optimal, potentially severely impacting the user experience when the first and target terminals are processing pending tasks.

[0274] To address this, two implementation methods are proposed below:

[0275] In one possible implementation, after receiving device information from multiple terminals that have a first communication connection with the first terminal, the method further includes: periodically sending query requests to the multiple terminals, with each terminal responding to the query request and returning its updated device information; receiving updated device information from the multiple terminals; and determining, from the multiple terminals that have a first communication connection with the first terminal, a second terminal capable of cooperating with the first terminal to process tasks, and multiple communication methods supported by the second terminal with the first terminal, including: determining, based on the device information of the first terminal and the updated device information of the multiple terminals, the second terminal capable of cooperating with the first terminal to process tasks, and multiple communication methods supported by the second terminal with the first terminal.

[0276] In this embodiment, the first terminal periodically sends query requests to multiple terminals. Each terminal responds to the query request and returns its updated device information. The first terminal can receive updated device information from multiple terminals. In this way, the first terminal can promptly obtain updated device information from multiple terminals and update the second terminal and the multiple communication methods supported by the second terminal with the first terminal based on this updated information. This ensures that the target terminal, determined based on the updated second terminal and the multiple communication methods supported by the second terminal with the first terminal, performs optimally in executing historical tasks under the target communication method. This scheme can significantly reduce the impact of the aforementioned collaborative processing on the target terminal's own task processing, thereby avoiding deterioration of the user experience on the collaborative device. The aforementioned period can be 1 minute, 2 minutes, etc., and can be set according to actual needs; this embodiment does not impose any restrictions.

[0277] In another possible implementation, after receiving device information from multiple terminals that have a first communication connection with the first terminal, the method further includes: receiving device change information from the multiple terminals, wherein the device change information is device information sent by the terminal to the first terminal when the terminal changes from being able to cooperate with the first terminal to not being able to cooperate with the first terminal to not being able to cooperate with the first terminal to not being able to cooperate with the first terminal to not being able to cooperate with the first terminal to not being able to cooperate with the first terminal; determining a second terminal capable of cooperating with the first terminal to handle tasks from among the multiple terminals that have a first communication connection with the first terminal, and multiple communication methods supported by the second terminal with the first terminal, including: determining a second terminal capable of cooperating with the first terminal to handle tasks from among the multiple terminals that have a first communication connection with the first terminal, and multiple communication methods supported by the second terminal with the first terminal, based on the device information of the first terminal and the device change information of the multiple terminals.

[0278] In this embodiment, the terminal monitors its own device information. If, based on the detected device information, the terminal determines that it has changed from being able to collaborate with the first terminal to not being able to collaborate (e.g., the terminal's available computing power changes from 0% to 80%), or from not being able to collaborate to being able to collaborate (e.g., the terminal's available computing power is 80%, the remaining battery is 35%, and it changes from being unplugged to being plugged in), the terminal sends device change information to the first terminal. The first terminal receives device change information from multiple terminals. In this way, the first terminal can update the second terminal and the multiple communication methods supported by the second terminal with the first terminal in a timely manner based on the device change information from multiple terminals. This ensures that the target terminal, determined based on the updated second terminal and the multiple communication methods supported by the second terminal with the first terminal, has the optimal performance in executing historical tasks under the target communication method. This scheme can greatly reduce the impact of the aforementioned collaborative processing of the target terminal on the target terminal's own task processing, thereby avoiding the deterioration of the user experience on the collaborative device.

[0279] Furthermore, the collaborative task processing between the second terminal and the first terminal is also affected by other unforeseen factors, such as wireless network interference. A sudden increase in the number of other devices communicating within the network can affect the communication latency between the second and first terminals, causing a sudden change in the performance of the second terminal when it is chosen as the target terminal for processing the task. If the network interference disappears, and the target terminal and its corresponding target communication method are still determined based on the second terminal's performance in handling historical tasks under severe network interference, the performance of the determined target terminal in executing historical tasks under the target communication method may not be optimal. In this case, it is necessary to discard the performance data corresponding to historical tasks processed by the second terminal and re-initialize the second terminal to obtain its latest performance in handling tasks, thereby ensuring the effectiveness of the overall task scheduling scheme in a dynamic environment.

[0280] For example, upon receiving the task processing result returned by the target terminal, the system determines the first benefit difference between the target terminal's ability to process the latest historical task and the previous historical task under the supported target communication method with the first terminal, and the historical offset difference between the target terminal's ability to process other historical tasks besides the latest historical task under the supported target communication method with the first terminal; determines the current offset difference based on the first benefit difference and the historical offset difference; and if the difference between the first benefit difference and the current offset difference is greater than a first preset threshold, obtains the current device information of multiple terminals that have a first communication connection with the first terminal.

[0281] Determining a second terminal capable of cooperating with the first terminal to process tasks from among multiple terminals having a first communication connection with the first terminal, and multiple communication methods supported by the second terminal with the first terminal, includes: re-determining the second terminal capable of cooperating with the first terminal to process tasks and multiple communication methods supported by the second terminal with the first terminal based on the device information of the first terminal and the current device information of the multiple terminals.

[0282] Before determining the target terminal and its corresponding target communication method from the second terminal, the process further includes: generating multiple second initialization tasks, and transmitting these tasks to the newly determined second terminal via multiple communication methods supported by the newly determined second terminal for processing; receiving the task processing results returned by the newly determined second terminal, and determining the capability performance of the newly determined second terminal in processing the second initialization tasks under the supported multiple communication methods with the first terminal. The capability performance of the second terminal in processing historical tasks only includes: the capability performance of the second terminal in processing the second initialization tasks.

[0283] Specifically, upon receiving the task processing result returned by the target terminal, a first gain difference is determined between the gain of the target terminal in processing the latest historical task t and the previous historical task t-1 under the supported target communication method with the first terminal. Assume the gain of the target terminal in processing the latest historical task t under the supported target communication method with the first terminal is r. t The ability gain from processing the previous historical task t-1 is r. t-1 Then the first difference in returns is dt = r t -r t-1 Additionally, the historical offset difference in the target terminal's ability to process historical tasks other than the most recent historical task t under the supported target communication mode with the first terminal is determined.

[0284]

[0285] Here, δ is a constant, greater than 0 and less than 1, and can be taken as 0.5. It is worth noting that δ can also be taken as other values ​​based on practical experience.

[0286] Based on the first profit difference dt and the historical offset difference Determine the current offset difference

[0287]

[0288] like That is, if the difference between the first benefit difference and the offset difference is greater than the first preset threshold γ, it indicates that the environmental state of the target terminal processing the latest historical task t and the previous historical task t-1 has changed, resulting in a significant change in the capability benefit of the target terminal processing the latest historical task t compared to the capability benefit of processing the previous historical task t-1. Therefore, at this time, it is necessary to discard the capability performance data corresponding to the historical tasks processed by the second terminal, and re-initialize the second terminal to obtain the capability performance of the latest task processed by the second terminal, thereby ensuring the effectiveness of the overall task scheduling scheme in a dynamic environment. It is worth noting that γ can be 3, or other values ​​can be chosen based on practical experience.

[0289] The initialization process is as follows: Obtain the current device information of multiple terminals that have a first communication connection with the first terminal. Based on the device information of the first terminal and the current device information of the multiple terminals, redetermine the second terminal capable of cooperating with the first terminal to process tasks, as well as the multiple communication methods supported by the second terminal with the first terminal. Generate multiple second initialization tasks and transmit them to the redetermined second terminal through the multiple communication methods supported by the redetermined second terminal, where they are processed. Receive the task processing results returned by the redetermined second terminal and determine the capability performance of the redetermined second terminal in processing the second initialization tasks under the supported multiple communication methods with the first terminal. The capability performance of the second terminal in processing historical tasks only includes the capability performance of the second terminal in processing the second initialization tasks.

[0290] Furthermore, the collaborative task processing between the second terminal and the first terminal is also affected by other factors, such as random user actions. If the user removes the second terminal, the distance between the second and first terminals gradually increases, leading to a gradual increase in the latency of the second terminal's task processing. If the second terminal is relatively close to the first terminal, determining the target terminal and its corresponding target communication method based on the capability of processing historical tasks under varying distances may result in an unoptimized performance of the target terminal in executing historical tasks under the target communication method. In this case, it is necessary to discard the capability performance data corresponding to historical tasks processed by the second terminal and re-initialize the second terminal to obtain its latest task processing capability performance, thereby ensuring the effectiveness of the overall task scheduling scheme in a dynamic environment.

[0291] For example, upon receiving the task processing result returned by the target terminal, the system calculates the cumulative gain difference based on the difference in gain between the target terminal's ability to process historical tasks within any two adjacent preset windows under the supported target communication method with the first terminal. If the cumulative gain difference exceeds a second preset threshold, the system obtains the current device information of multiple terminals that have a first communication connection with the first terminal.

[0292] Determining a second terminal capable of cooperating with the first terminal to process tasks, and the multiple communication methods supported by the second terminal with the first terminal, from among multiple terminals having a first communication connection with the first terminal, includes: re-determining the second terminal capable of cooperating with the first terminal to process tasks, and the multiple communication methods supported by the second terminal with the first terminal, based on the device information of the first terminal and the current device information of the multiple terminals. Before determining the target terminal and its corresponding target communication method from the second terminals, the method further includes: generating a third initialization task and transmitting the third initialization task to the re-determined second terminal through the multiple communication methods supported by the re-determined second terminal with the first terminal, for processing by the re-determined second terminal.

[0293] The system receives the task processing result returned by the re-determined second terminal and determines the capability performance of the re-determined second terminal in processing the third initialization task under the supported multiple communication methods with the first terminal. The capability performance of the second terminal in processing historical tasks only includes: the capability performance of the second terminal in processing the third initialization task.

[0294] Specifically, upon receiving the task processing result returned by the target terminal, the cumulative benefit difference is calculated based on the difference in the target terminal's ability to process historical tasks within any two adjacent preset windows under the supported target communication method with the first terminal.

[0295] Assuming a preset window has a size of W, meaning it contains W historical tasks, and the cumulative detection window has a size of m, meaning it contains m tasks, where m is greater than or equal to W, then the difference in capability gain μw between the target terminal and the first terminal in processing historical tasks within any preset window under the supported target communication method with the first terminal can be calculated using the following formula:

[0296]

[0297] Here, l represents the current task within the sliding window.

[0298] Cumulative return difference acc_change t It can be calculated using the following formula:

[0299]

[0300] Where j represents the current window, jW represents the next window, and μ j,w μ represents the difference in capability gains corresponding to the current window. j-w,w This represents the difference in capability gains for the next window, where m is the total number of historical tasks.

[0301] If the cumulative return difference acc_changet Δacc, meaning that if the cumulative difference in revenue exceeds the second preset threshold Δacc, requires discarding the performance data corresponding to historical tasks processed by the second terminal and re-initializing the second terminal to obtain the performance data of the latest task processed by the second terminal, thereby ensuring the effectiveness of the overall task scheduling scheme in a dynamic environment. It is worth noting that the size W of a preset window, the size m of the cumulative detection window, and the second preset threshold Δacc can be set as needed. In one example, W can be 10, m can be 10, and Δacc can be 5.

[0302] The initialization process is as follows: Obtain the current device information of multiple terminals that have a first communication connection with the first terminal. Based on the device information of the first terminal and the current device information of the multiple terminals, redetermine the second terminal capable of cooperating with the first terminal to process tasks, and the multiple communication methods supported by the second terminal with the first terminal. Before determining the target terminal and its corresponding target communication method from the second terminals, the process further includes: generating a third initialization task, and transmitting the third initialization task to the redetermined second terminal through the multiple communication methods supported by the redetermined second terminal with the first terminal, for processing by the redetermined second terminal. Receive the task processing result returned by the redetermined second terminal, and determine the capability performance of the redetermined second terminal in processing the third initialization task under the supported multiple communication methods with the first terminal. The capability performance of the second terminal in processing historical tasks only includes: the capability performance of the second terminal in processing the third initialization task.

[0303] Secondly, embodiments of this application provide a task collaboration method applied to a second terminal. The second terminal has device collaboration functionality, and the second terminal has a first communication connection with the first terminal, such as... Figure 9 As shown, the task collaboration method includes the following steps:

[0304] Step S501: If the device collaboration function of the second terminal is enabled, determine whether the received data is a connection request from the first terminal to establish a second communication connection or a pending task. If a connection request to establish a second communication connection is received from the first terminal, proceed to step S502; if a pending task is received from the first terminal through the current communication method, proceed to step S504.

[0305] The second terminal supports device collaboration functionality. Specifically, the second terminal can be configured with a switch control. When the switch control is turned on, the device collaboration functionality is enabled; when the switch control is turned off, the device collaboration functionality is disabled.

[0306] If the second terminal receives a connection request from the first terminal to establish a second communication connection, it proceeds to step S520 (establishing a second communication connection with the first terminal based on the connection request); if it receives a task to be processed from the first terminal, it proceeds to step S504 (the second terminal processes the task to be processed).

[0307] Step S502: Establish a second communication connection with the first terminal based on the connection request to establish a second communication connection.

[0308] Step S503: Receive the task to be processed from the first terminal through the second communication connection, and process the task to be processed.

[0309] Step S504: Process the pending tasks.

[0310] After steps S503 and S504, step S505 is executed.

[0311] Step S505: Return the task processing result to the first terminal.

[0312] In this embodiment, the second terminal can work with the first terminal to process the tasks to be processed from the first terminal, thus avoiding excessive consumption of resources of a single terminal device.

[0313] In one possible implementation, before establishing a second communication connection with the first terminal based on a connection request to establish a second communication connection, the method further includes: if the first communication connection and the second communication connection cannot coexist, then disconnecting the first communication connection with the first terminal upon receiving a connection request from the first terminal to establish a second communication connection.

[0314] In this embodiment, before establishing a second communication connection with the first terminal based on the connection request, if the current first communication connection between the second terminal and the first terminal cannot coexist with the required second communication connection, the first communication connection with the first terminal needs to be disconnected. For example, if the second terminal is device B and the first terminal is device A, and the first communication connection between device B and device A is a 2.4G point-to-point communication connection, while the second communication connection at the end of the connection request is a 5G point-to-point communication connection, since the 2.4G point-to-point communication connection and the 5G point-to-point communication connection cannot coexist, the 2.4G point-to-point communication connection with the first terminal needs to be disconnected, and a new 5G point-to-point communication connection needs to be established.

[0315] This application also provides another task collaboration method applied to a second terminal, which has device collaboration functionality, such as... Figure 10 As shown, the task collaboration method includes the following steps:

[0316] Step S601: When the device collaboration function of the second terminal is enabled, receive the first connection request from the first terminal.

[0317] When a first terminal (device A) detects that the device collaboration function is enabled, it sends a first connection request to multiple terminal devices within its effective communication range. If the device collaboration function of a second terminal (device B) is enabled and it is within the effective communication range of the first terminal, the second terminal (device B) receives the first connection request from the first terminal. The first connection request may be, for example, a Bluetooth auto-discovery broadcast or a CoAP discovery broadcast.

[0318] Step S602: Establish a first communication connection with the first terminal based on the first connection request.

[0319] The second terminal (device B) establishes a first communication connection with the first terminal (device A) based on the first connection request. If the first connection request is a Bluetooth auto-discovery broadcast, the second terminal (device B) establishes a Bluetooth communication connection with the first terminal (device A); if the first connection request is a CoAP discovery broadcast, the second terminal (device B) establishes a WiFi communication connection with the first terminal (device A).

[0320] Subsequently, the second terminal (device B) interacts with the first terminal (device A) through the first communication connection, and device A sends the first device information to device B, while device B sends the second device information to device A.

[0321] Step S603: Determine whether the received data is a connection request from the first terminal to establish a second communication connection or a task to be processed. If a connection request to establish a second communication connection is received from the first terminal, proceed to step S640; if a task to be processed is received from the first terminal through the current communication method, proceed to step S660.

[0322] Step S604: Establish a second communication connection with the first terminal based on the connection request to establish a second communication connection.

[0323] Step S605: Receive the task to be processed from the first terminal through the second communication connection, and process the task to be processed.

[0324] Step S606: Process the pending tasks.

[0325] After steps S605 and S606, step S607 is executed.

[0326] Step S607: Return the task processing result to the first terminal.

[0327] Steps S603 to S607 are largely the same as steps S501 to S505 in the above embodiments. To avoid repetition, they will not be described again in this embodiment.

[0328] In one possible implementation, the method further includes: if the second terminal is initially connected to the first terminal, receiving a first initialization task from the first terminal through multiple communication methods supported by the second terminal; processing the first initialization task, and returning the task processing result to the first terminal through multiple communication methods supported by the second terminal.

[0329] In this embodiment, before determining the target terminal and its corresponding target communication method from the second terminal based on the second terminal's ability to process historical tasks from the first terminal under the supported communication methods with the first terminal, the second terminal needs to have processed historical tasks from the first terminal under the supported communication methods with the first terminal. Only in this way can the second terminal's ability to process historical tasks from the first terminal under the supported communication methods with the first terminal be known. For the second terminal connecting for the first time, it has not processed historical tasks from the first terminal. At this time, the first terminal can generate a first initialization task and transmit the first initialization task to the second terminal through the communication methods supported by the second terminal. The second terminal processes the task and returns the task processing result to the first terminal. The first terminal can then obtain the second terminal's ability to process historical tasks (including the first initialization task) under the supported communication methods with the first terminal.

[0330] Because the device location and information of terminals are highly dynamic, multiple terminals within the effective communication range of the first terminal may be updated. This means new terminals may appear within the effective communication range of the first terminal, or terminals connected to the first terminal may leave its effective communication range, leading to changes in the identified collaborating second terminal. Furthermore, the device information of multiple terminals within the effective communication range of the first terminal (such as available computing power, remaining battery power, charging status, supported communication methods, etc.) also frequently changes. Therefore, the identified collaborating second terminal and the communication methods it supports with the first terminal may change. If the communication methods supported by the second terminal and the second terminal are not updated in a timely manner, the performance of the identified target terminal in executing historical tasks under the target communication method may not be optimal, potentially severely impacting the user experience when the first and target terminals are processing pending tasks.

[0331] To address this, two implementation methods are proposed below:

[0332] In one possible implementation, after sending the device information of the second terminal to the first terminal via the first communication connection, the method further includes: receiving a query request from the first terminal; in response to the query request, obtaining the updated device information of the second terminal, and sending the updated device information of the second terminal to the first terminal.

[0333] In this embodiment, the first terminal periodically sends query requests to multiple terminals, and the second terminal responds to the query requests by returning its updated device information. In this way, the first terminal can promptly obtain the updated device information of multiple second terminals and update the target terminal and its corresponding target communication method accordingly. This ensures that the determined target terminal's ability to perform historical tasks under the target communication method is optimal. This scheme can significantly reduce the impact of the aforementioned collaborative processing on the target terminal's own task processing, thereby avoiding deterioration of the user experience on the collaborative devices.

[0334] In another possible implementation, after sending the device information of the second terminal to the first terminal through the first communication connection, the method further includes: when it is detected that the second terminal changes from being able to cooperate with the first terminal to being unable to cooperate with the first terminal to being able to cooperate with the first terminal to being able to cooperate with the first terminal, obtaining the device change information of the second terminal and sending the device change information to the first terminal.

[0335] In this embodiment, the second terminal monitors its own device information. If, based on the detected device information, the second terminal determines that it has changed from being able to collaborate with the first terminal on tasks to not being able to collaborate (e.g., the second terminal's available computing power changes from 0% to 80%), or from not being able to collaborate on tasks to being able to collaborate (e.g., the second terminal's available computing power is 80%, remaining battery power is 35%, and it changes from being unplugged to being plugged in), the second terminal sends device change information to the first terminal. The first terminal receives device change information from multiple terminals. In this way, the first terminal can update the target terminal and its corresponding target communication method in a timely manner based on the device change information from multiple second terminals, ensuring that the target terminal's ability to execute historical tasks under the target communication method is optimal. This scheme can greatly reduce the impact of the aforementioned collaborative processing on the target terminal's own task processing, thereby avoiding deterioration of the user experience on collaborative devices.

[0336] It should be understood that the above examples are provided to help those skilled in the art understand the embodiments of this application, and are not intended to limit the embodiments of this application to the specific values ​​or scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the above examples, and such modifications or changes also fall within the scope of the embodiments of this application.

[0337] Figure 11 This is a schematic structural block diagram of a terminal device 700 provided in an embodiment of this application. The terminal device 700 includes: a processor 710, a memory 720, a communication interface 730, and a bus 740.

[0338] The processor 710 can be connected to the memory 720. The memory 720 can be used to store the program code and data. Therefore, the memory 720 can be a storage unit inside the processor 710, an external storage unit independent of the processor 710, or a component that includes both the storage unit inside the processor 710 and the external storage unit independent of the processor 710.

[0339] Optionally, the terminal device 700 may also include a bus 740. The memory 720 and communication interface 730 can be connected to the processor 710 via the bus 740. The bus 740 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 740 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 11 The symbol is represented by only one line, but this does not mean that there is only one bus or one type of bus.

[0340] It should be understood that in the embodiments of this application, the processor 710 may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Alternatively, the processor 710 may employ one or more integrated circuits to process related programs to implement the technical solutions provided in the embodiments of this application.

[0341] The memory 720 may include read-only memory and random access memory, and provides instructions and data to the processor 710. A portion of the processor 710 may also include non-volatile random access memory. For example, the processor 710 may also store device type information.

[0342] When the terminal device 700 is running, the processor 710 processes the processor execution time instructions in the memory 720 to utilize the hardware resources in the device to process the operation steps of the above-mentioned task processing method or task coordination method.

[0343] It should be understood that the terminal device 700 according to the embodiments of this application can correspond to processing according to the embodiments of this application. Figure 5 , Figures 7 to 10 The corresponding entities in the method shown, and the above and other operations and / or functions of each module in the terminal device 700, are respectively implemented to achieve Figure 5 , Figures 7 to 10 The corresponding process of the method will not be elaborated here for the sake of brevity.

[0344] This application also provides a computer-readable storage medium storing a computer program, which includes program instructions. When the program instructions are executed, they implement the task processing method or task coordination method provided in the embodiments of this application.

[0345] This application also provides a computer program product, which includes: computer program code, which, when run on a computer, causes the processor to execute the task processing method or task coordination method provided in the embodiments of this application.

[0346] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or processed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive (SSD).

[0347] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are handled in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of the embodiments of this application.

[0348] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0349] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not processed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0350] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0351] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0352] If the aforementioned function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application embodiment, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a memory (which may be a personal computer, server, or network device, etc.) to process all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0353] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this application should be included within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.

Claims

1. A task processing method, characterized in that, The method is applied to a first terminal, which has a device collaboration function, and the method includes: When the device collaboration function of the first terminal is enabled, a second terminal capable of collaborating with the first terminal to process tasks is determined from among a plurality of terminals that have a first communication connection with the first terminal, as well as a plurality of communication methods supported by the second terminal with the first terminal. Based on the second terminal's ability to process historical tasks from the first terminal under multiple supported communication methods with the first terminal, a target terminal and its corresponding target communication method are determined from the second terminals. The target terminal's ability to process historical tasks from the first terminal under the target communication method is optimal. If it is determined that the first terminal and the second terminal are initially connected, a first initialization task is generated. The first initialization task is transmitted to the second terminal through the communication methods supported by the second terminal, and processed by the second terminal. The task processing result returned by the second terminal is received, and the second terminal's ability to process the first initialization task under the multiple supported communication methods with the first terminal is determined. The second terminal's ability to process the historical tasks includes its ability to process the first initialization task. If, in the case of generating a task to be processed, the current communication method between the first terminal and the target terminal is inconsistent with the target communication method, then a second communication connection is established with the target terminal according to the target communication method. The task to be processed is sent to the target terminal through the second communication connection, and the target terminal processes the task to be processed. If the current communication method between the first terminal and the target terminal is consistent with the target communication method, then the task to be processed is sent to the target terminal through the current communication method, and the target terminal processes the task to be processed. Receive the task processing result returned by the target terminal.

2. The task processing method according to claim 1, characterized in that, The performance characteristics include latency and power consumption, and the optimal performance characteristics are a balance between latency and power consumption.

3. The task processing method according to claim 1 or 2, characterized in that, The task to be processed is the current subtask among a plurality of subtasks to be processed sequentially. The capability performance of the second terminal in processing the historical task includes: the capability performance of the second terminal in processing the subtasks preceding the current subtask. After receiving the task processing result returned by the target terminal, the process returns to the step of determining the target terminal and its corresponding target communication method from the second terminal based on the second terminal's ability to process historical tasks from the first terminal under the multiple communication methods supported by the first terminal.

4. The task processing method according to any one of claims 1 to 3, characterized in that, The step of determining the target terminal and its corresponding target communication method from the second terminal based on the second terminal's ability to process historical tasks from the first terminal under multiple supported communication methods with the first terminal includes: Based on the performance of the second terminal in processing historical tasks from the first terminal under the multiple communication methods supported with the first terminal, the actual capability benefit of the second terminal in processing historical tasks from the first terminal under each of the supported communication methods is determined. The target terminal and its corresponding target communication method are determined from the second terminal based on one or more of the following: the actual capability gain of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal; the total number of historical tasks; and the number of historical tasks processed by the second terminal under each supported communication method with the first terminal.

5. The task processing method according to claim 4, characterized in that, The step of determining the target terminal and its corresponding target communication method from the second terminal based on one or more of the following: the actual capability gain of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal; the total number of historical tasks; and the number of historical tasks processed by the second terminal under each supported communication method with the first terminal. Based on the actual capability gains of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal, the total number of historical tasks, and the number of historical tasks processed by the second terminal under each supported communication method with the first terminal, the expected capability gains of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal are determined. Based on the expected capability gains of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal, the target terminal and its corresponding target communication method are determined from the second terminal.

6. The task processing method according to claim 4, characterized in that, The step of determining the target terminal and its corresponding target communication method from the second terminal based on one or more of the following: the actual capability gain of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal; the total number of historical tasks; and the number of historical tasks processed by the second terminal under each supported communication method with the first terminal. Based on the actual capability gains of the second terminal in processing historical tasks from the first terminal under each supported communication method with the first terminal, and the number of historical tasks from the first terminal processed by the second terminal under each supported communication method with the first terminal, the target terminal and its corresponding target communication method are determined from the second terminals.

7. The task processing method according to any one of claims 4 to 6, characterized in that, The performance characteristics include latency and power consumption; The step of determining the actual capability gain of the second terminal in each of the supported communication methods with the first terminal for processing historical tasks from the first terminal, based on the capability performance of the second terminal in processing historical tasks from the first terminal under multiple supported communication methods with the first terminal, includes: When the latency corresponding to the historical task is less than or equal to the latency requirement, the actual capability gain of the second terminal in processing the historical task from the first terminal in each of the supported communication methods with the first terminal is determined based on the latency and power consumption of the second terminal in processing the historical task from the first terminal in the multiple communication methods supported with the first terminal. If the latency corresponding to the historical task is greater than the latency requirement, the actual capability gain of the second terminal in processing the historical task from the first terminal in each of the supported communication methods with the first terminal is determined based on the power consumption and preset penalty value of the second terminal in processing the historical task from the first terminal in each of the supported communication methods with the first terminal.

8. The task processing method according to any one of claims 1 to 7, characterized in that, The method further includes: When the device collaboration function is detected to be enabled, a first communication connection is established with multiple terminals within the effective communication range of the first terminal; Receive device information from the plurality of terminals that have a first communication connection with the first terminal; The step of determining a second terminal capable of cooperating with the first terminal in processing tasks from among a plurality of terminals having a first communication connection with the first terminal, and the plurality of communication methods supported by the second terminal with the first terminal, includes: Based on the device information of the first terminal and the device information of the plurality of terminals, a second terminal capable of cooperating with the first terminal to process tasks is determined from among the plurality of terminals that have a first communication connection with the first terminal, as well as the plurality of communication methods supported by the second terminal with the first terminal.

9. The task processing method according to claim 8, characterized in that, The device information includes at least one or more of the following: available computing power, remaining battery power, whether it is in a charging state, and the supported communication methods. The step of determining, based on the device information of the first terminal and the device information of the plurality of terminals, a second terminal capable of cooperating with the first terminal to process tasks from among the plurality of terminals having a first communication connection with the first terminal, and the plurality of communication methods supported by the second terminal with the first terminal, includes: Based on one or more of the available computing power, remaining battery power, and whether it is in a charging state of the plurality of terminals, a second terminal that can cooperate with the first terminal to process tasks is determined from the plurality of terminals. Based on the communication methods supported by the first terminal and the second terminal, determine the multiple communication methods supported by the second terminal for communication with the first terminal.

10. The task processing method according to claim 9, characterized in that, The step of determining the second terminal capable of cooperating with the first terminal to process tasks from among the plurality of terminals based on one or more of the available computing power, remaining battery power, and whether it is in a charging state includes: If one or more of the terminal's available computing power, remaining battery power, and whether it is in a charging state meet the first preset conditions, the terminal is determined to be the second terminal capable of cooperating with the first terminal to process tasks. The first preset condition is: the available computing power of the terminal is greater than or equal to a first threshold and the remaining battery power of the terminal is greater than or equal to a second threshold; or, the available computing power of the terminal is greater than or equal to the first threshold, the remaining battery power of the terminal is less than the second threshold, and the terminal is in a charging state.

11. The task processing method according to any one of claims 8 to 10, characterized in that, After receiving the device information of the plurality of terminals that have a first communication connection with the first terminal, the method further includes: Periodically send query requests to the plurality of terminals, and each terminal responds to the query request by returning its updated device information; Receive updated device information from the plurality of terminals; The step of determining a second terminal capable of cooperating with the first terminal in processing tasks from among a plurality of terminals having a first communication connection with the first terminal, and the plurality of communication methods supported by the second terminal with the first terminal, includes: Based on the device information of the first terminal and the updated device information of the plurality of terminals, a second terminal capable of cooperating with the first terminal to process tasks is determined, as well as the plurality of communication methods supported by the second terminal with the first terminal.

12. The task processing method according to any one of claims 8 to 11, characterized in that, After receiving the device information of the plurality of terminals that have a first communication connection with the first terminal, the method further includes: Receive device change information from the plurality of terminals. The device change information is device information sent by the terminal to the first terminal when the terminal changes from being able to cooperate with the first terminal to not being able to cooperate with the first terminal to not being able to cooperate with the first terminal to be able to cooperate with the first terminal. The step of determining a second terminal capable of cooperating with the first terminal in processing tasks from among a plurality of terminals having a first communication connection with the first terminal, and the plurality of communication methods supported by the second terminal with the first terminal, includes: Based on the device information of the first terminal and the device change information of the plurality of terminals, a second terminal capable of cooperating with the first terminal to process tasks is determined from the plurality of terminals that have a first communication connection with the first terminal, as well as the plurality of communication methods supported by the second terminal with the first terminal.

13. The task processing method according to any one of claims 1 to 12, characterized in that, The method further includes: Upon receiving the task processing result returned by the target terminal, determine the first benefit difference of the target terminal's ability to process the latest historical task and the previous historical task under the supported target communication method with the first terminal, and the historical offset difference of the target terminal's ability to process other historical tasks besides the latest historical task under the supported target communication method with the first terminal. The current offset difference is determined based on the first profit difference and the historical offset difference; If the difference between the first profit difference and the current offset difference is greater than a first preset threshold, obtain the current device information of multiple terminals that have a first communication connection with the first terminal; The step of determining a second terminal capable of cooperating with the first terminal in processing tasks from among a plurality of terminals having a first communication connection with the first terminal, and the plurality of communication methods supported by the second terminal with the first terminal, includes: Based on the device information of the first terminal and the current device information of the multiple terminals, a second terminal capable of cooperating with the first terminal to process tasks, and multiple communication methods supported by the second terminal with the first terminal are re-determined. Before determining the target terminal and its corresponding target communication method from the second terminal, the method further includes: Multiple second initialization tasks are generated, and the multiple second initialization tasks are transmitted to the re-determined second terminal through multiple communication methods supported by the first terminal, and processed by the re-determined second terminal; Receive the task processing result returned by the re-determined second terminal, and determine the capability performance of the re-determined second terminal in processing the second initialization task under the multiple communication methods supported with the first terminal; The capability of the second terminal to process the historical tasks includes only the capability of the second terminal to process the second initialization task.

14. The task processing method according to any one of claims 1 to 13, characterized in that, The method further includes: Upon receiving the task processing result returned by the target terminal, the cumulative benefit difference is calculated based on the difference in the target terminal's ability to process historical tasks within any two adjacent preset windows under the supported target communication method with the first terminal. If the cumulative revenue difference is greater than a second preset threshold, the current device information of multiple terminals that have a first communication connection with the first terminal is obtained; The step of determining a second terminal capable of cooperating with the first terminal in processing tasks from among a plurality of terminals having a first communication connection with the first terminal, and the plurality of communication methods supported by the second terminal with the first terminal, includes: Based on the device information of the first terminal and the current device information of the multiple terminals, a second terminal capable of cooperating with the first terminal to process tasks, and multiple communication methods supported by the second terminal with the first terminal are re-determined. Before determining the target terminal and its corresponding target communication method from the second terminal, the method further includes: A third initialization task is generated, and the third initialization task is transmitted to the re-determined second terminal through multiple communication methods supported by the first terminal, and processed by the re-determined second terminal. Receive the task processing result returned by the re-determined second terminal, and determine the capability performance of the re-determined second terminal in processing the third initialization task under the multiple communication methods supported with the first terminal; The capability of the second terminal to process the historical tasks includes only the capability of the second terminal to process the third initialization task.

15. The task processing method according to any one of claims 8 to 12, characterized in that, The effective communication range refers to the Bluetooth connection range of the first terminal and / or the wireless local area network connection range of the first terminal.

16. A task collaboration method, characterized in that, The method, applied to a second terminal having device collaboration capabilities and a first communication connection with a first terminal, includes: When the device collaboration function of the second terminal is enabled, if a connection request to establish a second communication connection is received from the first terminal, a second communication connection is established with the first terminal based on the connection request. According to the second terminal's ability to process historical tasks from the first terminal under multiple supported communication methods with the first terminal, a target terminal and its corresponding target communication method are determined from the second terminals. The target terminal's ability to process historical tasks from the first terminal under the target communication method is optimal. If it is determined that the first terminal and the second terminal are initially connected, a first initialization task is generated. The first initialization task is transmitted to the second terminal through the communication methods supported by the second terminal, and processed by the second terminal. The task processing result returned by the second terminal is received, and the second terminal's ability to process the first initialization task under multiple supported communication methods with the first terminal is determined. The second terminal's ability to process the historical tasks includes its ability to process the first initialization task. The system receives and processes tasks from the first terminal via the second communication connection. If a task to be processed is received from the first terminal through the current communication method, then the task to be processed is processed. The task processing result is returned to the first terminal.

17. The task collaboration method according to claim 16, characterized in that, Before establishing a second communication connection with the first terminal based on the connection request for establishing a second communication connection, the method further includes: If a connection request to establish a second communication connection is received from the first terminal, and the first communication connection and the second communication connection cannot coexist, then the first communication connection with the first terminal is disconnected.

18. The task collaboration method according to claim 16 or 17, characterized in that, The first communication connection between the second terminal and the first terminal is established in the following manner: When the device collaboration function of the second terminal is enabled, a first connection request is received from the first terminal. A first communication connection is established with the first terminal based on the first connection request.

19. The task collaboration method according to claim 18, characterized in that, After sending the device information of the second terminal to the first terminal through the first communication connection, the method further includes: Receive a query request from the first terminal; In response to the query request, the updated device information of the second terminal is obtained and sent to the first terminal.

20. The task collaboration method according to any one of claims 17 to 19, characterized in that, After sending the device information of the second terminal to the first terminal through the first communication connection, the method further includes: If it is detected that the second terminal changes from being able to cooperate with the first terminal to not being able to cooperate with the first terminal to not being able to cooperate with the first terminal to being able to cooperate with the first terminal, the device change information of the second terminal is obtained and the device change information is sent to the first terminal.

21. A terminal device, characterized in that, The terminal device includes a memory and a processor. The memory is used to store instructions. When the instructions are executed by the processor, the terminal device enables the terminal device to implement the task processing method as described in any one of claims 1 to 15, or to implement the task coordination method as described in any one of claims 16 to 20.

22. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions, which, when executed, implement the task processing method as described in any one of claims 1 to 15, or implement the task coordination method as described in any one of claims 16 to 20.

23. A computer program product, characterized in that, The computer program product includes: computer program code, which, when executed on a computer, causes the processor to implement the task processing method as described in any one of claims 1 to 15, or to execute the task coordination method as described in any one of claims 16 to 20.