Equipment selection method and device and storage medium
By calculating and comparing the device scores of each electronic device in the distributed network of smart homes, the target electronic device is determined to perform services, which solves the problem of difficulty in accurately selecting equipment suitable for performing services in the existing technology, and improves the scientificity and accuracy of service transfer. Accuracy.
Patent Information
- Application Number
- CN202310903906.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-21
- Publication Date
- 2025-01-21
Smart Images

Figure CN119342053A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Internet of Things, and in particular to a device selection method, apparatus and storage medium. Background Art
[0002] With the advancement of science and technology, the development of the Internet, and the popularization of smart electronic devices, there may be multiple smart electronic devices in a user's home. When a user needs to use a certain service, he needs to select a smart electronic device that meets the needs to perform the service.
[0003] In the current related technologies, when facing multiple devices in smart homes, intelligent decision-making can be achieved through user portraits and environmental data to achieve the purpose of controlling home devices. However, this solution requires all devices in the home to support the decision-making network, and once the resources in the home network are disconnected or new resources are online, the solution cannot perceive and may get wrong decision results; in addition, this solution is mainly for home devices and cannot make decisions for mobile smart devices.
[0004] Therefore, how to accurately select electronic devices suitable for performing services in a device network has become a problem that needs to be solved urgently. Summary of the invention
[0005] The present application provides a device selection method, apparatus and storage medium, which can accurately select electronic devices suitable for executing services in a device network.
[0006] In a first aspect, the present application provides a device selection method, which is applied to a first electronic device, where the first electronic device and at least one second electronic device form a distributed network, and the method includes: determining a first device score corresponding to the first electronic device based on first device resource information of the first electronic device, where the first device score is used to indicate the suitability of a target service to be scheduled to the first electronic device; receiving a second device score sent by one or more second electronic devices; wherein the second device score corresponding to the target second electronic device is determined by the target second electronic device based on its own first device resource information, and the target second electronic device is any of the second electronic devices; determining a target electronic device based on the first device score and the second device scores corresponding to the one or more second electronic devices, where the target electronic device is an electronic device in the distributed network used to execute the target service.
[0007] In a second aspect, the present application provides a device selection system, comprising multiple electronic devices, which form a distributed network; a first electronic device among the multiple electronic devices, used to determine a first device score corresponding to the first electronic device based on first device resource information of the first electronic device, the first device score being used to indicate the suitability of a target service being scheduled to the first electronic device; a second electronic device among the multiple electronic devices, used to determine a second device score corresponding to the second electronic device based on the first device resource information of the second electronic device, and send the second device score to the first electronic device; the first electronic device is also used to receive the second device score sent by one or more second electronic devices, and determine a target electronic device based on the first device score and the second device scores respectively corresponding to the one or more second electronic devices, the target electronic device being an electronic device in the distributed network used to execute the target service.
[0008] In a third aspect, the present application provides a device selection apparatus, which is applied to a first electronic device, wherein the first electronic device and at least one second electronic device form a distributed network, and the apparatus includes: a determination module, which is used to determine a first device score corresponding to the first electronic device based on first device resource information of the first electronic device, and the first device score is used to indicate the suitability of scheduling a target service to the first electronic device; a receiving module, which is used to receive a second device score sent by one or more second electronic devices; wherein the second device score corresponding to the target second electronic device is determined by the target second electronic device based on its own first device resource information, and the target second electronic device is any of the second electronic devices; the determination module is also used to determine the target electronic device based on the first device score and the second device scores corresponding to the one or more second electronic devices, respectively, and the target electronic device is an electronic device in the distributed network used to execute the target service.
[0009] In a fourth aspect, the present application provides an electronic device, comprising a processor and a memory, wherein the memory is used to store code instructions; the processor is used to execute the code instructions to implement the method in the first aspect above.
[0010] Optionally, there are one or more processors and one or more memories.
[0011] Optionally, the memory may be integrated with the processor, or the memory may be provided separately from the processor.
[0012] In the specific implementation process, the memory can be a non-transitory memory, such as a read-only memory (ROM), which can be integrated with the processor on the same chip or can be set on different chips respectively. The embodiments of the present application do not limit the type of memory and the setting method of the memory and the processor.
[0013] In a fifth aspect, the present application provides a computer-readable storage medium, which stores a computer program (also referred to as code, or instruction) which, when executed on a computer, enables the computer to execute the method in the first aspect.
[0014] In a sixth aspect, the present application provides a computer program product, comprising: a computer program (also referred to as code, or instruction), which enables a computer to execute the method in the first aspect when the computer program is executed.
[0015] In an embodiment of the present application, the first electronic device and the second electronic device belonging to the distributed network can determine the corresponding device scores based on their own first device resource information. The first electronic device can receive the second device scores sent by one or more second electronic devices, and determine the target electronic device based on its own first device score and the second device scores corresponding to the one or more second electronic devices. Each electronic device can accurately determine the suitability between itself and the target service using its own first device resource information, and provide feedback through the device score, so as to accurately decide the electronic device in the device network that is most suitable for executing the service, thereby making the flow of running services more scientific, safe and accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0017] Figure 2 A schematic diagram of a system architecture of an electronic device provided by an embodiment of the present application;
[0018] Figure 3 A schematic diagram of a flow chart of a device selection method provided in one embodiment of the present application;
[0019] Figure 4 A schematic diagram of a flow chart of a device selection method provided in another embodiment of the present application;
[0020] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application;
[0021] Figure 6A schematic diagram of a flow chart of a device selection method provided in yet another embodiment of the present application;
[0022] Figure 7 A structural schematic diagram of a device selection apparatus provided in one embodiment of the present application;
[0023] Figure 8 A structural schematic diagram of a device selection apparatus provided in another embodiment of the present application. DETAILED DESCRIPTION
[0024] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0025] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first" and "second" are used to distinguish the same items or similar items with substantially the same functions and effects. For example, the first instruction and the second instruction are to distinguish different user instructions, and their order is not limited. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit them to be different.
[0026] It should be noted that, in this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0027] In addition, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can mean: a, or b, or c, or a and b, or a and c, or b and c, or a, b and c, where a, b, c can be single or multiple.
[0028] With the advancement of science and technology, the development of the Internet, and the popularization of smart electronic devices, there may be multiple smart electronic devices in a user's home. When a user needs to use a certain service, he needs to select a smart electronic device that meets the needs to perform the service.
[0029] In the current related technologies, when facing multiple devices in smart homes, intelligent decision-making can be achieved through user portraits and environmental data to achieve the purpose of controlling home devices. However, this solution requires all devices in the home to support the decision network. The more home devices there are, the higher the decision accuracy. In addition, once the resources in the home network are disconnected or new resources are online, the solution cannot perceive them and may obtain wrong decision results. In addition, this solution is mainly for home devices and cannot perform decision identification on mobile smart devices. In addition, there are also device control methods that rely on central node decision devices to find and control target devices in smart groups. Once the central node decision device loses power or an abnormal situation occurs, the entire decision network will no longer continue to work.
[0030] Therefore, how to accurately select electronic devices suitable for performing services in a device network has become a problem that needs to be solved urgently.
[0031] In view of this, embodiments of the present application provide a device selection method, apparatus, and storage medium, which can accurately select an electronic device in a device network that is suitable for executing a service.
[0032] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 As shown, the application scenario may include a first electronic device 101, a second electronic device 102, and a third electronic device 103. The first electronic device 101, the second electronic device 102, and the third electronic device 103 form a distributed network. When a user issues a service, the first electronic device 101 selects the most suitable electronic device to perform the service according to the device conditions of all electronic devices in the distributed network.
[0033] The first electronic device 101 is a main device, which may be any electronic device in a distributed network, and this application does not limit this.
[0034] Optionally, the first electronic device 101, the second electronic device 102 and the third electronic device 103 may not be limited to mobile phones, tablet computers, laptop computers, PDAs, mobile internet devices (MID), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, smart screens, artificial intelligence (AI) speakers, headphones, etc.
[0035] It should be understood that the first electronic device 101, the second electronic device 102 and the third electronic device 103 all have their own processors and memories, and each has an independent data processing function. Normally, they are equal in status, without a primary or secondary distinction, and can work autonomously and use shared communication lines to transmit information and coordinate task processing. In addition, each of the first electronic device 101, the second electronic device 102 and the third electronic device 103 is in a long-connected state, and messages can be sent and received at any time. It should be noted that each of the first electronic device 101, the second electronic device 102 and the third electronic device 103 can communicate directly or indirectly, and this application does not limit this.
[0036] In some embodiments, the multiple electronic devices constituting the distributed network may include a first electronic device and one or more second electronic devices, wherein the first electronic device may be a master device among the multiple electronic devices, and the one or more second electronic devices may be slave devices among the multiple electronic devices. The master device refers to a device that controls all electronic devices in the entire distributed network, and the slave device refers to a device that responds to a request from the master device. The first electronic device may be any electronic device among the multiple electronic devices, and one electronic device may be randomly selected as the first electronic device, or the first electronic device may be nominated according to a preset nomination rule, and the remaining electronic devices may be second electronic devices.
[0037] In the technical solution of the present application, the first electronic device determines the first device score corresponding to the first electronic device based on the first device resource information of the first electronic device, and the first device score is used to indicate the suitability of the target service to be dispatched to the first electronic device. The second electronic device can determine the second device score based on its own first device resource information, and send it to the first electronic device. The first electronic device can receive the second device score sent by one or more second electronic devices, and then determine the target electronic device based on the first device score and the second device scores corresponding to the one or more second electronic devices, respectively. The target electronic device is an electronic device used to execute the target service in the distributed network. In the device selection method of the present application, each electronic device can accurately determine the suitability between itself and the target service by using its own first device resource information, and provide feedback through the device score, so as to accurately determine the most suitable electronic device for executing the service in the device network, thereby making the flow of running services more scientific, safe and accurate.
[0038] It should be understood that the electronic devices involved in the embodiments of the present application may be mobile phones, tablet computers, laptop computers, PDAs, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, smart screens, artificial intelligence (AI) speakers, headphones, terminals in industrial control, terminals in self-driving, terminals in remote medical surgery, terminals in smart grids, terminals in transportation safety, terminals in smart cities, terminals in smart homes, personal digital assistants (PDAs), etc., and the embodiments of the present application are not limited to this.
[0039] For example, Figure 2 A schematic diagram of the system architecture of an electronic device provided in one embodiment of the present application. Figure 2 As shown, the electronic device includes components such as a processor 210, a memory 220, a transceiver 230, a display unit 240, an input unit 250, a sensor 260, an audio circuit 270, and a power module 280.
[0040] The processor 210 is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 220, and calling data stored in the memory 220, the processor 210 performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. Optionally, the processor 210 may include one or more processing units; optionally, the processor 210 may integrate an application processor, which mainly processes operating devices, user interfaces, and application programs, etc. Of course, other processors may also be included, which are not listed here one by one.
[0041] The memory 220 can be used to store software programs and modules. The processor 210 executes various functional applications and data processing of the electronic device by running the software programs and modules stored in the memory 220. The memory 220 mainly includes a program storage area and a data storage area, wherein the program storage area can store operating devices, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device (such as audio data, phone book, etc.), etc. In addition, the memory 220 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0042] The transceiver 230 can provide wireless communication solutions for electronic devices, 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), infrared (IR), etc. The transceiver 230 can be one or more devices integrating at least one communication processing module, for example, an antenna and a baseband processor are integrated into the transceiver 230, or an antenna and a modem processor are integrated into the transceiver 230, etc., which are not limited here.
[0043] The display unit 240 may be used to display information input by the user or information provided to the user and various menus of the electronic device. The display unit 240 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc., which is not limited here.
[0044] The input unit 250 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. Specifically, the input unit 250 can collect the user's operations on or near it, and drive the corresponding connection device according to a pre-set program. In addition, the input unit 250 may include a touch panel, which can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel, the input unit 250 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of function keys (such as volume control keys, switch keys, etc.), trackballs, joysticks, etc.
[0045] The electronic device may also include at least one sensor 260, such as a gyroscope sensor, a motion sensor, and other sensors. The motion sensor may include an acceleration sensor for detecting the magnitude of acceleration in all directions, and the magnitude and direction of gravity when stationary, which can be used for applications to identify the posture of the electronic device, such as horizontal and vertical screen switching, related games, magnetometer posture calibration, etc. As for other sensors that may be configured in the electronic device, such as a pressure gauge, a barometer, a hygrometer, a thermometer, an infrared sensor, a fingerprint sensor, etc., they will not be described in detail here.
[0046] The audio circuit 270 may include a speaker and a microphone, and may provide an audio interface between the user and the electronic device. The audio circuit 270 may transmit the received audio data to the speaker after converting the received audio data into an electrical signal, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 270 and converted into audio data, and then the audio data is output to the processor 210 for processing, and then sent to another electronic device through the video circuit, or the audio data is output to the memory 220 for further processing.
[0047] The electronic device also includes a power module 280 for supplying power to various components. Optionally, the power module 280 can be logically connected to the processor 210 through a power management device, so that the power management device can manage charging, discharging, power consumption and other functions.
[0048] Although not shown, the electronic device may further include a camera. Optionally, the camera may be located at the front or rear of the electronic device, which is not limited in the present embodiment.
[0049] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0050] In order to make the purpose and technical solution of this application clearer and more intuitive, the device selection method, apparatus and storage medium provided in the embodiments of this application will be described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not used to limit this application.
[0051] Please refer to Figure 3 , is a flow chart of a device selection method provided by an embodiment of the present application. The method can be applied to the above Figure 1 The application scenarios shown in the figure can also be applied to other scenarios, which are not limited in the present application embodiment. Figure 1 Taking the scenario shown in the figure as an example, accordingly, the first electronic device in the following text is Figure 1 The first electronic device 101 is shown, and the second electronic device hereinafter is Figure 1 The second electronic device 102 and the third electronic device 103 are shown in detail below. Figure 3 The steps in the method shown are applied to a first electronic device, and the flowchart includes:
[0052] S301: Determine a first device score corresponding to the first electronic device according to first device resource information of the first electronic device, where the first device score is used to indicate suitability of scheduling a target service to the first electronic device.
[0053] The first electronic device and at least one second electronic device form a distributed network.
[0054] In some embodiments, the first device resource information includes memory resource occupancy, central processing unit (CPU) resource occupancy, storage resource occupancy, network resource occupancy, available peripheral resources, the peripheral resource occupancy, remaining available power resources and resource affinity, etc., which are not limited in this application.
[0055] Among them, memory resource occupancy refers to the program usage of the main memory of the electronic device, such as the memory consumed by the process running in the electronic device; CPU resource occupancy refers to the CPU resources occupied by the programs running in the electronic device, indicating the situation of the running programs of the electronic device at a certain point in time; storage resource occupancy mainly refers to how much storage space of the electronic device is used and how much is left; network resource occupancy refers to the network status of the electronic device, etc. The peripheral resources of the electronic device include display screens, speakers, microphones, cameras, etc. The peripheral resource occupancy refers to the usage of the peripheral resources of the electronic device; the remaining available power resources refer to the remaining power of the battery of the electronic device; resource affinity is used to indicate the adaptability of the resources of the electronic device to the target service.
[0056] Optionally, the first electronic device and at least one second electronic device form a distributed network, that is, the first electronic device and at least one second electronic device are in a distributed network, each has its own processor and memory, and has independent data processing functions. They can work autonomously and use shared communication lines to transmit information and coordinate task processing, and any two electronic devices among the first electronic device and at least one second electronic device can communicate with each other.
[0057] In some embodiments, the first electronic device determines the first device score corresponding to the first electronic device based on the first device resource information. The method can be calculated based on all device resource information in the first device resource information, or can be calculated based on part of the device resource information in the first device resource information. This application does not specifically limit this.
[0058] It should be noted that the first device score is used to indicate the suitability of the target service to be dispatched to the first electronic device. Optionally, the higher the device score, the more suitable the target service is for loading and executing on the device, and the better effect can be achieved.
[0059] S302: Receive second device scores sent by one or more second electronic devices.
[0060] The second device score corresponding to the target second electronic device is determined by the target second electronic device according to its own first device resource information, and the target second electronic device is any second electronic device.
[0061] In some embodiments, the first device resource information of the second electronic device is the same as the first device resource information of the first electronic device introduced in the above step S301. The method in which the target second electronic device determines the second device score based on its own first device resource information can be calculated based on all device resource information in the first device resource information, or based on part of the device resource information in the first device resource information, or based on the weights corresponding to the various device resource information in the first device resource information. This application does not specifically limit this.
[0062] Optionally, some or all of the electronic devices in the distributed network except the first electronic device may send the second device scores corresponding to the first electronic device, which is not limited in the present application.
[0063] It should be noted that, in the embodiment of the present application, the first electronic device is used as the main electronic device for example, and the main electronic device receives information sent by at least one second electronic device in the distributed network, such as the second device score. The method for selecting the main electronic device may be based on a preset selection rule, such as using the device type as a selection condition, and the preset selection rule is to select the device with the highest priority as the first electronic device (main device).
[0064] For example, assuming that the distributed network includes mobile phones, tablets, computers, and smart speakers, and the preset selection rule stipulates that the mobile phone has the highest priority, the mobile phone can be used as the main device. Since the mobile phone is small in size, easy to carry, and easy for users to operate, using the mobile phone as the main device can facilitate users to view feedback information in a timely manner and improve user experience.
[0065] Of course, the selection rule of the main electronic device may also be based on other methods, such as receiving instructions, etc., which is not specifically limited in this application.
[0066] S303: Determine a target electronic device according to the first device score and second device scores corresponding to the one or more second electronic devices, where the target electronic device is an electronic device for executing a target service in the distributed network.
[0067] In some embodiments, the first electronic device may determine the target electronic device based on the first device score and the second device scores corresponding to one or more second electronic devices, the device score having the highest device score, or the device score having a device score exceeding a preset score threshold, etc., and this application does not specifically limit this. Using an electronic device with a higher device score as the target electronic device, and then using the target electronic device to execute the target service, can achieve better results.
[0068] In this embodiment, the first electronic device and the second electronic device belonging to the distributed network can determine the corresponding device scores according to their own first device resource information. The first electronic device can receive the second device scores sent by one or more second electronic devices, and determine the target electronic device according to its own first device score and the second device scores corresponding to the one or more second electronic devices. Each electronic device can accurately determine the suitability between itself and the target service by using its own first device resource information, and provide feedback through the device score, so as to accurately decide the electronic device in the device network that is most suitable for executing the service, thereby making the flow of running services more scientific, safe and accurate.
[0069] Based on the above embodiments, Figure 4 A flow chart of a device selection method provided in another embodiment of the present application is described in detail below. Figure 4 The steps in the method shown are applied to a first electronic device, and the flowchart includes:
[0070] S401: Determine, based on second device resource information of a first electronic device, whether the first electronic device meets a basic device condition for running a target service.
[0071] It should be noted that the basic equipment conditions for the target service to run are prerequisites for the target service to run. The first electronic device can execute the target service only when the basic equipment conditions for the target service to run are met.
[0072] Among them, the second device resource information includes one or more resource information of the peripheral resources possessed by the electronic device, the occupancy of the peripheral resources, the hardware parameters corresponding to various device resources, storage resource pressure, memory resource pressure, CPU resource pressure and resource affinity. Accordingly, the basic device conditions include one or more of the following: the peripheral resources possessed by the electronic device match the peripheral resources required by the target service; the peripheral resources in the electronic device that match the target service are not occupied; the hardware parameters corresponding to various device resources in the electronic device meet the hardware requirements of the target service; the storage resource pressure of the electronic device does not exceed the first pressure threshold; the memory resource pressure of the electronic device does not exceed the second pressure threshold; the CPU resource pressure of the electronic device does not exceed the third pressure threshold; the resource affinity meets the preset affinity condition, and the resource affinity is used to indicate the adaptability of the resources possessed by the electronic device to the target service.
[0073] Understandably, the peripheral resources of the first electronic device refer to the external devices of the first electronic device, such as display, network, speaker, microphone, camera, etc. The first electronic device checks the usage of the peripheral resources and whether the peripheral resources match the peripheral resources required by the target service. If they match, the judgment of the next device resource will be continued. The hardware parameters corresponding to various device resources include the hardware conditions explicitly required by the service. In other words, the first electronic device checks whether the device tolerates stains. When stains on the electronic device cannot be tolerated, the service cannot be deployed on this electronic device, and such services on the electronic device need to be deleted, wherein stains refer to non-compliant items explicitly required by the service, that is, non-compliant hardware parameters. The first electronic device determines that the hardware parameters corresponding to various device resources in the first electronic device meet the hardware requirements of the target service. For example, if the service to be decided explicitly requires that the CPU cannot be an ARM architecture (advanced RISC machine, ARM), then the CPU parameters of the electronic device need to be stained. If the CPU does not meet the conditions, the stain check fails.
[0074] The storage resource pressure of the first electronic device is used to indicate how much storage space of the electronic device is used and how much is left; the memory resource pressure is used to indicate the program usage of the main memory of the electronic device, such as the memory consumed by the process running in the electronic device; the CPU resource pressure is used to indicate the CPU resources occupied by the program running in the electronic device, indicating the running program of the electronic device at a certain point in time; further, the first electronic device needs to determine whether the storage resource pressure, memory resource pressure, CPU resource pressure, etc. of the electronic device exceed the corresponding pressure threshold in the configuration file. If not, the condition is met. Finally, the first electronic device also needs to check the resource affinity of the device and determine whether the resource affinity meets the preset affinity condition. For example, if the target service is to play a video, the first electronic device needs to check whether the device resources corresponding to the target service are met, such as whether the display device and the speaker are occupied. When all the above conditions are met, it is determined that the first electronic device meets the basic device conditions for the operation of the target service.
[0075] In some embodiments, the first electronic device determines whether the first electronic device meets the basic device conditions for the operation of the target service based on the second device resource information. If the first electronic device meets the basic device conditions for the operation of the target service, it may be used to execute the target service, otherwise it cannot execute the target service. The first electronic device first determines whether the electronic device meets the basic device conditions for the operation of the target service. If it does not meet the conditions, there is no need to further calculate the first device score, which can reduce unnecessary calculations and save resources.
[0076] S402: When the first electronic device meets the basic device condition for running the target service, determine the score corresponding to each device resource according to the resource information of each device resource in the first device resource information of the first electronic device.
[0077] It should be noted that the first device resource information includes at least one of memory resource occupancy, CPU resource occupancy, storage resource occupancy, network resource occupancy, available peripheral resources, peripheral resource occupancy, remaining available power resources and resource affinity.
[0078] Among them, memory resource occupancy refers to the program usage of the main memory of the electronic device, such as the memory consumed by the process running in the electronic device; CPU resource occupancy refers to the CPU resources occupied by the programs running in the electronic device, indicating the situation of the running programs of the electronic device at a certain point in time; storage resource occupancy mainly refers to how much storage space of the electronic device is used and how much is left; network resource occupancy refers to the network status of the electronic device, etc. The peripheral resources of the electronic device include display screens, speakers, microphones, cameras, etc. The peripheral resource occupancy refers to the usage of the peripheral resources of the electronic device; the remaining available power resources refer to the remaining power of the battery of the electronic device; resource affinity is used to indicate the adaptability of the resources of the electronic device to the target service.
[0079] It should be understood that the first electronic device calculates the score corresponding to each device resource according to the resource information of each device resource in the first device resource information of the first electronic device and the preset resource evaluation system. Among them, the preset resource evaluation system may include one or more algorithm formulas of resources, which is not limited in this application, but the value range is usually between 0 and 10.
[0080] For example, taking CPU resources as an example, its score calculation method is related to utilization. The higher the CPU utilization, the higher the load, and the lower the score of the corresponding algorithm will be.
[0081] S403: Perform a weighted sum calculation based on the score corresponding to each device resource and the weight corresponding to each device resource to obtain a first device score.
[0082] The weight corresponding to each device resource can be used to characterize the importance of the device resource in the target service. In some embodiments, the weight corresponding to each device resource includes a scene weight and / or a user weight. Among them, the scene weight is used to indicate the importance of the device resource in the target scene, the target scene includes the scene in which the target service is running and / or the real scene in which the first electronic device is located, and the user weight is a weight set by the user.
[0083] Exemplarily, the scenario in which the target service is running includes the target service running in the foreground or in the background. For example, the weight of the display-related information in the foreground should be increased. The real scenarios in which the first electronic device is located are different scenarios such as in the car, at home, in the office, etc., and the scene weight should have different values in different scenarios. A configuration file interface will also be left in the electronic device in the early stage to facilitate subsequent updates and adjustments. In addition, user weights are mainly used to increase or decrease the weight of resource items set by users in scoring.
[0084] As an example, the first electronic device performs weighted sum calculation according to the score corresponding to each device resource and the weight corresponding to each device resource as follows:
[0085] F_Score=∑ItemScore*ItemWeight*userWeight
[0086] Among them, F_Score is the first device score, ItemScore is the score corresponding to the device resources, ItemWeight is the scene weight corresponding to the device resources, and userWeight is the user weight corresponding to the device resources.
[0087] In some embodiments, the first electronic device calculates a score by evaluating the device's memory resource occupancy, CPU resource occupancy, storage resource occupancy, network resource occupancy, available peripheral resources, remaining available power resources, resource affinity and other performance resources and adding weights. The final score is the sum of the scores of each algorithm. This score is also the first device score, which can effectively indicate the suitability of the target service for scheduling to the first electronic device. Accordingly, the higher the score, the more the target service should be loaded and executed on this device.
[0088] S404: Receive second device scores sent by one or more second electronic devices.
[0089] The second device score corresponding to the target second electronic device is determined by the target second electronic device according to its own first device resource information, and the target second electronic device is any second electronic device.
[0090] This step and Figure 3 Step S302 in the illustrated embodiment is similar and will not be described in detail here.
[0091] In a possible implementation, the first electronic device also receives an error code sent by other electronic devices, where the error code is sent by the other electronic devices when the basic device conditions for the target service operation are not met, and the other electronic devices are second electronic devices that have not sent the second device score to the first electronic device; further, the first electronic device analyzes the reasons why the other electronic devices do not meet the basic device conditions for the target service operation based on the error code.
[0092] It should be understood that before calculating its own second device score, at least one second electronic device will first determine whether it meets the basic device conditions for the operation of the target service, that is, based on the second device resource information of the second electronic device, determine whether the second electronic device meets the basic device conditions for the operation of the target service. The specific judgment method can refer to the above-mentioned method of judging whether the first electronic device meets the basic device conditions for the operation of the target service based on the second device resource information of the first electronic device, and will not be repeated here.
[0093] Furthermore, each second electronic device in at least one second electronic device will further calculate a second device score when the basic device conditions for the target service operation are met; and when the basic device conditions for the target service operation are not met, an error code will be sent to the first electronic device, and accordingly, the first electronic device receives the error code.
[0094] That is to say, if the second electronic device does not meet the basic equipment conditions for the target service to run, it means that the target service does not exist in the conditions for deployment on this electronic device, and the device deployment service process should be stopped immediately. And the corresponding error code needs to be returned to the first electronic device and the next step is performed. At the same time, the cause of the error can be analyzed by checking the relevant ERR_CODE. When it is found that one of the at least one second electronic device does not meet the basic equipment conditions for the target service to run, it does not affect other second electronic devices to continue to determine whether they meet the basic equipment conditions for the target service to run, so other devices may still be in the resource judgment process.
[0095] In one possible implementation, if all electronic devices in the distributed network, i.e., the first electronic device and at least one second electronic device, fail to meet the basic device conditions for the operation of the target service, it is necessary to tell the first electronic device that the resource matching has failed and mark the target service as a "resource matching failure service."
[0096] S405: Compare the first device score with second device scores corresponding to one or more second electronic devices.
[0097] It should be understood that the first electronic device sequentially compares the first device score with the second device scores corresponding to one or more second electronic devices, and may also perform operations such as sorting or marking these device scores.
[0098] S406, determining a target electronic device according to the comparison result.
[0099] The target electronic device is an electronic device with a device score greater than a preset score threshold among the first electronic device and one or more second electronic devices; or the target electronic device is an electronic device with the largest device score among the first electronic device and one or more second electronic devices.
[0100] It should be understood that the first electronic device can determine the electronic device with the highest score among the first device score and the second device scores corresponding to one or more second electronic devices, or the electronic device corresponding to the score exceeding a preset score threshold, as the target electronic device for executing the target service.
[0101] In this embodiment, the first electronic device determines the score corresponding to each device resource according to the resource information of each device resource in the first device resource information of the first electronic device when judging that it meets the basic device conditions for the operation of the target service, and then performs weighted sum calculation according to the score corresponding to each device resource and the weight corresponding to each device resource to obtain the first device score. Further, the second electronic device can determine the second device score according to its own first device resource information and send it to the first electronic device. The first electronic device can receive the second device score sent by one or more second electronic devices, and compare the first device score with the second device score corresponding to one or more second electronic devices, and finally determine the target electronic device according to the comparison result. In the Internet of Everything after the explosive growth of smart devices, resources and services will flow between devices. In this method, each electronic device can accurately determine the suitability between itself and the target service by using its own first device resource information when meeting the basic device conditions of the target service, and provide feedback through the device score, so as to accurately decide the most suitable electronic device for executing the service in the device network, thereby making the flow deployment of the running service more scientific, safe and accurate.
[0102] In a possible implementation manner, corresponding to the device selection method provided in the embodiment of the present application, the above-mentioned electronic devices all include three modules, such as Figure 5As shown, taking the distributed network including three electronic devices as an example, namely the first electronic device 501, the second electronic device 502 and the third electronic device 503, each electronic device may include a resource definition module, a cross-end transmission module and a decision service module. Among them, the first electronic device 501 includes a resource definition module 5011, a cross-end transmission module 5012 and a decision service module 5013, the second electronic device 502 includes a resource definition module 5021, a cross-end transmission module 5022 and a decision service module 5023, and the third electronic device 503 includes a resource definition module 5031, a cross-end transmission module 5032 and a decision service module 5033.
[0103] Among them, the resource definition module is mainly used to classify and define the device resources in the electronic device, such as CPU resource status, memory usage, storage space, network status and power, etc., and clarify the responsibilities and capabilities of the electronic devices in the network. In addition, this module needs to manage and update the device resources, such as the offline and added smart devices in the near-field network.
[0104] The cross-end transmission module is mainly used to achieve long-term connection of all electronic devices in the distributed network, ensuring that messages can be sent and received at any time. In a multi-device network, two devices need to communicate with each other, so inter-device communication capabilities are required to achieve functions such as sending scoring requirements and returning scoring results.
[0105] The decision service module is the core module of the electronic device system. It is mainly responsible for identifying electronic devices and resource data, and then checking the resources, peripheral occupancy and affinity of the device system through the preset algorithm. It quickly screens electronic devices that do not meet the service deployment requirements, and then uses the preset algorithm to weight and score the resources. The scoring results are transmitted to other electronic devices through cross-end capabilities. Finally, the main device selects the device with the maximum score or the device with a score greater than the preset score threshold as the target electronic device to execute the target service.
[0106] The above embodiment mainly describes in detail the device selection method provided in the embodiment of the present application from the perspective of the first electronic device. The following describes the device selection method provided in the embodiment of the present application from the perspective of the second electronic device. Figure 6 A flow chart of a device selection method provided in another embodiment of the present application is described in detail below. Figure 6 The steps in the method shown are applied to a second electronic device, and the flowchart includes:
[0107] S601: Determine a second device score according to first device resource information of a second electronic device.
[0108] In some embodiments, the first device resource information includes memory resource occupancy, CPU resource occupancy, storage resource occupancy, network resource occupancy, available peripheral resources, peripheral resource occupancy, remaining available power resources and resource affinity, etc. This application does not limit this.
[0109] Among them, memory resource occupancy refers to the program usage of the main memory of the electronic device, such as the memory consumed by the process running in the electronic device; CPU resource occupancy refers to the CPU resources occupied by the programs running in the electronic device, indicating the situation of the running programs of the electronic device at a certain point in time; storage resource occupancy mainly refers to how much storage space of the electronic device is used and how much is left; network resource occupancy refers to the network status of the electronic device, etc. The peripheral resources of the electronic device include display screens, speakers, microphones, cameras, etc. The peripheral resource occupancy refers to the usage of the peripheral resources of the electronic device; the remaining available power resources refer to the remaining power of the battery of the electronic device; resource affinity is used to indicate the adaptability of the resources of the electronic device to the target service.
[0110] In some embodiments, before determining the second device score according to the first device resource information of the second electronic device, the second electronic device also determines whether the second electronic device meets the basic device conditions for running the target service according to the second device resource information of the second electronic device.
[0111] Among them, the second device resource information includes one or more resource information of peripheral resources possessed by the electronic device, peripheral resource occupancy, hardware parameters corresponding to various device resources, storage resource pressure, memory resource pressure, CPU resource pressure and resource affinity; the basic device conditions include one or more of the following: the peripheral resources possessed by the electronic device match the peripheral resources required by the target service; the peripheral resources in the electronic device that match the target service are not occupied; the hardware parameters corresponding to various device resources in the electronic device meet the hardware requirements of the target service; the storage resource pressure of the electronic device does not exceed the first pressure threshold; the memory resource pressure of the electronic device does not exceed the second pressure threshold; the CPU resource pressure of the electronic device does not exceed the third pressure threshold; the resource affinity meets the preset affinity condition.
[0112] This step and Figure 4 The step S401 in the illustrated embodiment in which the first electronic device determines whether the first electronic device meets the basic device condition for running the target service based on the second device resource information of the first electronic device is similar and will not be repeated here.
[0113] Furthermore, when the second electronic device meets the basic device condition for running the target service, the score corresponding to each device resource is determined according to the resource information of each device resource in the first device resource information of the second electronic device.
[0114] This step and Figure 4 In step S402 of the illustrated embodiment, the step of the first electronic device determining the score corresponding to each device resource according to the resource information of each device resource in the first device resource information of the first electronic device is similar and will not be repeated here.
[0115] In a possible implementation, when the second electronic device does not meet the basic device conditions for the target service to run, an error code is sent to the first electronic device so that the first electronic device can analyze the reason why the second electronic device does not meet the basic device conditions for the target service to run according to the error code.
[0116] Finally, the second electronic device performs a weighted sum calculation according to the score corresponding to each device resource and the weight corresponding to each device resource to obtain a second device score.
[0117] Among them, the weight corresponding to each device resource includes scene weight and / or user weight; the scene weight is used to indicate the importance of the device resource in the target scene, the target scene includes the scene in which the target service runs and / or the actual scene in which the first electronic device is located; the user weight is the weight set by the user.
[0118] This step and Figure 4 The step of performing weighted sum calculation by the first electronic device according to the score corresponding to each device resource and the weight corresponding to each device resource in step S403 of the illustrated embodiment to obtain the first device score is similar and will not be repeated here.
[0119] S602: Send the second device score to the first electronic device, so that the first electronic device determines a target electronic device according to the first device score and the second device scores corresponding to one or more second electronic devices.
[0120] The first device score is determined by the first electronic device according to its own first device resource information.
[0121] Optionally, after calculating the second device score, the second electronic device sends the second device score to the first electronic device, so that the first electronic device determines the target electronic device according to the first device score and the second device scores corresponding to one or more second electronic devices.
[0122] In this embodiment, the second electronic device determines the second device score based on the first device resource information of the second electronic device, and then sends the second device score to the first electronic device, so that the first electronic device determines the target electronic device based on the first device score and the second device scores corresponding to one or more second electronic devices. In this method, each electronic device can accurately determine the suitability between itself and the target service by using its own first device resource information, and provide feedback through the device score, so as to accurately determine the electronic device in the device network that is most suitable for executing the service, thereby making the flow deployment of the running service more scientific, safe and accurate.
[0123] It should also be understood that the above embodiments may be coupled to each other, and this application does not limit this. Moreover, the size of the sequence number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0124] Combined with the above Figures 1 to 6 , describes in detail the device selection method of the embodiment of the present application, and will be combined with Figure 7 and Figure 8 , describe in detail the device selection device of the embodiment of the present application.
[0125] Figure 7 A structural schematic diagram of a device selection apparatus 700 provided in one embodiment of the present application, the apparatus 700 includes: a determination module 701 and a receiving module 702.
[0126] Among them, the determination module 701 is used to determine the first device score corresponding to the first electronic device according to the first device resource information of the first electronic device, and the first device score is used to indicate the suitability of the target service to be scheduled to the first electronic device; the receiving module 702 is used to receive the second device score sent by one or more second electronic devices; wherein the second device score corresponding to the target second electronic device is determined by the target second electronic device according to its own first device resource information, and the target second electronic device is any of the second electronic devices; the determination module 701 is also used to determine the target electronic device according to the first device score and the second device scores corresponding to the one or more second electronic devices, respectively, and the target electronic device is the electronic device in the distributed network used to execute the target service.
[0127] In some embodiments, the first device resource information includes memory resource occupancy, central processing unit CPU resource occupancy, storage resource occupancy, network resource occupancy, and available peripheral resources, and at least one of the peripheral resource occupancy, remaining available power resources, and resource affinity, wherein the resource affinity is used to indicate the compatibility of the resources of the electronic device with the target service.
[0128] In some embodiments, the first device resource information includes resource information of one or more device resources; the determination module 701 is specifically used to: determine the score corresponding to each device resource according to the resource information of each device resource in the first device resource information of the first electronic device;
[0129] A weighted sum calculation is performed according to the score corresponding to each type of device resource and the weight corresponding to each type of device resource to obtain the first device score.
[0130] In some embodiments, the weight corresponding to each type of device resource includes a scenario weight and / or a user weight; the scenario weight is used to indicate the importance of the device resource in the target scenario, and the target scenario includes the scenario in which the target service runs and / or the actual scenario in which the first electronic device is located; the user weight is a weight set by the user.
[0131] In some embodiments, the determination module 701 is specifically used to: compare the first device score and the second device scores corresponding to the one or more second electronic devices; determine the target electronic device based on the comparison result, the target electronic device being an electronic device among the first electronic device and the one or more second electronic devices, whose device score is greater than a preset score threshold; or, the target electronic device is an electronic device among the first electronic device and the one or more second electronic devices, whose device score is the largest.
[0132] In some embodiments, the apparatus further includes: a judgment module. The judgment module is used to judge whether the first electronic device meets the basic device condition for running the target service according to the second device resource information of the first electronic device; the determination module 701 is specifically used to: determine the first device score corresponding to the first electronic device according to the first device resource information of the first electronic device when the first electronic device meets the basic device condition for running the target service.
[0133] In some embodiments, the second device resource information includes one or more resource information of peripheral resources possessed by the electronic device, peripheral resource occupancy, hardware parameters corresponding to various device resources, storage resource pressure, memory resource pressure, CPU resource pressure and resource affinity, and the basic device conditions include one or more of the following: the peripheral resources possessed by the electronic device match the peripheral resources required by the target service; the peripheral resources in the electronic device that match the target service are not occupied; the hardware parameters corresponding to various device resources in the electronic device meet the hardware requirements of the target service; the storage resource pressure of the electronic device does not exceed the first pressure threshold; the memory resource pressure of the electronic device does not exceed the second pressure threshold; the CPU resource pressure of the electronic device does not exceed the third pressure threshold; and the resource affinity meets the preset affinity condition.
[0134] In some embodiments, the device further includes: an analysis module. The receiving module 702 is further used to receive an error code sent by other electronic devices, where the error code is sent by the other electronic devices when the basic device conditions for the target service operation are not met, and the other electronic devices are second electronic devices that have not sent the second device score to the first electronic device; and the analysis module is used to analyze the reason why the other electronic devices do not meet the basic device conditions for the target service operation according to the error code.
[0135] It should be understood that the device 700 here is embodied in the form of a functional module. The term "module" here may refer to an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a proprietary processor or a group processor, etc.) and a memory for executing one or more software or firmware programs, a merged logic circuit and / or other suitable components that support the described functions. In an optional example, those skilled in the art may understand that the device 700 may be specifically the first electronic device in the above-mentioned embodiment, or the function of the first electronic device in the above-mentioned embodiment may be integrated in the device 700, and the device 700 may be used to execute the various processes and / or steps corresponding to the first electronic device in the above-mentioned method embodiment, and to avoid repetition, it will not be repeated here.
[0136] The above-mentioned device 700 has the function of implementing the corresponding steps executed by the first electronic device in the above-mentioned method; the above-mentioned function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-mentioned function.
[0137] Figure 8 A structural schematic diagram of a device selection apparatus provided in another embodiment of the present application. Figure 8The device selection apparatus shown can be used to execute the method of any one of the aforementioned embodiments.
[0138] like Figure 8 As shown, the device 800 of this embodiment includes: a memory 801, a processor 802, a communication interface 803 and a bus 804. The memory 801, the processor 802 and the communication interface 803 are connected to each other through the bus 804.
[0139] The memory 801 may be a read only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM). The memory 801 may store a program. When the program stored in the memory 801 is executed by the processor 802, the processor 802 is used to execute each step of the method shown in the above embodiment.
[0140] The processor 802 can adopt a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs to implement the various methods shown in the embodiments of the present application.
[0141] The processor 802 may also be an integrated circuit chip with signal processing capability. In the implementation process, each step of the method of the embodiment of the present application may be completed by an integrated logic circuit of hardware in the processor 802 or by instructions in the form of software.
[0142] The processor 802 may also be a general purpose processor, a digital signal processor (DSP), an ASIC, a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The methods, steps, and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general purpose processor may be a microprocessor or the processor may be any conventional processor.
[0143] The steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 801, and the processor 802 reads the information in the memory 801, and completes the functions required to be performed by the units included in the device of the present application in combination with its hardware.
[0144] The communication interface 803 may use, but is not limited to, a transceiver or other transceiver device to implement communication between the apparatus 800 and other devices or a communication network.
[0145] The bus 804 may include a path for transmitting information between various components of the device 800 (eg, the memory 801 , the processor 802 , and the communication interface 803 ).
[0146] It should be understood that the device 800 shown in the embodiment of the present application may be an electronic device, or may also be a chip configured in the electronic device.
[0147] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0148] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example 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 performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0149] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0150] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0151] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0152] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0153] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.
[0154] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A device selection method, characterized in that: Applied to a first electronic device, the first electronic device and at least one second electronic device form a distributed network, the method includes: Determining, according to the first device resource information of the first electronic device, a first device score corresponding to the first electronic device, where the first device score is used to indicate suitability of scheduling a target service to the first electronic device; Receiving a second device score sent by one or more second electronic devices; wherein the second device score corresponding to the target second electronic device is determined by the target second electronic device according to its own first device resource information, and the target second electronic device is any of the second electronic devices; A target electronic device is determined according to the first device score and the second device scores respectively corresponding to the one or more second electronic devices, where the target electronic device is an electronic device in the distributed network for executing the target service.
2. The method according to claim 1, characterized in that The first device resource information includes memory resource occupancy, central processing unit CPU resource occupancy, storage resource occupancy, network resource occupancy, and available peripheral resources, and at least one of the peripheral resource occupancy, remaining available power resources and resource affinity. The resource affinity is used to indicate the adaptability of the resources of the electronic device to the target service.
3. The method according to claim 1, characterized in that The first device resource information includes resource information of one or more device resources; and determining a first device score corresponding to the first electronic device according to the first device resource information of the first electronic device includes: Determine, according to the resource information of each type of device resource in the first device resource information of the first electronic device, a score corresponding to each type of device resource; A weighted sum calculation is performed according to the score corresponding to each type of device resource and the weight corresponding to each type of device resource to obtain the first device score.
4. The method according to claim 3, characterized in that The weight corresponding to each type of device resource includes a scene weight and / or a user weight; The scenario weight is used to indicate the importance of the device resource in the target scenario, and the target scenario includes the scenario in which the target service runs and / or the real scenario in which the first electronic device is located; The user weight is a weight set by the user.
5. The method according to claim 1, characterized in that The determining the target electronic device according to the first device score and the second device scores respectively corresponding to the one or more second electronic devices includes: comparing the first device score with second device scores corresponding to the one or more second electronic devices; The target electronic device is determined according to the comparison result, and the target electronic device is an electronic device whose device score is greater than a preset score threshold among the first electronic device and the one or more second electronic devices; or, the target electronic device is an electronic device whose device score is the largest among the first electronic device and the one or more second electronic devices.
6. The method according to claim 1, characterized in that Before determining the first device score corresponding to the first electronic device according to the first device resource information of the first electronic device, the method further includes: Determining, based on the second device resource information of the first electronic device, whether the first electronic device meets the basic device condition for running the target service; The determining, according to the first device resource information of the first electronic device, a first device score corresponding to the first electronic device includes: In a case where the first electronic device meets the basic device condition for running the target service, a first device score corresponding to the first electronic device is determined according to the first device resource information of the first electronic device.
7. The method according to claim 6, characterized in that The second device resource information includes one or more resource information of peripheral resources possessed by the electronic device, peripheral resource occupancy, hardware parameters corresponding to various device resources, storage resource pressure, memory resource pressure, CPU resource pressure and resource affinity; The basic equipment conditions include one or more of the following: The peripheral resources of the electronic device match the peripheral resources required by the target service; Peripheral resources in the electronic device that match the target service are not occupied; The hardware parameters corresponding to various device resources in the electronic device meet the hardware requirements of the target service; The storage resource pressure of the electronic device does not exceed the first pressure threshold; The memory resource pressure of the electronic device does not exceed the second pressure threshold; The CPU resource pressure of the electronic device does not exceed the third pressure threshold; The resource affinity meets a preset affinity condition.
8. The method according to claim 6 or 7, characterized in that: The method further comprises: receiving an error code sent by another electronic device, where the error code is sent by the other electronic device when the basic device condition for running the target service is not met, and the other electronic device is a second electronic device that has not sent a second device score to the first electronic device; According to the error code, the reason why the other electronic device does not meet the basic device condition for running the target service is analyzed.
9. A device selection system, characterized in that: comprising a plurality of electronic devices, wherein the plurality of electronic devices form a distributed network; A first electronic device among the plurality of electronic devices is configured to determine a first device score corresponding to the first electronic device according to first device resource information of the first electronic device, wherein the first device score is used to indicate suitability of scheduling a target service to the first electronic device; a second electronic device among the plurality of electronic devices, configured to determine a second device score corresponding to the second electronic device according to the first device resource information of the second electronic device, and send the second device score to the first electronic device; The first electronic device is further used to receive a second device score sent by one or more second electronic devices, and determine a target electronic device based on the first device score and the second device scores corresponding to the one or more second electronic devices, where the target electronic device is an electronic device in the distributed network used to execute the target service.
10. A device selection apparatus, characterized in that: Applied to a first electronic device, the first electronic device and at least one second electronic device form a distributed network, the device includes: a determination module, configured to determine a first device score corresponding to the first electronic device according to the first device resource information of the first electronic device, wherein the first device score is used to indicate the suitability of scheduling a target service to the first electronic device; a receiving module, configured to receive a second device score sent by one or more second electronic devices; wherein the second device score corresponding to the target second electronic device is determined by the target second electronic device according to its own first device resource information, and the target second electronic device is any of the second electronic devices; The determination module is further used to determine a target electronic device according to the first device score and the second device scores respectively corresponding to the one or more second electronic devices, where the target electronic device is an electronic device in the distributed network used to execute the target service.
11. An electronic device, characterized in that: The system comprises a processor and a memory, wherein the memory is used to store code instructions; the processor is used to run the code instructions to execute the method according to any one of claims 1 to 8.
12. A computer-readable storage medium, characterized in that: Used to store a computer program, the computer program comprising instructions for implementing the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Task scheduling method, device and equipment
CN114116154A
Distributed implementation method, distributed system, readable medium and electronic equipment
CN114697348A
System and Method for Centralized Management of Software Services
US20180139308A1