Resource allocation method, terminal, server and storage medium

文档序号:955611 发布日期:2020-10-30 浏览:6次 中文

阅读说明:本技术 一种资源分配的方法、终端、服务器及存储介质 (Resource allocation method, terminal, server and storage medium ) 是由 涂晓强 于 2020-07-23 设计创作,主要内容包括:本发明实施例涉及计算机技术领域,公开了一种资源分配的方法、终端、服务器及存储介质。本发明中资源分配的方法,应用于第一终端,包括:获取第二终端生成加密数据的第一时长;根据第一时长,确定第二终端待获得的资源数值,以供第一终端和第二终端所在资源网络根据资源数值为第二终端分配资源。使得可以更加合理的为第二终端分配资源。(The embodiment of the invention relates to the technical field of computers, and discloses a resource allocation method, a terminal, a server and a storage medium. The resource allocation method in the invention is applied to a first terminal and comprises the following steps: acquiring a first time length for generating encrypted data by a second terminal; and determining a resource value to be obtained by the second terminal according to the first duration, so that the resource network where the first terminal and the second terminal are located can distribute resources for the second terminal according to the resource value. So that the resources can be more reasonably allocated to the second terminal.)

1. A method for resource allocation, applied to a first terminal, includes:

acquiring a first time length for generating encrypted data by a second terminal;

and dynamically determining a resource value to be obtained by the second terminal according to the first duration, so that the resource network where the first terminal and the second terminal are located can allocate resources to the second terminal according to the resource value.

2. The method of claim 1, wherein the determining the value of the resource to be obtained by the second terminal according to the first duration comprises:

acquiring standard time length for generating encrypted data;

determining a resource value to be obtained by the second terminal according to the first duration, the standard duration and a preset resource allocation strategy, wherein the resource allocation strategy comprises: and the expectation of the resource values corresponding to the plurality of first time lengths is matched with the resource values corresponding to the standard time lengths.

3. The method of claim 2, wherein the resource allocation policy further comprises: and in a preset range of the resource value, the resource value to be obtained by the second terminal is increased along with the increase of the first time length.

4. The method according to any of claims 1 to 3, wherein before dynamically determining the value of the resource to be obtained by the second terminal according to the first duration, the method further comprises:

and verifying whether the encrypted data generated by the second terminal is legal or not, and if the encrypted data is legal, determining to execute the step of dynamically determining the resource value to be obtained by the second terminal according to the first duration.

5. A method for resource allocation according to claim 2 or 3, wherein said resource allocation policy is expressed as:

R(t)=N*2/(1+e-(t-T)) Wherein, R represents a resource value to be obtained by the second terminal, N represents a standard resource value, T represents a first duration, and T represents the standard duration.

6. A method for resource allocation is applied to a resource network where a first terminal and a second terminal are located, and the method comprises the following steps:

acquiring a resource value to be acquired by the second terminal, wherein the resource value is determined by the first terminal according to a first time length of encrypted data generated by the second terminal;

and allocating resources to the second terminal according to the resource value.

7. The method of claim 6, wherein the number of the first terminals is at least 2;

the allocating resources to the second terminal according to the resource value includes:

after receiving the resource value determined by each first terminal, allocating resources to the second terminal according to any one determined resource value; or determining an average value corresponding to all uploaded resource values, and distributing resources to the second end according to the average value.

8. A terminal, comprising:

at least one processor; and the number of the first and second groups,

a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,

the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of resource allocation according to any one of claims 1 to 5.

9. A server, comprising:

at least one processor; and the number of the first and second groups,

a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,

the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of resource allocation according to any one of claims 6 to 7.

10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method for resource allocation according to any one of claims 1 to 5, or carries out the method for resource allocation according to any one of claims 6 to 7.

Technical Field

The embodiment of the invention relates to the technical field of computers, in particular to a resource allocation method, a terminal, a server and a storage medium.

Background

At present, in the process of allocating resources, a terminal which satisfies a condition first is allocated with a resource of a fixed value first, that is, the terminal which reaches a preset condition sooner obtains the resource first, and the more times that the terminal with high computing power reaches the preset condition within the same time, the more the obtained resource is, wherein the preset condition can be set according to actual needs. For example, the preset condition may be that the encrypted hash value is smaller than a preset value.

The inventors found that at least the following problems exist in the related art: in order to quickly reach the preset condition, the terminal is required to have better comprehensive capability, the resources to be allocated are limited, and accordingly the comprehensive capability of the terminal is improved, the preset condition is more and more rigorous, and the vicious circle that the comprehensive capability of the terminal is continuously improved is caused; the comprehensive capability is continuously improved, the price of the terminal is more and more expensive, the power demand is higher and higher, and the resource is greatly wasted.

Disclosure of Invention

An object of embodiments of the present invention is to provide a method, a terminal, a server, and a storage medium for resource allocation, so that resources can be allocated to a second terminal more reasonably.

In order to solve the above technical problem, an embodiment of the present invention provides a method for resource allocation, which is applied to a first terminal, and includes: acquiring a first time length for generating encrypted data by a second terminal; and dynamically determining a resource value to be obtained by the second terminal according to the first time length so that the resource network where the first terminal and the second terminal are located can distribute resources for the second terminal according to the resource value.

The embodiment of the invention also provides a resource allocation method, which comprises the following steps: the method is applied to the resource network where the first terminal and the second terminal are located, and comprises the following steps: acquiring a resource value to be acquired by a second terminal, wherein the resource value is determined by a first terminal according to a first time length of encrypted data generated by the second terminal; and allocating resources for the second terminal according to the resource value.

An embodiment of the present invention further provides a terminal, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of resource allocation applied to the first terminal.

An embodiment of the present invention further provides a server, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a method of resource allocation applied to a network of resources.

Embodiments of the present invention also provide a computer-readable storage medium storing a computer program which, when executed by a processor, implements a method of resource allocation applied to a first terminal or implements a method of resource allocation applied to a resource network.

Compared with the prior art, the method and the device for acquiring the encrypted data have the advantages that the first time length for the second terminal to generate the encrypted data is acquired, and the resource value to be acquired by the second terminal is dynamically determined according to the first time length, so that the resource network allocates resources for the second terminal according to the determined resource value; the resource value to be obtained by the second terminal is dynamically determined by the first terminal according to the first time length, rather than the resource with a fixed value is distributed to the second terminal after the encrypted data is generated by the second terminal, so that the resource obtained by the second terminal after the encrypted data is generated is uncertain, namely even if the second terminal improves the comprehensive capacity, compared with other terminals, the encrypted data can be generated for multiple times in the same time, but the resource obtained after the encrypted data is generated every time is not fixed, so that the resource distributed by the second terminal is uncertain, the power of a user for improving the comprehensive capacity of the terminal is reduced, the unnecessary computing resource consumed by the terminal is reduced, and meanwhile, the continuous consumption of electric power is also reduced.

In addition, determining the resource value to be obtained by the second terminal according to the first time length includes: acquiring standard time length for generating encrypted data; determining a resource value to be obtained by the second terminal according to the first duration, the standard duration and a preset resource allocation strategy, wherein the resource allocation strategy comprises the following steps: the expectation of the resource values corresponding to the plurality of first time lengths is matched with the resource values corresponding to the standard time length. The resource allocation strategy is adopted, and the expectation of the resource values corresponding to the first time lengths is matched with the resource values corresponding to the standard time lengths, so that the total resource values are ensured to be unchanged.

In addition, the resource allocation policy further includes: and in the preset range of the resource value, the resource value to be obtained by the second terminal is increased along with the increase of the first time length. Limiting the range of the resource value, so that the resource value to be obtained by the second terminal is not infinitely increased along with the increase of the first duration, thereby ensuring that enough resources are allocated; meanwhile, as the value of the resource to be obtained by the second terminal is increased along with the increase of the first time, the resource obtained by the terminal which generates the encrypted data most quickly is reduced, so that the power of a user for improving the computing capability of the terminal is further reduced, and the problem of wasting computing resources and electric power resources is avoided.

In addition, before dynamically determining the resource value to be obtained by the second terminal according to the first duration, the method further includes: verifying the encrypted data generated by the second terminal; and if the encrypted data is determined to be legal, determining to execute a step of dynamically determining a resource value to be obtained by the second terminal according to the first duration. And dynamically determining the resource value to be obtained by the second terminal under the condition that the encrypted data is legal, so that unnecessary resource waste can be reduced.

In addition, the resource allocation policy is expressed as: r (t) ═ N/(1 + e)-(t-T)) Wherein, R represents a resource value to be obtained by the second terminal, N represents a standard resource value, T represents a first duration, and T represents a standard duration. Specific implementation of the resource allocation strategy.

Drawings

One or more embodiments are illustrated by way of example in the accompanying drawings, which correspond to the figures in which like reference numerals refer to similar elements and which are not to scale unless otherwise specified.

Fig. 1 is a flowchart of a method for resource allocation according to a first embodiment of the present invention;

FIG. 2 is a graphical illustration of an expression of a resource allocation policy provided in accordance with a first embodiment of the present invention;

FIG. 3 is a flowchart of a method for resource allocation according to a second embodiment of the present invention;

fig. 4 is a schematic diagram of a resource network provided according to a second embodiment of the present invention;

FIG. 5 is a flowchart of a method for resource allocation according to a third embodiment of the present invention;

FIG. 6 is a flowchart of a method for resource allocation according to a fourth embodiment of the present invention;

fig. 7 is a block diagram illustrating a structure of a terminal according to a fifth embodiment of the present invention;

fig. 8 is a block diagram of a server according to a sixth embodiment of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that numerous technical details are set forth in order to provide a better understanding of the present application in various embodiments of the present invention. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments.

The following embodiments are divided for convenience of description, and should not constitute any limitation to the specific implementation manner of the present invention, and the embodiments may be mutually incorporated and referred to without contradiction.

The inventor finds that in the current resource network, when allocating resources, the terminal allocates resources for the terminal that meets the resource allocation condition according to a fixed resource value as long as the terminal meets the resource allocation condition. For example, in allocating memory resources, generally, the more terminals occupy computing resources, the more memory resources are allocated, which results in that a user increases the operation speed to preempt more memory resources, and other terminals with poor operation speed may not allocate any resources. For another example, in the block chain, the terminal generating the block fastest obtains the resource first; since the terminal that generates the block the fastest obtains the resources first, that is, the faster the block generation speed is in the same time period, the more resources are obtained, which results in that the user continuously updates the computing power of the terminal to increase the block generation speed, and the resources with high computing power consume a large amount of power resources.

A first embodiment of the present invention relates to a method of resource allocation. The method for resource allocation is applied to the first terminal, and a specific flow of the method for resource allocation is shown in fig. 1.

Step 101: and acquiring a first time length for generating the encrypted data by the second terminal.

Specifically, the resource types to be allocated may be transmission resources, storage resources, computing resources, revenue resources, and the like of the resource network. The resource network can be a cloud network and can also be a block chain network. The first terminal and the second terminal may be computer devices, ASIC devices, FPGA devices, servers, etc. The terminal in the resource network that generates the encrypted data is taken as the second terminal, and the terminal that acquires the first duration is taken as the first terminal, that is, the first terminal and the second terminal are opposite, and the identities of the first terminal and the second terminal change with the respective operations.

Since the resources to be allocated are limited, in order to ensure that the operation of each terminal is honest and trusted, the second terminal may encrypt each operation or data to generate encrypted data, thereby securing the entire resource network.

A blockchain network is employed in this example. Block chain (block chain): the method is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. The blockchain is essentially a decentralized database, which is a string of data blocks associated by cryptography, each data block containing information about a network transaction for verifying the validity (anti-counterfeiting) of the information and generating the next block, each block containing a timestamp and a link to the previous block. In a narrow sense, a blockchain is a distributed ledger of data blocks assembled in a sequential manner into a chain data structure in chronological order and cryptographically secured as non-falsifiable and non-forgeable, i.e. the data in the blockchain will be irreversible once recorded.

With the continuous penetration of the concept of decentralization, the blockchain technology is also applied in many scenarios to improve the security of the whole network. The current process of allocating resources by using a block chain is as follows: after a certain amount of transaction data of the whole network are collected by one node in the block chain, the collected transactions are packaged, wherein the space occupied by one piece of transaction data is less than 1KB, and the capacity of one packet is not more than 1MB, namely, one packet can contain about 1 thousand pieces of transaction data. Adding a certain head structure and a random number into a packet, then carrying out hash calculation on the packet, if the hash result meets a preset condition, carrying out whole-network broadcasting on the packet meeting the preset condition by the node, wherein the broadcasted packet is a block. The other nodes will verify the block after receiving the broadcast. When the node number of the block is recognized to be larger than the node number of the preset proportion, the blockchain network allocates resources with fixed values for the nodes generating the block.

For example, if the hash result required to be calculated in the block chain is smaller than a preset value of 32 bytes, if the obtained hash value is greater than or equal to the preset value, a new random number is generated, and then the hash is calculated again; for example, block 504282, its hash value is 0x00000000000000000035e78d50034f5264c2d71524effdc6dd27d7ce6d907a9 f. That is, the first 9 bytes are all required to be 0 to meet the requirement, and the rough estimation has the requirement of each attemptThe probability is very low, so a large number of calculations are required to generate the encrypted data.

In this example, the encrypted data generated by the second terminal is a block in the blockchain network, the second terminal performs a full-network broadcast on the encrypted data after generating the encrypted data, and the first terminal acquires the encrypted data and may determine a first duration for generating the encrypted data by the second terminal according to the time for acquiring the encrypted data and the time for acquiring the encrypted data last time. It will be appreciated that the first duration may also be transmitted to the first terminal when the second terminal broadcasts.

Step 102: and dynamically determining a resource value to be obtained by the second terminal according to the first time length so that the resource network where the first terminal and the second terminal are located can distribute resources for the second terminal according to the resource value.

In one example, a standard time length for generating the encrypted data is obtained; determining a resource value to be obtained by the second terminal according to the first duration, the standard duration and a preset resource allocation strategy, wherein the resource allocation strategy comprises the following steps: the expectation of the resource values corresponding to the plurality of first time lengths is matched with the resource values corresponding to the standard time length.

Specifically, a standard time length for generating the encrypted data is preset in the resource network, for example, in the block chain network, an interval time length T generated by each block may be set, where T is a preset standard time length. The resource network can also preset a resource allocation strategy, wherein the resource allocation strategy is determined based on the constraint condition that the total resources are not changed, for example, it is assumed that encrypted data is generated for P times, the total resource value is P × N, and N is a fixed resource value allocated to a terminal which generates the encrypted data each time; by adopting the method in this example, the resource value corresponding to each first time length is not fixed, and the total resource value can be ensured to be unchanged by using a mathematical expectation method, that is, the expectation of the resource values corresponding to at least two time lengths for generating the encrypted data is equal to the resource value corresponding to the standard time length.

The first terminal may obtain the standard duration and a preset resource allocation policy from a resource network, and dynamically determine a resource value to be obtained by the second terminal according to the resource allocation policy.

In one example, the resource allocation policy further comprises: within the preset range of the resource value, the resource value to be obtained by the second terminal increases with the increase of the first time length.

Specifically, the preset resource allocation strategy can also meet the condition that the resource value to be obtained by the second terminal increases along with the increase of the first time length within the preset range of the resource value under the condition that the expectation of the resource values corresponding to the plurality of first time lengths is matched with the resource value corresponding to the standard time length. Of resource valuesThe preset range should be smaller than the value of the total resource, and the preset range of the resource value may be set as needed, for example, if the resource value corresponding to the standard duration is N, the maximum value of the preset range of the resource value may be 2N; the minimum value of the preset range of the resource values may be 0; namely, the preset range of the resource value is as follows: [0,2N ]]. Within the preset range of the resource value, as the first duration increases, the resource value to be obtained by the second terminal also increases. For example, the resource allocation policy may be expressed as: r (t) ═ N/(1 + e)-(t-T)) Wherein, R represents a resource value to be obtained by the second terminal, N represents a standard resource value, T represents a first duration, and T represents a standard duration.

The schematic diagram of the expression of the resource allocation policy is shown in fig. 2, where r (t) represents a resource value, and N is a standard resource value, that is, a resource value corresponding to a standard time length. By adopting the expression mode R (T), when the duration of T is greater than T, the resource value to be obtained by the second terminal increases with the increase of T, and meanwhile, as can be seen from FIG. 2, because the probabilities of being less than and more than N are the same, that is, the probabilities of the resource values corresponding to the first duration being less than T or greater than T are the same, the probabilities of the resource values corresponding to the first duration increasing and decreasing are mutually offset, and the constraint condition that the expectation of the resource values corresponding to a plurality of first durations is matched with the resource value corresponding to the standard duration is satisfied. When t is infinite, the corresponding resource value is infinitely close to 2N, so that when the first time length is infinite, the resource value corresponding to the first time length is not infinite; thereby ensuring that the resources allocated to each second terminal are within a reasonable range.

It is worth mentioning that the range of the resource value is limited, so that the resource value to be obtained by the second terminal is not infinitely increased along with the increase of the first duration, thereby ensuring that enough resources are allocated; meanwhile, as the value of the resource to be obtained by the second terminal is increased along with the increase of the first time, the resource obtained by the terminal which generates the encrypted data most quickly is reduced, so that the power of a user for improving the computing capability of the terminal is further reduced, and the problem of wasting computing resources and electric power resources is avoided.

The first terminal uploads the determined resource value to the resource network, and the resource network can allocate corresponding resources to the second terminal according to the acquired resource value.

It is understood that there may be a plurality of first terminals, each of the first terminals uploads the determined resource value to the resource network, and the resource network may select one resource value from the received plurality of resource values and allocate resources to the second terminal according to the selected resource value.

Compared with the prior art, the method and the device for acquiring the encrypted data have the advantages that the first time length for the second terminal to generate the encrypted data is acquired, and the resource value to be acquired by the second terminal is dynamically determined according to the first time length, so that the resource network allocates resources for the second terminal according to the determined resource value; the resource value to be obtained by the second terminal is dynamically determined by the first terminal according to the first time length, rather than the resource with a fixed value is distributed to the second terminal after the encrypted data is generated by the second terminal, so that the resource obtained by the second terminal after the encrypted data is generated is uncertain, namely even if the second terminal improves the comprehensive capacity, compared with other terminals, the encrypted data can be generated for multiple times in the same time, but the resource obtained after the encrypted data is generated every time is not fixed, so that the resource distributed by the second terminal is uncertain, the power of a user for improving the comprehensive capacity of the terminal is reduced, the unnecessary computing resource consumed by the terminal is reduced, and meanwhile, the continuous consumption of electric power is also reduced.

A second embodiment of the present invention relates to a method of resource allocation. The second embodiment is a further improvement of the first embodiment, and the main improvements are as follows: in the second embodiment of the present invention, before dynamically determining the resource value to be obtained by the second terminal according to the first duration, the encrypted data generated by the second terminal is verified. The specific flow of the resource allocation method is shown in fig. 3.

Step 201: and acquiring a first time length for generating the encrypted data by the second terminal.

This step is substantially the same as step 101 in the first embodiment, and will not be described herein.

Step 202: and verifying whether the encrypted data generated by the second terminal is legal or not, if so, executing the step 203, and otherwise, ending the whole process.

Specifically, for the legitimacy of resource allocation, the first terminal may perform legitimacy verification on the encrypted data, and the verification methods may be various, and may detect whether the encrypted data conforms to an encryption rule preset by the resource network, for example: in the block chain, a first terminal detects whether a received block meets a preset block rule in the block chain; and if the received block meets the preset block rule, determining that the received block is a legal block. If the encrypted data is determined to be legal, executing step 203, and if the encrypted data is determined to be illegal, directly ending the whole process by the first terminal; the first terminal may also broadcast information that the encrypted data is illegal encrypted data before ending the procedure.

Step 203: and dynamically determining the resource value to be obtained by the second terminal according to the first time length.

This step is substantially the same as step 102 in the first embodiment, and will not be described herein.

It should be noted that, if the number of the first terminals is multiple, the time for each first terminal to acquire the encrypted data broadcast by the second terminal may be different, so that the first time duration acquired by each first terminal is different, the determined resource values to be acquired by the second terminal are also different, and in order to ensure the accuracy of allocating resources to the second terminal, the resource network may calculate an average value of all uploaded resource values, and allocate resources to the second terminal according to the average value. For example, as shown in fig. 4, the resource network includes a second terminal and N +2 first terminals, and the first terminal 1 determines that the resource value R1 of the second terminal is N × 2/(1+ e)-(t1-T)) Where t1 is the first duration determined by the first terminal 1. The first terminal 2 determines the resource value R2 of the second terminal as N × 2/(1+ e)-(t2-T)) If n first terminals verify that the encrypted data are legal data, uploading respective resource values to a resource network, verifying that the encrypted data are illegal data by the first terminals n +1 and n +2, and verifying that the number of the legal first terminals exceeds the number of the legal first terminalsIn half proportion, the resource network determines to allocate resources to the second terminal, and determines that the value of the obtained resources of the second terminal is R ═ R1+ R2+ … + Rn)/n; and the resource network allocates resources for the second terminal according to the R.

In the resource allocation method provided by this embodiment, before determining the resource value to be obtained by the second terminal, the encrypted data generated by the second terminal is verified, and if the encrypted data is illegal, the resource value to be obtained by the second terminal is not determined any more, which reduces unnecessary resource waste of the first terminal, improves the legitimacy of resource allocation, and improves the utilization rate of resources.

The steps of the above methods are divided for clarity, and the implementation may be combined into one step or split some steps, and the steps are divided into multiple steps, so long as the same logical relationship is included, which are all within the protection scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.

A third embodiment of the present invention relates to a resource allocation method, which is applied to a resource network in which a first terminal and a second terminal are located, and a specific flow is shown in fig. 5.

Step 301: and acquiring a resource value to be acquired by the second terminal, wherein the resource value is determined by the first terminal according to the first time length of the encrypted data generated by the second terminal.

Specifically, the resource network includes: a first terminal and a second terminal; the first terminal and the second terminal may be computer devices, ASIC devices, FPGA devices, etc. The terminal in the resource network that generates the encrypted data is taken as the second terminal, and the terminal that acquires the first duration is taken as the first terminal, that is, the first terminal and the second terminal are opposite, and the identities of the first terminal and the second terminal change with the respective operations.

Since the resources to be allocated are limited, in order to ensure that the operation of each terminal is honest and trusted, the second terminal may encrypt each operation or data to generate encrypted data, so as to ensure the security of the whole resource network, in this example, a block chain network is used.

The encrypted data generated by the second terminal is a block in the block chain network, the second terminal performs whole network broadcasting on the encrypted data after generating the encrypted data, and the first terminal acquires the encrypted data and can determine the first time length for generating the encrypted data by the second terminal according to the time for acquiring the encrypted data and the time for acquiring the encrypted data last time. It will be appreciated that the first duration may also be transmitted to the first terminal when the second terminal broadcasts. And the first terminal determines the resource value to be obtained by the second terminal according to the first duration. The first terminal can upload the determined resource value to a resource network, and the resource network can receive the resource value uploaded by the first terminal; the resource network may also actively obtain the resource value determined by the first terminal.

Step 302: and allocating resources for the second terminal according to the resource value.

In one example, after receiving the resource values determined by each first terminal, the second terminal is allocated resources according to any one of the determined resource values

Specifically, the number of the first terminals may be multiple, each first terminal uploads the determined resource value to the resource network, and the resource network may select one resource value from the received multiple resource values and allocate resources to the second terminal according to the selected resource value.

It should be understood that this embodiment is an example of a resource network corresponding to the first embodiment, and may be implemented in cooperation with the first embodiment. The related technical details mentioned in the first embodiment are still valid in this embodiment, and are not described herein again in order to reduce repetition. Accordingly, the related-art details mentioned in the present embodiment can also be applied to the first embodiment.

The fourth embodiment of the invention relates to a resource allocation method. The fourth embodiment is substantially the same as the third embodiment, and mainly differs therefrom in that: in this embodiment, the process of allocating resources to the second terminal is different according to the resource value. The specific flow of the resource allocation method is shown in fig. 6.

Step 401: and acquiring a resource numerical value to be acquired by the second terminal.

This step is substantially the same as 301 in the third embodiment, and will not be described again here.

Step 402: and determining the average value corresponding to all uploaded resource values.

Specifically, if the number of the first terminals is at least two, the time for each first terminal to acquire the encrypted data broadcast by the second terminal may be different, so that the first time length acquired by each first terminal is different, the determined resource values to be acquired by the second terminal are also different, and in order to ensure the accuracy of resource allocation for the second terminal, the resource network may calculate an average value of all uploaded resource values, and allocate resources to the second terminal according to the average value. For example, in a resource network comprising a second terminal and N +2 first terminals, first terminal 1 determines that the resource value R1 of the second terminal is N × 2/(1+ e)-(t1-T)) Where t1 is the first duration determined by the first terminal 1. The first terminal 2 determines the resource value R2 of the second terminal as N × 2/(1+ e)-(t2-T)) If n first terminals verify that the encrypted data is legal data, uploading respective resource values to a resource network, verifying that the encrypted data is illegal data by the first terminal n +1 and the first terminal n +2, determining that the number of the legal first terminals exceeds a half ratio, determining that the resource network allocates resources to the second terminal, and determining that the resource value obtained by the second terminal is R (R1+ R2+ … + Rn)/n.

Step 403: and allocating resources for the second terminal according to the average value.

Since the second embodiment corresponds to the present embodiment, the present embodiment can be implemented in cooperation with the second embodiment. The related technical details mentioned in the second embodiment are still valid in this embodiment, and the technical effects that can be achieved in the second embodiment can also be achieved in this embodiment, and are not described herein again in order to reduce the repetition. Accordingly, the related-art details mentioned in the present embodiment can also be applied to the second embodiment.

A fifth embodiment of the present invention relates to a terminal 50, a block diagram of which is shown in fig. 7, including: at least one processor 501; and a memory 502 communicatively coupled to the at least one processor 501; wherein the content of the first and second substances,

the memory 502 stores instructions executable by the at least one processor 501, the instructions being executable by the at least one processor 501 to enable the at least one processor 501 to perform the method of resource allocation of the first embodiment or the second embodiment.

A sixth embodiment of the present invention relates to a server, and a block diagram of a configuration of a server 60 is shown in fig. 8, and includes: at least one processor 601; and a memory 602 communicatively coupled to the at least one processor 601; the memory 602 stores instructions executable by the at least one processor 601, and the instructions are executed by the at least one processor 601 to enable the at least one processor 601 to execute the method for resource allocation in the third embodiment or the fourth embodiment.

The memory and the processor in the fifth or sixth embodiment are connected by a bus, which may comprise any number of interconnected buses and bridges, linking together various circuits of one or more processors and memory. The bus may also link various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor is transmitted over a wireless medium via an antenna, which further receives the data and transmits the data to the processor.

The processor is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And the memory may be used to store data used by the processor in performing operations.

A seventh embodiment of the present invention relates to a computer-readable storage medium storing a computer program which, when executed by a processor, implements the method for resource allocation of the first or second embodiment, or implements the method for resource allocation of the third or fourth embodiment.

Those skilled in the art can understand that all or part of the steps in the method of the foregoing embodiments may be implemented by a program to instruct related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.

It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples for carrying out the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:具有防水功能的POE交换机

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!