Resource allocation method and device for terminal equipment, equipment, medium and product

By assessing the available server resources of terminal devices and adjusting resource priorities based on changes in network status and time range, the problem of resource idleness caused by static configuration is solved, thereby improving resource utilization and device efficiency.

CN121509359APending Publication Date: 2026-02-10LINKZHILIAN (CHONGQING) TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511803958.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

In existing technologies, the node resources allocated to act as servers in terminal devices are statically configured, which results in the inflexibility of resource allocation, the inability to release idle resources, and low resource utilization efficiency.

Method used

By assessing the remaining availability of server resources in the terminal device, and adjusting the resource allocation strategy based on network status, changes within a preset time range, and weights, server resources are dynamically allocated, and resources are reallocated according to server resource priorities.

Benefits of technology

It enables dynamic management and allocation of resources, improving resource utilization and the overall efficiency of terminal equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121509359A_ABST
    Figure CN121509359A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a resource allocation method and device for terminal equipment, the equipment, a medium and a product. The method comprises the following steps: determining residual available resources in available resources of a server to obtain residual available resources of the server; determining a basic resource priority of the terminal device serving as the server device according to the residual available resources of the server; according to the network state of the terminal device, the variable quantity of the device connection quantity in a preset first time range, the variable quantity of data transmission in a preset second time range, the variable quantity of the number of times of terminal device connection in a preset third time range and a preset weight, the basic resource priority is adjusted, and the service end resource allocation priority is obtained; and reallocating server available resources and client available resources in the terminal equipment according to the server resource allocation priority. According to the resource allocation scheme of the terminal equipment provided by the embodiment of the invention, the resource utilization rate and the efficiency when the terminal equipment realizes own functions can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of communication technology, and in particular relates to a resource allocation method, apparatus, device, medium and product for a terminal device. Background Technology

[0002] In the current technical solution, multiple terminal devices are interconnected by building a virtual private network, so that each terminal can not only perform the functions of a traditional client, but also act as a node of the server, participating in and assisting in the data transmission tasks between terminals.

[0003] However, in existing terminal devices, the various resources allocated to nodes acting as servers are typically configured statically, making it difficult to flexibly allocate and optimize them based on actual operating conditions. If these resources, which remain idle for extended periods, are not effectively released, reclaimed, or reused, it will not only cause unnecessary resource consumption but also reduce the overall system's resource utilization efficiency. Summary of the Invention

[0004] This invention provides a method, apparatus, device, medium, and product for allocating resources for terminal devices, which can dynamically allocate the resources occupied by server roles as needed to improve overall resource utilization.

[0005] In a first aspect, embodiments of the present invention provide a resource allocation method for a terminal device, applied to the terminal device, wherein the terminal device is used as a server device in a virtual private network to forward data, and the available resources of the terminal device include server-side available resources used as a server device and client-side available resources used as a client device, the method comprising: Determine the remaining available resources among the available server resources to obtain the remaining available server resources; Based on the remaining available resources on the server, the priority of the terminal device as the basic resource of the server device is determined; Based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and a preset weight, the basic resource priority is adjusted to obtain the server-side resource allocation priority of the terminal device used as the server-side device. Based on the resource allocation priority of the server, the available resources of the server and the available resources of the client are reallocated within the terminal device.

[0006] In one feasible implementation, the remaining available resources on the server side include the remaining memory resources of the terminal device used as the server device, the remaining computing resources of the processor, and the remaining transmission bandwidth for data transmission. The method further includes: The remaining service capacity that the terminal device can handle when used as a server device is determined based on the remaining memory resources, the remaining computing resources of the processor, and the remaining transmission bandwidth for data transmission. The priority of the basic resources is determined based on the remaining available service capacity.

[0007] In one feasible implementation, the method further includes: Based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and a preset weight, the priority change corresponding to the basic resource priority is determined. The priority of the basic resources is adjusted according to the priority change to obtain the priority of the server-side allocated resources.

[0008] In one feasible implementation, the preset weights include network state weights, device quantity change weights, data quantity weights, connection count weights, and data connection count weights. The method further includes: Based on the network status of the terminal device and the network status weight, a first change in the priority of the basic resources is determined; Based on the change in the number of connected devices within a preset first time range of the terminal device and the weight of the change in the number of devices, a second change in the priority of the basic resources is determined; Based on the amount of change in transmitted data within the preset second time range and the data volume weight, a third change in the priority of the basic resources is determined; Based on the change in the number of times the terminal device is connected within the preset third time range and the weight of the number of connections, a fourth change in the priority of the basic resources is determined; The fifth change in the priority of the basic resources is determined based on the change in the amount of data transmitted within the preset first time period, the change in the number of times the terminal device is connected within the preset second time period, and the weight of the number of data connections. The priority change amount is determined based on the first change amount, the second change amount, the third change amount, the fourth change amount, and the fifth change amount.

[0009] In one feasible implementation, the method for establishing a virtual private network connection between at least two terminal devices includes establishing a virtual private network connection through the link information of each terminal device, wherein the link information of the terminal device includes: the device identifier of the terminal device, the public IP address of the terminal device, the public IP port number of the terminal device, the virtual private network interface address of the terminal device, and the unique encryption key of the terminal device.

[0010] In one feasible implementation, the method further includes: The duration for which the terminal device is used as a server device is determined based on the resource allocation priority of the server.

[0011] In one feasible implementation, the method further includes: Based on the resource allocation priority of the server, the priority of the terminal device for data forwarding as a server device is determined, and the forwarding priority is obtained; Based on the forwarding priority, the data transmission path among the multiple terminal devices is determined.

[0012] Secondly, embodiments of the present invention provide a resource allocation apparatus for a terminal device, wherein the terminal device is used as a server device in a virtual private network to forward data, and the available resources of the terminal device include server-side available resources used as a server device and client-side available resources used as a client device. The apparatus includes: The first determining module is used to determine the remaining available resources among the available resources on the server side, and obtain the remaining available resources on the server side. The second determining module is used to determine the priority of the terminal device as the basic resource of the server device based on the remaining available resources of the server. The adjustment module is used to adjust the basic resource priority based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and a preset weight, so as to obtain the server allocation resource priority of the terminal device used as the server device. The allocation module is used to reallocate the available resources of the server and the available resources of the client within the terminal device according to the resource allocation priority of the server.

[0013] Thirdly, embodiments of the present invention provide a resource allocation device for a terminal device, the device comprising: A processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the resource allocation method for the terminal device as described in the first aspect.

[0014] Fourthly, embodiments of the present invention provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement the resource allocation method for a terminal device as described in the first aspect.

[0015] Fifthly, embodiments of the present invention provide a computer program product, wherein when the computer program is executed by a processor, it implements the resource allocation method for a terminal device as described in the first aspect.

[0016] The resource allocation method, apparatus, device, medium, and product for terminal devices in this invention can determine the basic resource priority of the terminal device as the server device based on the remaining available resources in the available resources of the server. Then, based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and a preset weight, the basic resource priority is adjusted to obtain the server-side allocated resource priority. The server-side allocated resource priority can represent the resource occupancy priority of the terminal device. Finally, based on the server-side allocated resource priority, the available server resources and available client resources are reallocated within the terminal device. In this way, the available server resources and available client resources can be dynamically managed according to the resource occupancy priority of the terminal device, thereby improving resource utilization and the efficiency of the terminal device in performing its own functions. Attached Figure Description

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

[0018] Figure 1 A flowchart illustrating a resource allocation method for a terminal device according to an embodiment of this application is shown; Figure 2 A flowchart illustrating the process of determining the priority of basic resources is shown in another embodiment of this application; Figure 3 A flowchart illustrating the process of determining the priority of basic resources is shown in another embodiment of this application; Figure 4 A flowchart illustrating the process of determining the priority of basic resources is shown in yet another embodiment of this application; Figure 5 This diagram illustrates the composition of server-side resource allocation priority according to an embodiment of this application; Figure 6 A flowchart illustrating a resource allocation method for a terminal device according to yet another embodiment of this application is shown; Figure 7 A schematic diagram of the structure of a terminal device provided in one embodiment of this application is shown; Figure 8 This illustration shows a schematic diagram of establishing a virtual private network connection according to an embodiment of this application; Figure 9 A schematic diagram illustrating the establishment of a virtual private network connection according to another embodiment of this application is shown; Figure 10 This invention provides a schematic diagram illustrating the structure between a public network server center and a terminal device according to an embodiment of this application. Figure 11 This illustration shows a schematic diagram of the structure of a resource allocation device for a terminal device according to an embodiment of this application; Figure 12 A schematic diagram of the hardware structure of the resource allocation device of the terminal device provided in the embodiment of this application is shown. Detailed Implementation

[0019] The features and exemplary embodiments of various aspects of the present invention will now be described in detail. To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely intended to explain the present invention and not to limit it. For those skilled in the art, the present invention can be practiced without some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present invention by illustrating examples of the invention.

[0020] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0021] After establishing a Virtual Private Network (VPN) connection between multiple terminal devices, not only can the original functions of the terminal devices be realized, such as information collection and data calculation, but data can also be transmitted between them through the VPN. Here, the part of the terminal devices used to perform their original functions is called the client device, and the part used for data transmission between multiple terminal devices is called the server device. However, in the existing terminal device architecture, the resources of the server device and the client device are clearly separated, and their resources are usually static, making it impossible to allocate or schedule resources between them. This results in two problems: firstly, the resources occupied by the server device cannot be flexibly allocated according to actual needs; secondly, it makes it difficult to release idle resources in the server device in a timely manner. This rigid model leads to the dual impact of resource waste and low utilization efficiency.

[0022] To address the problems in the prior art, embodiments of the present invention provide a resource allocation method, apparatus, device, medium, and product for terminal devices. It mainly assesses the remaining available resources in the available server resources of the terminal device and the change in resource occupancy used as the server device, and uses this as the priority of the available server resources in the terminal device. Then, it reallocates the available server resources and available client resources in the terminal device according to the priority of the available server resources, thereby realizing dynamic management and allocation of resources.

[0023] The resource allocation method for terminal devices provided in this embodiment of the invention will be introduced below.

[0024] Figure 1 A flowchart illustrating a resource allocation method for a terminal device according to an embodiment of this application is shown. This method is applied to a terminal device that acts as a server-side device in a virtual private network (VPN) to forward data. The available resources of the terminal device include server-side available resources used as a server-side device and client-side available resources used as a client-side device. Figure 1 As shown, the method may include the following steps: S101 to S104.

[0025] S101. Determine the remaining available resources among the available resources on the server side to obtain the remaining available resources on the server side.

[0026] In this embodiment, the terminal device can be used as a server device to transmit data. Specifically, when the terminal device is used as a server device, it can not only act as a data relay station (i.e., forwarding data), but also directly send data to or receive data from any other device. It should be noted that when data is transmitted between terminal devices, that terminal device can be called a server device. A client device refers to the sum of resources that enable the functions of the terminal device itself. For example, a terminal device can be a camera or a computer. When used as a client device, it can be used for recording, photographing, and data calculation and processing. It is easy to see that client devices and server devices are distinguished by function and role, specifically based on whether they are used for data transmission.

[0027] In this embodiment, available server resources refer to all available resources when the terminal device is used as or acts as a server device. In other words, available server resources refer to the available resources used by the terminal device for data transmission. In S101, resources that the server device can still use but have not yet used are determined from the available server resources; these are the remaining available resources. The remaining available resources in the available server resources are referred to as the remaining available server resources. In some embodiments, the remaining available server resources can be determined by factors such as remaining memory resources, remaining processor computing resources, and remaining transmission bandwidth used for data transmission.

[0028] S102. Based on the remaining available resources on the server, determine the priority of the basic resources for the terminal device to be used as the server device.

[0029] In this embodiment, the terminal device is used as the basic resource priority of the server device to represent the amount of remaining available resources on the server. Specifically, the more remaining available resources the server has, the higher the basic resource priority, and vice versa. It is easy to see that there is a direct proportionality between the remaining available resources on the server and the basic resource priority. The specific functional relationship between the remaining available resources on the server and the basic resource priority can be set by the user and is not subject to any limitations.

[0030] In this embodiment, the basic resource priority can be used to assess the server device's ability to handle additional data transmission tasks in the future. A higher basic resource priority means more available resources on the server, and therefore a stronger ability for the server device to handle more data transmission tasks in the future. Conversely, a lower basic resource priority means fewer available resources on the server, and therefore a weaker ability for the server device to handle more data transmission tasks in the future.

[0031] Figure 2 A flowchart illustrating the process of determining the priority of basic resources according to another embodiment of this application is shown. In some embodiments, the remaining available resources on the server side include the remaining memory resources of the terminal device used as the server device, the remaining computing resources of the processor, and the remaining transmission bandwidth for data transmission. As shown in the figure, in other embodiments, S102 may include: S201. Determine the remaining service capacity that the terminal device can handle when used as a server device based on the remaining memory resources, the remaining computing resources of the processor, and the remaining transmission bandwidth used for data transmission.

[0032] S202. Determine the priority of basic resources based on the remaining service capacity.

[0033] In this embodiment, the remaining memory resources of the terminal device used as a server device refer to the free memory capacity that the server device can currently use immediately. Remaining computing resources refer to the idle portion of the combined processing power of all computing components of the server device. Specifically, the remaining computing resources of the processor refer to the remaining computing resources of the Central Processing Unit (CPU) and other modules or units used for computing, which can characterize how much spare computing power the server device has for data transmission. The remaining transmission bandwidth for data transmission refers to the maximum theoretical rate that can be used to transmit new data on the network connection channel of your terminal device, which is currently not occupied. Specifically, in this embodiment, the network connection channel specifically refers to a Virtual Private Network (VPN) connection channel. The remaining transmission bandwidth for data transmission can be further determined by the upper limits of the uplink and downlink bandwidth on the network used for data transmission and the currently occupied bandwidth.

[0034] In some embodiments, the remaining service capacity in S201 refers to the amount of additional data transmission tasks that can be handled using the remaining available resources of the server. This additional data transmission task capacity can be represented by the number of devices communicating simultaneously; for example, it can support an additional 100 devices communicating simultaneously. In this embodiment, the idle resources of the server device can be determined based on the remaining memory resources, the remaining computing resources of the processor, and the remaining transmission bandwidth used for data transmission, and the remaining service capacity can be evaluated accordingly.

[0035] In some embodiments, S202 can determine the basic resource priority based on the amount or size of the remaining service capacity. A larger remaining service capacity results in a higher basic resource priority; conversely, a smaller remaining service capacity results in a lower basic resource priority. The mapping function between the remaining service capacity and the basic resource priority can be set independently. In some embodiments, the basic resource priority can be set from level 0 to level 9. If the remaining service capacity is sufficient to support more than 100 devices simultaneously communicating, the basic resource priority for using that terminal device as a server is set to the highest level, i.e., level 9. If the remaining service capacity is insufficient to support even one additional device communicating, the basic resource priority for using that terminal device as a server is set to the lowest level, i.e., level 0. The mapping relationship between the basic resource priority levels (0 to 9) and the remaining service capacity can be set independently.

[0036] Through steps S201 to S202, the remaining service capacity can be assessed by utilizing the remaining memory resources, remaining processor computing resources, and remaining transmission bandwidth for data transmission within the remaining service capacity. Based on this remaining service capacity, the basic resource priority is determined, thereby evaluating the server device's ability to handle additional data transmission tasks in the future. This allows for the determination of whether currently required data can be forwarded by the server device based on the basic resource priority; for example, forwarding by a server device with a higher basic resource priority can improve data transmission efficiency.

[0037] In this embodiment, it is necessary to continuously determine the remaining available resources on the server side according to a preset period and to determine the priority of basic resources. Additionally, for certain terminal devices, the parameters or indicators in the remaining available resources on the server side can be reduced. For example, for busy or resource-limited terminal devices, only the remaining memory amount can be considered as the remaining available resources on the server side.

[0038] S103. Based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and the preset weight, adjust the basic resource priority to obtain the server-side resource allocation priority for the terminal device used as a server device.

[0039] In this embodiment, the preset first time range, preset second time range, and preset third time range refer to three pre-set time periods or ranges. In some embodiments, the preset first time range, preset second time range, and preset third time range may all be different, or at least two may be the same. The network status of the terminal device refers to the overall communication capability between the terminal device and the network it is connected to, which can be determined by parameters such as signal strength, latency, throughput, jitter, and packet loss rate. The number of connected devices within the preset first time range refers to the number of terminal devices connected to the terminal device within that range. The change in the number of connected devices within the preset first time range represents the change in the number of connected devices. In this embodiment, the connection to the terminal device specifically refers to a virtual private network (VPN) connection. The change in transmitted data within the preset second time range refers to the change in the amount of data transmitted by the server device within that range. Specifically, the change in transmitted data can be represented by the change in the amount of data packets. The number of times a terminal device is connected represents the number of times a VPN connection is established with the terminal device. The change in the number of times a terminal device is connected refers to the increase or decrease in the number of times the terminal device is connected.

[0040] In this embodiment, the preset weights refer to the different weights pre-set for the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, and the change in the number of times the terminal device is connected within a preset third time range. This is to facilitate the subsequent weighted fusion of the above parameters or indicators, thereby making adjustments to the priority of basic resources more in line with the changes.

[0041] In this embodiment, the basic resource priority only represents the additional data transmission capacity at the current time. However, when the server device is transmitting data, the remaining available resources on the server will change, and thus the server device's ability to handle additional data transmission tasks will also change. For example, if the server device subsequently connects to multiple new terminal devices, it means that some of the server's remaining available resources will be used for data transmission with these newly connected terminal devices, and the server device's ability to handle additional data transmission tasks will decrease.

[0042] Through S103, the priority of basic resources can be dynamically adjusted based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and the preset weight, thereby dynamically determining or evaluating the server device's ability to perform additional data transmission.

[0043] Figure 3A flowchart illustrating the process of determining the priority of basic resources is shown in another embodiment of this application. As shown, in some embodiments, S103 may include: S301 to S302.

[0044] S301. Based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and the preset weight, determine the priority change corresponding to the basic resource priority.

[0045] In some embodiments, the priority change refers to the increase or decrease in the priority of basic resources. In S301, the increase or decrease in the priority of basic resources can be determined based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of data transmitted within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and the preset weight. This realizes the determination of the change in the priority of basic resources based on the status and change of the indicators or parameters of the data transmission of the server device.

[0046] Figure 4 This illustration shows a flowchart of determining the priority of basic resources according to another embodiment of this application. In some embodiments, the preset weights include network state weights, device quantity change weights, data quantity weights, connection count weights, and data connection count weights. As shown in the figure, in another embodiment, S301 may include S401 to S406.

[0047] S401. Determine the first change in basic resource priority based on the network status and network status weight of the terminal device.

[0048] In this embodiment, the network status of the terminal device includes not only parameters such as signal strength, throughput, jitter, and packet loss rate, but also, and particularly, latency. The network status weight is a weight set based on the degree of influence of network status on changes in the priority of basic resources. Generally speaking, network status has a significant impact on transmitted data, so a higher network status weight is set. In other words, the network status has a significant impact on changes in the priority of basic resources; the network status weight can be set to 40%, and the value of the network status weight is not subject to any restrictions. The first change refers to the change in the priority of basic resources determined based on the network status and the network status weight.

[0049] In this embodiment, network status and latency are mapped to a first change quantity. Specifically, if the network status is good and the latency is low, it means that the server device has a high capability for subsequent transmissions. In this case, the first change quantity is the increase in basic resource priority, which represents the amount by which the basic resource priority is increased. If the network status is poor and the latency is high, it means that the server device has a lower capability for subsequent transmissions. In this case, the first change quantity is the decrease in basic resource priority, which represents the amount by which the basic resource priority is decreased.

[0050] In this embodiment, the mapping relationship between network status and latency and the first change can be set independently without any restrictions. In this embodiment, bandwidth, latency, jitter, packet loss rate, and availability can be comprehensively examined through preset indicators to evaluate whether the network status is good or bad. Alternatively, the latency can be determined as high or low based on different scenarios and the corresponding good latency range standards.

[0051] S402. Based on the change in the number of connected devices and the weight of the change in the number of devices within the preset first time range of the terminal device, determine the second change in the priority of basic resources.

[0052] In this embodiment, the preset first time range can be set to the most recent week, the most recent month, etc., and is not subject to any restrictions. The second change refers to the change in basic resource priority determined based on the change in the number of connected devices within the preset first time range and the device change weight. It is easy to understand that the second change is influenced by the change in the number of connected devices within the preset first time range. The device change weight is a weight set based on the degree of influence of the change in the number of connected devices within the preset first time range on the change in basic resource priority. A higher device change weight indicates a greater degree of influence of the change in the number of connected devices within the preset first time range on the change in basic resource priority.

[0053] In this embodiment, the change in the number of connected devices within a preset first time range is proportional to the second change. Specifically, if the change in the number of connected devices within the preset first time range is an increase, it indicates that the server device needs to transmit more data within the preset first time range, that is, the server device needs more resources. Therefore, the server device has a lower ability to transmit data in the future, and at this time, the basic resource priority needs to be reduced. The specific reduction value of the basic resource priority is proportional to the change in the number of connected devices within the preset first time range.

[0054] If the change in the number of connected devices within the preset first time range is decreasing, it indicates that the server device needs to transmit less data within the preset first time range, that is, the server device needs less resources. Therefore, the server device has a higher ability to transmit data in the future. At this time, it is necessary to increase the basic resource priority. The specific increase in the basic resource priority is proportional to the value of the change in the number of connected devices within the preset first time range.

[0055] In some embodiments, the second change can be represented by a real number. If the second change is greater than zero, it indicates that the second change is the amount by which the basic resource priority increases; if the second change is less than zero, it indicates that the basic resource priority needs to be reduced or lowered, and the amount by which the basic resource priority is reduced is the absolute value of the second change.

[0056] S403. Based on the change in transmitted data and the data volume weight within a preset second time range, determine the third change in the priority of basic resources.

[0057] In this embodiment, the data volume weight is a weight set based on the degree of influence of the change in the amount of transmitted data within a preset second time range on the change in the basic resource priority. A higher change in transmitted data within the preset second time range indicates a greater influence of the change in the number of connected devices within a preset first time range on the change in the basic resource priority. The preset second time range can be the most recent month or week. If transmitted data increases within the preset second time range, it indicates that the server device is consuming more resources, meaning its ability to transmit data in the future is lower, thus requiring a reduction in the basic resource priority. Conversely, if transmitted data decreases within the preset second time range, it indicates that the server device is consuming fewer resources, meaning it has more remaining available resources, in other words, its ability to transmit data in the future is higher, thus allowing for an increase in the basic resource priority.

[0058] S404. Based on the change in the number of times the terminal device is connected within a preset third time range and the weight of the number of connections, determine the fourth change in the priority of basic resources.

[0059] In this embodiment, the connection count weight is a weight set based on the degree of influence of the change in the number of times the terminal device is connected within a preset third time range on the change in the basic resource priority. A higher connection count weight indicates a greater influence of the change in the number of times the terminal device is connected within the preset third time range on the change in the basic resource priority. The preset third time range can be the most recent day or the current day. If the number of times the terminal device is connected increases within the preset third time range, it indicates that the server device consumes more resources, resulting in a lower data transmission capacity, thus requiring a reduction in the basic resource priority. Conversely, if the number of times the terminal device is connected decreases within the preset third time range, it indicates that the server device consumes fewer resources, resulting in a higher data transmission capacity, thus requiring an increase in the basic resource priority.

[0060] S405. Based on the change in transmitted data within a preset second time range, the change in the number of times terminal devices are connected within a preset third time range, and the weight of the number of data connections, determine the fifth change in the priority of basic resources.

[0061] In this embodiment, the data connection count weight is a weight set based on the degree of influence of the change in the amount of data transmitted within a preset second time range and the change in the number of times the terminal device is connected within a preset third time range on the change in the priority of basic resources. If the data connection count weight is higher, it means that the change in the amount of data transmitted within the preset second time range and the change in the number of times the terminal device is connected within the preset third time range have a greater influence on the change in the priority of basic resources.

[0062] The second preset time range is larger than the third preset time range. The second preset time range can be the most recent week, and the third preset time range can be the most recent day or the current day. Taking a second preset time range of the most recent week and a third preset time range of the current day as an example, if the amount of data transmitted in the most recent week remains unchanged or decreases, and the number of connections to the terminal device on the current day increases, it means that the server device will consume resources for device connections. This indicates that the server device's data transmission capacity will increase in the future, so the basic resource priority needs to be increased to allow the server device to focus more on data transmission, thereby reducing resource waste caused by repeated connections to the terminal device. Conversely, if the amount of data transmitted in the most recent week remains unchanged or increases, and the number of connections to the terminal device on the current day decreases, it means that the server device will consume resources for data transmission. This indicates that the server device's data transmission capacity will decrease in the future, so the basic resource priority needs to be decreased to allow data transmission to reselect a transmission path or channel.

[0063] In some embodiments, the data volume weight, connection count weight, and data connection count weight can share a single weight. Specifically, the shared weight of the data volume weight, connection count weight, and data connection count weight can be set to 30%.

[0064] By combining the changes in the amount of data transmitted within a preset second time range and the changes in the number of times the terminal device is connected within a preset third time range, the trend of resource consumption during data transmission by the server device can be determined by integrating different parameters in the long and short term, thereby more accurately determining the change in the priority of basic resources.

[0065] S406. Determine the priority change amount based on the first change amount, the second change amount, the third change amount, the fourth change amount, and the fifth change amount.

[0066] In some embodiments, the first change, the second change, the third change, the fourth change, and the fifth change can all be real numbers with positive or negative signs. If any one of the first change, the second change, the third change, the fourth change, and the fifth change is greater than zero, it indicates that the priority of the basic resource will be increased. If any one of the first change, the second change, the third change, the fourth change, and the fifth change is less than zero, it indicates that the priority of the basic resource will be decreased.

[0067] In this embodiment, the priority change amount in S406 can be determined by the algebraic sum of the first change amount, the second change amount, the third change amount, the fourth change amount, and the fifth change amount.

[0068] In some embodiments, the algebraic sum of the first, second, third, fourth, and fifth changes can be zero, meaning the priority change is zero, indicating that the underlying resource priority will ultimately not change. This implies that the priority change is influenced by multiple parameters or metrics.

[0069] It should be noted that the execution order between S401 and S406 can be set by the user.

[0070] S302. Adjust the priority of basic resources according to the priority change to obtain the priority of server-side resource allocation.

[0071] In this embodiment, the priority change is the change in the basic resource priority. In some embodiments, since the priority change can be a real number with a positive or negative sign, the priority change can be directly added to the basic resource priority to adjust the basic resource priority. The adjusted basic resource priority is called the server-side resource allocation priority. For example, assuming the priority change is -1 and the basic resource priority is 8, the server-side resource allocation priority is 8 + (-1) = 7.

[0072] Figure 5 This diagram illustrates the composition of server-side resource allocation priority according to an embodiment of this application.

[0073] As shown in the figure, the server-side resource allocation priority 500 can be composed of a basic resource priority 510 and a priority change amount 520. The basic resource priority can be determined by the available memory and processor resources of the server-side device. The priority change amount can be determined based on the network status, the change in the number of connected devices within a preset first time range, the change in the amount of data transmitted within a preset second time range, and the change in the number of times terminal devices are connected within a preset third time range. The network status also includes latency.

[0074] S104. Based on the resource allocation priority of the server, reallocate the available resources of the server and the available resources of the client within the terminal device.

[0075] In this embodiment, server-side and client-side available resources can be reallocated within the terminal device based on the priority of server-side resource allocation. Specifically, if the server-side resource allocation priority is low, it indicates that the resources available on the terminal device for server-side use will be more strained. In this case, some of the available server-side resources are reclaimed and allocated to the client device. That is, when the server-side resource allocation priority is low, a portion of the available server-side resources is allocated to the available client-side resources, thereby reducing the terminal device's ability to function as a server-side device. This ensures that subsequent data transmissions will not be handled by this terminal device, but rather by other terminal devices with higher server-side resource allocation priorities. In this embodiment, the reclaimed resources from the available server-side resources can be resources that will not be used in the future for a certain period of time. The high or low priority of server-side resource allocation can be determined based on the server-side resource allocation priority and a pre-set threshold. For example, assuming the pre-set threshold is 5 and the server-side resource allocation priority is 4, then the server-side resource allocation priority is low.

[0076] In some embodiments, the duration for which a terminal device is used as a server device can also be determined based on the server's resource allocation priority. Specifically, if the server's resource allocation priority is relatively low, it indicates that the resources available for the terminal device as a server device will be more strained. Therefore, the time allocating resources for the terminal device as a server device will be reduced, so that when data is subsequently transmitted, it will not be transmitted by the terminal device but will be transmitted through other terminal devices with higher server resource allocation priorities. This reduces the data transmission burden on the terminal device and improves the efficiency of data transmission between multiple terminal devices.

[0077] In some embodiments, the priority of a terminal device for data forwarding as a server device can be determined based on the server's resource allocation priority, resulting in a forwarding priority. The data transmission path among the multiple terminal devices is then determined based on the forwarding priority. In this embodiment, the forwarding priority refers to the priority of a terminal device for data forwarding as a server device. The forwarding priority characterizes the likelihood of data being forwarded through that terminal device; a higher forwarding priority indicates a greater likelihood of data being forwarded through that terminal device. The server's resource allocation priority and the forwarding priority are directly proportional. A higher server resource allocation priority indicates more remaining available resources on the server and less data transmission volume the terminal device will need to perform in the future. Therefore, the priority of the terminal device for data forwarding can be increased. This allows the priority of the terminal device for data forwarding to be determined based on the server's resource availability and data transmission tasks, prioritizing terminal devices with more remaining available resources and less data transmission volume to be used for data forwarding. This improves data transmission efficiency and reduces the pressure on server devices with limited resources and high data transmission volumes.

[0078] In other embodiments, if the server allocates resources with a higher priority, it indicates that the terminal device will have more resources available for use as a server device. In other words, there are more available resources remaining in the available server resources. At this time, some of the available server resources can be reclaimed and allocated to the client device, thereby avoiding unnecessary resource occupation caused by idle resources in the available server resources and improving the overall system resource utilization.

[0079] Figure 6 A flowchart illustrating a resource allocation method for a terminal device according to yet another embodiment of this application is shown.

[0080] In some embodiments, if data transmission is required between two different terminal devices, the terminal device sending the data is referred to as the sender, and the terminal device receiving the data is referred to as the receiver. As shown in the figure, when the sender is preparing to send data, the resource allocation method for the terminal devices may include steps S601 to S6015.

[0081] S601. Determine whether the sender has received the link information from the receiver; if yes, proceed to S602; if no, proceed to S603.

[0082] S602. Determine whether the priority of the server-side resource allocation for the receiving party is too low. If yes, execute S604; otherwise, execute S605.

[0083] S603: The sender requests the link information from the receiver from the public network server center; after S603, S602 is executed.

[0084] S604: Send a request to the public network server center to update the link information; after S604, execute S606.

[0085] S605: The public network server center notifies the recipient to act as the server device and turns on the server device; after S605, S607 is executed.

[0086] S606. Determine whether the receiver is connected to a terminal device other than the sender. If yes, execute S608; otherwise, execute S6011.

[0087] S607. Establish a virtual private network connection between the sender and receiver; and execute S6010, that is, send data to the receiver.

[0088] S608, The sender and receiver are connected to the same terminal device; after S608, S609 is executed.

[0089] S609: The terminal device connected to both the sender and the receiver forwards the data that the sender needs to send and executes S6010, that is, sends the data to the receiver.

[0090] S6010, Send data to the receiver.

[0091] S6011. Determine whether the priority of the server-side resource allocation by the sender is too low. If yes, execute S6012; otherwise, execute S6013.

[0092] S6012: The sender puts the data to be sent into the buffer and returns to execute S601, that is, resends the data to be sent.

[0093] S6013, The sender creates a server device. Following S6013, S6014 is executed.

[0094] S6014, the public network server center sends a connection establishment request to the receiver. After S6014, S6015 is executed.

[0095] S6015, The receiver connects to the server device created by the sender and executes S6010, that is, sends data to the receiver.

[0096] Figure 7 A schematic diagram of the structure of a terminal device according to an embodiment of this application is shown. As shown, in some embodiments, each terminal device M includes a computing processing unit m1, a power management unit m2, a network communication unit m3, a storage unit m4, and an input / output (I / O) unit m5, all of which are interconnected. The computing processing unit m1 may include modules or units for computing, such as a central processing unit (CPU) and a graphics processing unit (GPU). The network communication unit m3 may include units for establishing communication connections with wired or wireless networks. The storage unit m4 may include flash memory and electrically erasable programmable read-only memory (EEPROM). The input / output unit m5 may include external input or output devices and general-purpose input / output (GPIO) units. The power management unit m2 may include a battery and an external power supply.

[0097] In other embodiments, the resource allocation method for terminal devices provided in this application can be applied not only to terminal devices, but also to other devices, terminals or servers.

[0098] Furthermore, if multiple terminal devices want to establish a virtual private network (VPN) connection, they need to transmit their respective terminal device and network-related information to connect and maintain the VPN between different terminal devices. However, existing technologies require the transmission of a large amount of terminal device and network-related information when establishing a VPN connection, which results in the need for more resources when creating or maintaining a VPN connection.

[0099] In this embodiment, a long-term static virtual private network (VPN) channel has been established between the public network server center (Hub) and any terminal device. This means the public network server center (Hub) establishes a fixed, long-term usable VPN link with any terminal device. The link information is essentially the "core configuration and path data" supporting the establishment of the VPN tunnel and terminal interconnection. This static VPN channel serves as the transmission channel for this link information. When a terminal device prepares to access the VPN, it first connects to the public network server center and transmits its device information to the center. This device information serves as the link information. The public network server center summarizes and records the received link information from each terminal device in a dedicated storage table containing the link information of all connected devices. This link information table can be understood as a routing table, recording the connection information between each terminal device. The public network server center pre-stores the link information corresponding to each terminal device.

[0100] In some embodiments, all link information is saved to the public network server center. At the same time, the terminal device can also store, maintain and update the used link information locally. When it is necessary to create a virtual private network connection between two identical terminal devices, the terminal device does not need to request the link information of the other terminal device from the public network server center again. Instead, the public network server center notifies the other terminal device, so that the other terminal device acts as a server device and starts up, thereby reducing the concurrent pressure on the public network server center.

[0101] Figure 8 A schematic diagram illustrating the process of establishing a virtual private network connection according to an embodiment of this application is shown.

[0102] In some embodiments, the first terminal device M1 and the second terminal device M2 are any two different devices from a plurality of terminal devices. As shown in the figure, a virtual private network (VPN) connection can also be established between the terminal devices in the following manner: When the first terminal device M1 wants to establish a VPN channel connection with the second terminal device M2, it first sends a second link information request to the public network server center H. After receiving the connection establishment request from the first terminal device M1, the public network server center H sends the pre-stored link information of the first terminal device M1 to the second terminal device M2, and sends the link information of the second terminal device M2 to the first terminal device M1. After receiving the link information from the first terminal device M1, the second terminal device M2 establishes a server device or server node S. After receiving the link information from the second terminal device M2, the first terminal device M1 establishes a client device Q and sends an M2 connection establishment request to the second terminal device, which carries the link information of the first terminal device M1. After receiving the connection establishment request, the second terminal device M2 will match the link information of the first terminal device M1 carried in the connection establishment request with the link information of the first terminal device M1 sent by the public network server center H. If the two match, the client device Q of the first terminal device M1 will establish a virtual private network connection with the server device S of the second terminal device M2. That is, the client device Q initiates a connection to the server device S, and the server device S establishes a connection with the client device Q. If the two do not match, the first link information request will be sent to the public network server center H again to obtain the link information of the first terminal device M1 again.

[0103] Figure 9 A schematic diagram illustrating the process of establishing a virtual private network connection according to another embodiment of this application is shown.

[0104] In some embodiments, the connection in this application is implemented based on TCP (Transmission Control Protocol), and its encryption process is significantly optimized compared to the existing IPsec (Internet Protocol Security) method. As shown in the figure, the steps performed by the first terminal device include a11 to a14, and the steps performed by the second terminal device include b11 to b14. In this embodiment, the first terminal device first performs a11, that is, sends a message. Next, the first terminal device can perform a12, that is, encapsulates the IPsec message. However, it should be noted that the first terminal device can skip performing a12 and directly perform a13, that is, use a unique encryption key to encrypt the data message using the HMAC (Hash-based Message Authentication Code) algorithm, thereby achieving message encryption. Then, the first terminal device performs a14, that is, sends the encrypted message.

[0105] In this embodiment, the second terminal device first executes b14, that is, after receiving the encrypted message. Then, the second terminal device executes b13, which decrypts the data packet using a unique encryption key and the HMAC algorithm, thus achieving message decryption. Since the first terminal device does not execute a12 in this embodiment, that is, it does not perform IPsec packet encapsulation, the first terminal device also does not need to execute b12 to unpack the IPsec packet, but directly executes b11, that is, it receives the original message.

[0106] In this embodiment, the first terminal device does not need to perform additional encryption steps on the IPsec packets; the dashed lines in the diagram indicate steps that can be omitted. Instead, it directly encrypts the data packets using a unique encryption key and the HMAC (Hash-based Message Authentication Code) algorithm. The second terminal device then decrypts the data using a pre-agreed HMAC algorithm and the unique encryption key. Compared to existing technologies, this embodiment reduces one encryption operation for the first terminal device and one decryption operation for the second terminal device in the entire packet transmission process, thereby effectively reducing system resource consumption. However, since only one encryption and decryption operation is performed, the accuracy of the transmitted packets is slightly reduced. When resources are sufficient, the IPsec method can still be used to ensure packet accuracy.

[0107] In some embodiments, any device among the multiple terminal devices in the third terminal device that is different from both the first and second terminal devices, after the first terminal device establishes a virtual private network (VPN) connection with the second terminal device, will follow the same process as establishing a VPN connection between the third and second terminal devices. After both the first and third terminal devices have established VPN connections with the second terminal device, if the third terminal device sends data to the first terminal device, and the two devices are unaware of each other's link information, the third terminal device can send a request to a public network server center. Upon receiving the request, the public network server center sends the link information of the first terminal device to the third terminal device. After receiving the link information, the third terminal device can determine that both devices have established connections with the second terminal device. Therefore, the second terminal device can act as a data relay station to facilitate data forwarding between the third and first terminal devices. In some embodiments, the third and first terminal devices can be within the same VPN. In other embodiments, a virtual private network connection can also be established between the third terminal device and the first terminal device.

[0108] Figure 10 This diagram illustrates the structure between a public network server center and terminal devices according to an embodiment of this application. As shown, the public network server center H is connected to multiple terminal devices M. The public network server center can verify, store, and transmit link information between different terminal devices, thereby dynamically creating virtual private network (VPN) connections. Long-lived static VPN channels have been established between the public network server center and the multiple terminal devices. That is, the public network server center establishes a fixed, long-term usable VPN link with any terminal device. Long-lived static VPN channels are represented by solid lines, while VPN connections established between different terminal devices are represented by dashed lines. Each terminal device can send or receive link information from other terminal devices.

[0109] In some embodiments, the link information of a terminal device may include the device name, device model, device unique identifier, device public Internet Protocol (IP) address, device public IP port number, device public Internet Protocol Version 6 (IPv6) address, TUN interface IP address, TUN interface IPv6 address, and device unique encryption key. The device name refers to the name of the terminal device, the device model refers to the model of the terminal device, and the device unique identifier refers to the identity identifier corresponding to the terminal device; each terminal device has a unique identifier, and there is only one. The TUN interface refers to the tunnel interface of the virtual private network. It should be noted that if a terminal device has not established a virtual private network connection, then that terminal device is a default value. The device unique encryption key refers to the unique key used for data encryption and decryption. However, as mentioned above, traditional link information contains too much information, making it difficult to create or maintain a virtual private network connection and consuming a lot of resources. In the embodiments of this application, the link information can be trimmed, that is, the parameters are reduced, retaining only the necessary parameters. In this embodiment, the pruned link information only includes the device's unique identifier, device IP address, device public IP port number, TUN interface IP address, and device unique encryption key. This link information can still be used to establish a virtual private network (VPN) connection, reducing the number of parameters and the burden of establishing the VPN connection. However, for the sake of completeness, the pruned parameters can be added back to the link information.

[0110] Table 1 presents the link information in this embodiment in detail. For detailed information on the link information, please refer to Table 1.

[0111] Table 1

[0112] Figure 11 A schematic diagram of a resource allocation device for a terminal device according to an embodiment of this application is shown. As shown, the resource allocation device 700 of the terminal device may include a first determining module 710, a second determining module 720, an adjusting module 730, and an allocation module 740.

[0113] The first determining module 710 is used to determine the remaining available resources among the available resources of the server, and obtain the remaining available resources of the server.

[0114] The second determining module 720 is used to determine the priority of the terminal device as the basic resource of the server device based on the remaining available resources of the server.

[0115] The adjustment module 730 is used to adjust the basic resource priority based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and a preset weight, so as to obtain the server allocation resource priority of the terminal device as the server device.

[0116] The allocation module 740 is used to reallocate the available resources of the server and the available resources of the client within the terminal device according to the resource allocation priority of the server.

[0117] In some embodiments, the second determining module 720 is further configured to: The remaining service capacity that the terminal device can handle when used as a server device is determined based on the remaining memory resources, the remaining computing resources of the processor, and the remaining transmission bandwidth for data transmission. The priority of the basic resources is determined based on the remaining available service capacity.

[0118] In some embodiments, the adjustment module 730 is further configured to: Based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and a preset weight, the priority change corresponding to the basic resource priority is determined. The priority of the basic resources is adjusted according to the priority change to obtain the priority of the server-side allocated resources.

[0119] In some embodiments, the preset weights include network status weights, device quantity change weights, data quantity weights, connection count weights, and data connection count weights. The adjustment module 730 is further configured to: Based on the network status of the terminal device and the network status weight, a first change in the priority of the basic resources is determined; Based on the change in the number of connected devices within a preset first time range of the terminal device and the weight of the change in the number of devices, a second change in the priority of the basic resources is determined; Based on the amount of change in transmitted data within the preset second time range and the data volume weight, a third change in the priority of the basic resources is determined; Based on the change in the number of times the terminal device is connected within the preset third time range and the weight of the number of connections, a fourth change in the priority of the basic resources is determined; Based on the change in transmitted data within the preset second time range, the change in the number of times the terminal device is connected within the preset third time range, and the weight of the number of data connections, a fifth change in the priority of the basic resources is determined. The priority change amount is determined based on the first change amount, the second change amount, the third change amount, the fourth change amount, and the fifth change amount.

[0120] In some embodiments, establishing a virtual private network (VPN) connection between at least two terminal devices includes establishing a VPN connection through the link information of each terminal device, wherein the link information of the terminal device includes: the device identifier of the terminal device, the public IP address of the terminal device, the public IP port number of the terminal device, the VPN interface address of the terminal device, and the unique encryption key of the terminal device.

[0121] In some embodiments, the resource allocation device 700 can also be used for: The duration for which the terminal device is used as a server device is determined based on the resource allocation priority of the server.

[0122] In some embodiments, the resource allocation device 700 can also be used for: Based on the resource allocation priority of the server, the priority of the terminal device for data forwarding as a server device is determined, and the forwarding priority is obtained; Based on the forwarding priority, the data transmission path among the multiple terminal devices is determined.

[0123] Figure 12 A schematic diagram of the hardware structure of the resource allocation device of the terminal device provided in the embodiment of this application is shown.

[0124] The resource allocation device in the terminal device may include a processor 801 and a memory 802 storing computer program instructions.

[0125] Specifically, the processor 801 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of the present invention.

[0126] Memory 802 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Thus, generally, memory includes one or more tangible (non-transitory) computer storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this disclosure.

[0127] The processor 801 reads and executes computer program instructions stored in the memory 802 to achieve... Figure 1 Resource allocation method for terminal devices in the illustrated embodiment.

[0128] In one example, the resource allocation device of the terminal device may further include a communication interface 803 and a bus 804. As shown in the figure, the processor 801, memory 802, and communication interface 803 are connected through the bus 804 and complete communication with each other.

[0129] The communication interface 803 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of the present invention.

[0130] Bus 804 includes hardware, software, or both, that couples components of an online data traffic metering device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 804 may include one or more buses. While specific buses are described and illustrated in embodiments of the invention, the invention contemplates any suitable bus or interconnect.

[0131] The resource allocation device of this terminal device can execute the online data traffic billing method in this embodiment of the invention based on currently blocked spam SMS messages and SMS messages reported by users, thereby achieving a combination of... Figure 1 and Figure 2 The method described for xx.

[0132] Furthermore, in conjunction with the resource allocation method for terminal devices in the above embodiments, this invention can be implemented using a computer storage medium. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the resource allocation methods for terminal devices described in the above embodiments.

[0133] This application also provides a computer program product, including a computer program that, when executed by a processor, implements any of the resource allocation methods for terminal devices described in the above embodiments.

[0134] It should be clarified that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of the present invention.

[0135] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this invention are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0136] It should also be noted that the exemplary embodiments mentioned in this invention describe methods or systems based on a series of steps or apparatus. However, this invention is not limited to the order of the steps described above; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0137] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0138] The above description is merely a specific embodiment of the present invention. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the protection scope of the present invention.

Claims

1. A resource allocation method for a terminal device, characterized in that, Applied to the terminal device, which acts as a server device in a virtual private network to forward data, the available resources of the terminal device include server-side available resources used as a server device and client-side available resources used as a client device, the method includes: Determine the remaining available resources among the available server resources to obtain the remaining available server resources; Based on the remaining available resources on the server, the priority of the terminal device as the basic resource of the server device is determined; Based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and a preset weight, the basic resource priority is adjusted to obtain the server-side resource allocation priority of the terminal device used as the server-side device. Based on the resource allocation priority of the server, the available resources of the server and the available resources of the client are reallocated within the terminal device.

2. The resource allocation method for terminal devices according to claim 1, characterized in that, The remaining available resources on the server side include the remaining memory resources of the terminal device used as the server device, the remaining computing resources of the processor, and the remaining transmission bandwidth used for data transmission; The step of determining the priority of the terminal device as a basic resource for the server device based on the remaining available resources of the server includes: The remaining service capacity that the terminal device can handle when used as a server device is determined based on the remaining memory resources, the remaining computing resources of the processor, and the remaining transmission bandwidth for data transmission. The priority of the basic resources is determined based on the remaining available service capacity.

3. The resource allocation method for terminal devices according to claim 1 or 2, characterized in that, The step of adjusting the basic resource priority based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and a preset weight, to obtain the server-side resource allocation priority for the terminal device used as the server device, includes: Based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and a preset weight, the priority change corresponding to the basic resource priority is determined. The priority of the basic resources is adjusted according to the priority change to obtain the priority of the server-side allocated resources.

4. The resource allocation method for terminal devices according to claim 3, characterized in that, The preset weights include network status weight, device quantity change weight, data quantity weight, connection count weight, and data connection count weight. The step of determining the priority change corresponding to the basic resource priority based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in transmitted data within a preset second time range, the change in the number of connections to the terminal device within a preset third time range, and the preset weights includes: Based on the network status of the terminal device and the network status weight, a first change in the priority of the basic resources is determined; Based on the change in the number of connected devices within a preset first time range of the terminal device and the weight of the change in the number of devices, a second change in the priority of the basic resources is determined; Based on the amount of change in transmitted data within the preset second time range and the data volume weight, a third change in the priority of the basic resources is determined; Based on the change in the number of times the terminal device is connected within the preset third time range and the weight of the number of connections, a fourth change in the priority of the basic resources is determined; Based on the change in transmitted data within the preset second time range, the change in the number of times the terminal device is connected within the preset third time range, and the weight of the number of data connections, a fifth change in the priority of the basic resources is determined. The priority change amount is determined based on the first change amount, the second change amount, the third change amount, the fourth change amount, and the fifth change amount.

5. The resource allocation method for terminal devices according to claim 1, characterized in that, The method of establishing a virtual private network connection between at least two terminal devices includes establishing a virtual private network connection through the link information of each terminal device, wherein the link information of the terminal device includes: the device identifier of the terminal device, the public IP address of the terminal device, the public IP port number of the terminal device, the virtual private network interface address of the terminal device, and the unique encryption key of the terminal device.

6. The resource allocation method for terminal devices according to claim 1, characterized in that, The method further includes: The duration for which the terminal device is used as a server device is determined based on the resource allocation priority of the server.

7. The resource allocation method for terminal devices according to claim 1, characterized in that, The method further includes: Based on the resource allocation priority of the server, the priority of the terminal device for data forwarding as a server device is determined, and the forwarding priority is obtained; Based on the forwarding priority, the data transmission path among the multiple terminal devices is determined.

8. A resource allocation device for a terminal device, characterized in that, The terminal device is used as a server device in a virtual private network to forward data. The available resources of the terminal device include server-side available resources used as a server device and client-side available resources used as a client device. The apparatus includes: The first determining module is used to determine the remaining available resources among the available resources on the server side, and obtain the remaining available resources on the server side. The second determining module is used to determine the priority of the terminal device as the basic resource of the server device based on the remaining available resources of the server. The adjustment module is used to adjust the basic resource priority based on the network status of the terminal device, the change in the number of connected devices within a preset first time range, the change in the amount of transmitted data within a preset second time range, the change in the number of times the terminal device is connected within a preset third time range, and a preset weight, so as to obtain the server allocation resource priority of the terminal device used as the server device. The allocation module is used to reallocate the available resources of the server and the available resources of the client within the terminal device according to the resource allocation priority of the server.

9. A resource allocation device for a terminal device, characterized in that, The device includes: a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the resource allocation method of the terminal device as described in any one of claims 1-7.

10. A computer storage medium, characterized in that, The computer storage medium stores computer program instructions, which, when executed by a processor, implement the resource allocation method for the terminal device as described in any one of claims 1-7.

11. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the resource allocation method for the terminal device as described in any one of claims 1-7.