CN111221535A - Thread allocation method, server and computer-readable storage medium - Google Patents

Thread allocation method, server and computer-readable storage medium Download PDF

Info

Publication number
CN111221535A
CN111221535A CN201911425959.9A CN201911425959A CN111221535A CN 111221535 A CN111221535 A CN 111221535A CN 201911425959 A CN201911425959 A CN 201911425959A CN 111221535 A CN111221535 A CN 111221535A
Authority
CN
China
Prior art keywords
thread
accounts
maximum
write
threads
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911425959.9A
Other languages
Chinese (zh)
Other versions
CN111221535B (en
Inventor
邓鹏�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Jiuzhou Electric Appliance Co Ltd
Original Assignee
Shenzhen Jiuzhou Electric Appliance Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Jiuzhou Electric Appliance Co Ltd filed Critical Shenzhen Jiuzhou Electric Appliance Co Ltd
Priority to CN201911425959.9A priority Critical patent/CN111221535B/en
Publication of CN111221535A publication Critical patent/CN111221535A/en
Application granted granted Critical
Publication of CN111221535B publication Critical patent/CN111221535B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention provides a thread distribution method, a server and a computer readable storage medium, wherein the method comprises the following steps: acquiring the maximum thread number of a server, and detecting the number of login accounts currently executing compiling operation; and taking the number of the login accounts as the number of the accounts occupied by the threads, and setting the current personal maximum thread number which can be used by each login account according to the maximum thread number of the server and the number of the accounts occupied by the threads. The threads are distributed according to the number of accounts currently undergoing compiling work and the maximum number of threads of the server, so that the situation that a single user occupies a large number of threads is avoided, the compiling efficiency of each user is guaranteed, the development efficiency is improved, and the influence on the development progress and engineering maintenance of the whole project is reduced.

Description

Thread allocation method, server and computer-readable storage medium
Technical Field
The present invention relates to the field of computers, and in particular, to a thread distribution method, a server, and a computer-readable storage medium.
Background
With the development of the current society and the popularization of mobile phones, flat panels, set-top boxes, televisions and other devices, a large number of software developers are involved in the development of operating systems. Generally, a compiling server has the condition that a plurality of users compile at the same time, and because the source code and the compiling of an operating system are huge, a large amount of resources are occupied by one-time complete compiling, so that when a user compiles completely, other users can normally compile after waiting for the complete compiling, the development efficiency is greatly reduced, and the development progress and the engineering maintenance of the whole project are influenced.
Disclosure of Invention
The invention mainly aims to provide a thread distribution method, a server and a computer readable storage medium, and aims to solve the problems that in the prior art, when a user carries out complete compiling, the development efficiency is low, and the development progress and the engineering maintenance of the whole project are influenced.
In order to achieve the above object, the present invention provides a thread allocation method, comprising the steps of:
acquiring the maximum thread number of a server, and detecting the number of login accounts currently executing compiling operation;
and taking the number of the login accounts as the number of the accounts occupied by the threads, and setting the current personal maximum thread number which can be used by each login account according to the maximum thread number of the server and the number of the accounts occupied by the threads.
Optionally, the step of setting the maximum number of personal threads currently available for each login account according to the maximum number of threads of the server and the number of accounts occupied by the threads includes:
and taking the result of dividing the maximum thread number of the server by the number of the accounts occupied by the threads as the maximum personal thread number which can be used by each login account currently.
Optionally, after the step of detecting the number of login accounts currently performing the compiling operation, the method further includes:
judging whether the account occupied by the threads has the historical personal maximum thread number or not;
when the maximum thread number of the historical individuals does not exist, executing the following steps: taking the number of the login accounts as the number of accounts occupied by the threads;
when the historical personal maximum thread number exists, judging whether the detected login account number is consistent with the thread occupation account number or not;
if not, updating the number of the accounts occupied by the thread according to the detected number of the login accounts, and executing the following steps: and setting the personal maximum thread number which can be used by each login account currently according to the server maximum thread number and the number of the accounts occupied by the threads.
Optionally, the step of obtaining the maximum number of threads of the server includes:
acquiring the maximum write thread number of the server in the maximum thread number of the server;
the step of setting the maximum personal thread number which can be used by each login account currently according to the maximum server thread number and the thread occupation account number comprises the following steps:
acquiring the number of write-in accounts needing to execute a write command in the login account, and taking the number of the write-in accounts as the number of accounts occupied by a write thread;
and taking the result of dividing the maximum write thread number by the number of accounts occupied by the write threads as the maximum write thread number of the individuals currently used by each write account.
Optionally, the step of obtaining the number of write accounts needing to execute the write command in the login account includes:
judging whether the maximum write thread number of historical individuals exists in the written account;
when the maximum write thread number of the historical individuals does not exist, executing the following steps: taking the number of the write accounts as the number of accounts occupied by the write thread;
when the maximum write thread number of the historical individuals exists, judging whether the obtained write account number is consistent with the account number occupied by the write thread;
if not, updating the number of accounts occupied by the write thread according to the obtained number of the write accounts, and executing the following steps: and taking the result of dividing the maximum write thread number by the number of accounts occupied by the write threads as the maximum write thread number of the individuals currently used by each write account.
Optionally, the method further comprises:
detecting the number of single-thread accounts corresponding to a command to be executed in a single thread;
acquiring the single maximum execution command number of the single thread, and dividing the single maximum execution command number by the number of the single thread accounts to obtain the average execution command number of each single thread account;
and taking the average executing command number as the individual single maximum executing command number of each single thread account.
Optionally, the step of obtaining the single maximum number of executed single-threaded commands includes:
judging whether the number of the single-thread accounts obtained by detection is consistent with the number of the single-thread accounts executing the command in the single thread;
when the detected number of the single-thread accounts is consistent with the number of the single-thread accounts executing the command, setting the maximum single-time execution command number of the individual corresponding to the number of the single-thread accounts executing the command;
when the detected number of the single-thread accounts is not consistent with the number of the single-thread accounts executing the command, after the fact that all executed commands in the single thread are executed is determined to be finished, executing the following steps: and dividing the single maximum execution command number by the single-thread account number to obtain the average execution command number of each single-thread account.
Optionally, the method further comprises:
and when the detected number of the single-thread accounts is smaller than that of the single-thread accounts executing the command, releasing the cache corresponding to the reduced single-thread accounts.
To achieve the above object, the present invention further provides a server including a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program implementing the steps of the thread allocation method as described above when executed by the processor.
To achieve the above object, the present invention further provides a computer readable storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the thread allocation method as described above.
The invention provides a thread distribution method, a server and a computer readable storage medium, which are used for obtaining the maximum number of threads of the server and detecting the number of login accounts currently executing compiling operation; and taking the number of the login accounts as the number of the accounts occupied by the threads, and setting the current personal maximum thread number which can be used by each login account according to the maximum thread number of the server and the number of the accounts occupied by the threads. The threads are distributed according to the number of accounts currently undergoing compiling work and the maximum number of threads of the server, so that the situation that a single user occupies a large number of threads is avoided, the compiling efficiency of each user is guaranteed, the development efficiency is improved, and the influence on the development progress and engineering maintenance of the whole project is reduced.
Drawings
FIG. 1 is a flowchart illustrating a thread allocation method according to a first embodiment of the present invention;
FIG. 2 is a flowchart illustrating a thread allocation method according to a third embodiment of the present invention;
fig. 3 is a schematic block diagram of a server according to the present invention.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a thread allocation method, referring to fig. 1, fig. 1 is a schematic flow chart of a first embodiment of the thread allocation method of the invention, and the method comprises the following steps:
step S10, obtaining the maximum thread number of the server, and detecting the number of the login accounts currently executing the compiling operation;
the maximum number of threads of the server depends on the hardware structure of the server and is generally fixed. The number of the login accounts currently executing the compiling operation refers to the number of the login accounts which have compiling tasks in all the login accounts.
And step S20, taking the number of the login accounts as the number of the accounts occupied by the threads, and setting the current personal maximum thread number of each login account according to the maximum thread number of the server and the number of the accounts occupied by the threads.
In order to determine the number of accounts which need to be compiled by threads currently, the number of login accounts is used as the number of accounts occupied by the threads, and the maximum personal thread number which can be currently used by each login account is set according to the maximum thread number of the server and the number of accounts occupied by the threads, so that each user can be ensured to obtain resources. Therefore, when a plurality of users use the compiling server at the same time, local compiling engineers can obtain resources, and debugging efficiency is guaranteed. Therefore, resources and performance of the compiling server are reasonably utilized to the maximum extent. It can be understood that the personal maximum thread number refers to the maximum thread number that can be used by the thread occupation account, and the thread occupation account can also perform compilation work with threads smaller than the maximum thread number according to actual compilation requirements.
The embodiment obtains the maximum thread number of the server and detects the number of login accounts currently executing the compiling operation; and taking the number of the login accounts as the number of the accounts occupied by the threads, and setting the current personal maximum thread number which can be used by each login account according to the maximum thread number of the server and the number of the accounts occupied by the threads. The threads are distributed according to the number of accounts currently undergoing compiling work and the maximum number of threads of the server, so that the situation that a single user occupies a large number of threads is avoided, the compiling efficiency of each user is guaranteed, the development efficiency is improved, and the influence on the development progress and engineering maintenance of the whole project is reduced. Further, in the second embodiment of the thread allocation method according to the present invention proposed based on the first embodiment of the present invention, the step S20 includes the steps of:
and step S21, taking the result of dividing the maximum number of the server threads by the number of the accounts occupied by the threads as the maximum number of the personal threads which can be used by each login account currently.
Generally, when a server allocates a thread, a compiling task with a large demand is prioritized, for example, a large amount of thread resources are required for one-time complete compiling, and meanwhile, the compiling time is long, so that a subsequent compiling task compiles a small range of codes even locally, and the compiling speed is slow because the thread resources are already occupied. Therefore, in the embodiment, the maximum number of threads of the server is averagely allocated to the account occupied by the current thread, so that the resource inclination of the account with large compiling task amount is avoided, and each login account can be compiled by enough threads. Further, when the number of the maximum threads of the server is divided by the number of the thread occupying accounts to form a remainder, the threads corresponding to the whole division part are evenly distributed to the thread occupying accounts, and the rest threads can be distributed according to the compiling task amount in the thread occupying accounts.
In the embodiment, the result obtained by dividing the maximum number of the threads of the server by the number of the accounts occupied by the threads is used as the maximum number of the threads of each thread, so that the resources and the performance of the compiling server are reasonably utilized to the maximum extent, the compiling efficiency is improved, and the problems that a plurality of engineers use the same compiling server, the compiling is not performed for a long time, the resources cannot be obtained, and the compiling efficiency is low are solved.
Further, referring to fig. 2, in the third embodiment of the thread allocation method according to the present invention proposed based on the first embodiment of the present invention, after the step S10, the method includes the steps of:
step S30, judging whether the thread account has history personal maximum thread number; wherein, when there is no history personal maximum thread number, executing step S20;
step S32, when the history personal maximum thread number exists, judging whether the detected login account number is consistent with the thread occupation account number;
step S321, if the accounts are inconsistent, updating the number of the accounts occupied by the thread according to the detected number of the login accounts, and executing the following steps: and setting the personal maximum thread number which can be used by each login account currently according to the server maximum thread number and the number of the accounts occupied by the threads.
The historical personal maximum thread number refers to the personal maximum thread number distributed by the server according to the thread account number of the thread account. When the historical personal maximum thread number does not exist, the server does not perform compiling work at the moment, and no thread occupies the account at the moment, so that the login account number can be directly used as the thread occupying account number. When the historical personal maximum thread number exists, the server is explained to be compiling, but the embodiment is that the server maximum thread number is averagely distributed to the current thread account, so that under the condition that the total thread account number is not changed, the personal maximum thread number which can be currently used by each login account does not need to be changed, the fact that the thread account number is changed before the personal maximum thread number which can be currently used by each login account is changed is required to be confirmed, and when the detected login account number is consistent with the thread account number, the personal maximum thread number which can be currently used by each login account is kept unchanged; and when detecting whether the number of the login accounts obtained is inconsistent with the number of the thread occupation accounts, updating the number of the thread occupation accounts to the number of the login accounts obtained by the latest detection.
And when the number of accounts occupied by the current thread changes, averagely distributing the maximum number of threads of the server to each latest account occupied by the thread. For example, the maximum thread number of the current server is 48 threads, and only one thread originally occupies the account, and the maximum thread number of the thread occupying the account is 48 threads, so that the highest compiling efficiency is achieved; if the number of the login accounts is detected to be two, namely the number of the accounts occupied by the threads is also set to be 2, the server allocates the threads again, and therefore the maximum number of the threads of the two current accounts occupied by the threads is 24.
When the number of each login account is changed, the maximum number of personal threads which can be used by each login account at present is changed, so that the thread allocation of the server is adjusted along with the change of the number of the login accounts, and the compiling efficiency of a user is guaranteed.
Further, in a fourth embodiment of the thread allocation method according to the present invention based on the first embodiment of the present invention, the step S10 includes the steps of:
acquiring the maximum write thread number of the server in the maximum thread number of the server;
the maximum number of threads emphasized in this embodiment is a broad sense, and may include not only the maximum acceptable number of threads of the server, but also the maximum number of threads corresponding to various types of thread operations, where the thread operations may include write operations, read-only operations, and the like.
The step S20 includes the steps of:
acquiring the number of write-in accounts needing to execute a write command in the login account, and taking the number of the write-in accounts as the number of accounts occupied by a write thread;
and taking the result of dividing the maximum write thread number by the number of accounts occupied by the write threads as the maximum write thread number of the individuals currently used by each write account.
The step of obtaining the number of the write-in accounts needing to execute the write-in command in the login account may further include the following steps: judging whether the maximum write thread number of historical individuals exists in the written account; when the maximum write thread number of the historical individuals does not exist, executing the following steps: taking the number of the write accounts as the number of accounts occupied by the write thread; when the maximum write thread number of the historical individuals exists, judging whether the obtained write account number is consistent with the account number occupied by the write thread; if not, updating the number of accounts occupied by the write thread according to the obtained number of the write accounts, and executing the following steps: and taking the result of dividing the maximum write thread number by the number of accounts occupied by the write threads as the maximum write thread number of the individuals currently used by each write account.
The write command refers to a command for writing a file on a hard disk or a flash by a user, and because the write operation is an actual operation on hardware, the write time and a time sequence interface are limited by the hard disk or a storage device, the write command needs to be compiled for a longer time. The embodiment allocates the write threads to the write accounts which need to execute the write command at present on average. For example, the maximum thread number of the current server is 48 threads, wherein the maximum write thread number accounts for 24 threads, and at this time, the number of the accounts occupied by the threads is 6, wherein the number of the accounts occupied by the write threads accounts for 4; then the maximum number of personal threads that can be allocated to each current thread occupation account is 8 threads, and the maximum number of personal write threads that can be allocated to a write thread occupation account in the thread occupation account is 6, so the threads that can be allocated to 4 write thread occupation accounts are 6 write threads and 2 non-write threads, and the threads that can be allocated to 2 thread occupation accounts except for the write thread occupation account in the thread occupation account are 8 non-write threads. Further, when the number of the maximum write threads is divided by the number of the account occupied by the write threads, the write threads corresponding to the whole division part are evenly distributed to the account occupied by the write threads, and the rest write threads can be distributed according to the number of the write commands in the account occupied by the write threads.
When the number of the write accounts changes, the scheme for reallocating the maximum write thread number is similar to the scheme for reallocating the maximum write thread number of the server when the login account changes, and the description is omitted. It should be noted that, when the write account is reduced, the writing account that previously executed the write command may exit the compiling or be compiled, or the writing command in the compiling task of the writing account may be completed, but other commands are being compiled.
The embodiment separately and equally allocates the write threads to the current write accounts which need to execute the write command, so as to avoid the problem that the write threads are unevenly allocated when the maximum thread number of the server is averagely allocated to the login accounts or are allocated to the login accounts which do not need to execute the write command.
Further, in a fifth embodiment of the thread allocation method according to the present invention based on the first embodiment of the present invention, the method further includes the steps of:
detecting the number of single-thread accounts corresponding to a command to be executed in a single thread;
acquiring the single maximum execution command number of the single thread, and dividing the single maximum execution command number by the number of the single thread accounts to obtain the average execution command number of each single thread account;
and taking the average executing command number as the individual single maximum executing command number of each single thread account.
Wherein the step of obtaining the single maximum number of single-threaded executed commands comprises the following steps:
judging whether the number of the single-thread accounts obtained by detection is consistent with the number of the single-thread accounts executing the command in the single thread;
when the detected number of the single-thread accounts is consistent with the number of the single-thread accounts executing the command, setting the maximum single-time execution command number of the individual corresponding to the number of the single-thread accounts executing the command;
when the detected number of the single-thread accounts is not consistent with the number of the single-thread accounts executing the command, after the fact that all executed commands in the single thread are executed is determined to be finished, executing the following steps: and dividing the single maximum execution command number by the single-thread account number to obtain the average execution command number of each single-thread account.
Some server threads support single multi-command injection, so in order to balance the compiling efficiency of each login account, the single maximum command number is distributed equally, for example: in one thread, the maximum number of the single-time executed commands of the thread is 16, and at the moment, 4 single-thread accounts have command input simultaneously, so that 4 commands which can be executed by each single-thread account at a time are provided; when a new single-thread account is added to the thread, the number of the commands executed by each single-thread account needs to be further split to ensure that each user can obtain resources, so that the number of the single-thread accounts is increased from 4 to 5, and the number of the commands which can be executed by each single-thread account in a single time is 3. Further, when the number of the single maximum execution commands of the thread is divided by the number of the single thread accounts to have a remainder, the single execution commands corresponding to the whole-divided parts are evenly distributed to the single thread accounts, and the rest commands can be distributed according to the number of the commands in each single thread account.
By averagely distributing the single maximum execution command number in the single thread to the single thread account in the thread, each user can effectively obtain the compiling resources, and the compiling efficiency of each user is improved.
Further, the method further comprises: and when the detected number of the single-thread accounts is smaller than that of the single-thread accounts executing the command, releasing the cache corresponding to the reduced single-thread accounts.
According to the scheme, on the basis that the number of the currently detected single-thread accounts is inconsistent with the number of the single-thread accounts executing the command, the number of the single-thread accounts obtained through detection is determined to be smaller than the number of the single-thread accounts executing the command, and at the moment, the average number of the executed commands of the single-thread accounts is adjusted again, and the memory can be released. That is, after the single-threaded account executes the command that needs to be executed on the thread, even if there is no command that needs to be executed by the single-threaded account on the current thread, the single-threaded account still occupies the thread, and therefore, the cache corresponding to the single-threaded account needs to be released to update the number of the single-threaded accounts.
And releasing the cache corresponding to the reduced single-thread account, so that the server can detect the number of the single-thread accounts actually carrying out compiling work on the single thread in real time, and the threads are prevented from being occupied by air and wasting thread resources.
Referring to fig. 3, the server may include components of a communication module 10, a memory 20, and a processor 30 in a hardware structure. In the server, the processor 30 is connected to the memory 20 and the communication module 10, respectively, the memory 20 stores thereon a computer program, which is executed by the processor 30 at the same time, and when executed, implements the steps of the above-mentioned method embodiments.
The communication module 10 may be connected to an external communication device through a network. The communication module 10 may receive a request from an external communication device, and may also send a request, an instruction, and information to the external communication device, where the external communication device may be another server, a server, or an internet of things device, such as a television.
The memory 20 may be used to store software programs as well as various data. The memory 20 may mainly include a program storage area and a data storage area, where the program storage area may store an operating system, an application program required by at least one function (for example, determining whether a thread account has a historical personal maximum number of threads), and the like; the storage data area may include a database, and the storage data area may store data or information created according to use of the system, or the like. Further, the memory 20 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 30, which is a control center of the server, connects various parts of the entire server using various interfaces and lines, and performs various functions of the server and processes data by operating or executing software programs and/or modules stored in the memory 20 and calling data stored in the memory 20, thereby performing overall monitoring of the server. Processor 30 may include one or more processing units; alternatively, the processor 30 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 30.
Although not shown in fig. 3, the server may further include a circuit control module, which is used for connecting with a power supply to ensure the normal operation of other components. Those skilled in the art will appreciate that the server architecture shown in FIG. 3 is not meant to be limiting, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The invention also proposes a computer-readable storage medium on which a computer program is stored. The computer-readable storage medium may be the Memory 20 in the server in fig. 3, and may also be at least one of a ROM (Read-Only Memory)/RAM (Random Access Memory), a magnetic disk, and an optical disk, and the computer-readable storage medium includes several instructions for enabling a terminal device (which may be a television, an automobile, a mobile phone, a computer, a server, a terminal, or a network device) having a processor to execute the method according to the embodiments of the present invention.
In the present invention, the terms "first", "second", "third", "fourth" and "fifth" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance, and those skilled in the art can understand the specific meanings of the above terms in the present invention according to specific situations.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although the embodiment of the present invention has been shown and described, the scope of the present invention is not limited thereto, it should be understood that the above embodiment is illustrative and not to be construed as limiting the present invention, and that those skilled in the art can make changes, modifications and substitutions to the above embodiment within the scope of the present invention, and that these changes, modifications and substitutions should be covered by the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method of thread allocation, the method comprising the steps of:
acquiring the maximum thread number of a server, and detecting the number of login accounts currently executing compiling operation;
and taking the number of the login accounts as the number of the accounts occupied by the threads, and setting the current personal maximum thread number which can be used by each login account according to the maximum thread number of the server and the number of the accounts occupied by the threads.
2. The thread allocation method according to claim 1, wherein the step of setting the maximum number of personal threads currently available for each login account according to the maximum number of threads of the server and the number of accounts occupied by the threads comprises:
and taking the result of dividing the maximum thread number of the server by the number of the accounts occupied by the threads as the maximum personal thread number which can be used by each login account currently.
3. The thread allocation method of claim 1, wherein after the step of detecting the number of login accounts currently performing the compilation operation, further comprising:
judging whether the account occupied by the threads has the historical personal maximum thread number or not;
when the maximum thread number of the historical individuals does not exist, executing the following steps: taking the number of the login accounts as the number of accounts occupied by the threads;
when the historical personal maximum thread number exists, judging whether the detected login account number is consistent with the thread occupation account number or not;
if not, updating the number of the accounts occupied by the thread according to the detected number of the login accounts, and executing the following steps: and setting the personal maximum thread number which can be used by each login account currently according to the server maximum thread number and the number of the accounts occupied by the threads.
4. The thread allocation method of claim 1, wherein the step of obtaining the maximum number of threads of the server comprises:
acquiring the maximum write thread number of the server in the maximum thread number of the server;
the step of setting the maximum personal thread number which can be used by each login account currently according to the maximum server thread number and the thread occupation account number comprises the following steps:
acquiring the number of write-in accounts needing to execute a write command in the login account, and taking the number of the write-in accounts as the number of accounts occupied by a write thread;
and taking the result of dividing the maximum write thread number by the number of accounts occupied by the write threads as the maximum write thread number of the individuals currently used by each write account.
5. The thread allocation method according to claim 4, wherein the step of obtaining the number of write accounts needing to execute a write command in the login account comprises the following steps:
judging whether the maximum write thread number of historical individuals exists in the written account;
when the maximum write thread number of the historical individuals does not exist, executing the following steps: taking the number of the write accounts as the number of accounts occupied by the write thread;
when the maximum write thread number of the historical individuals exists, judging whether the obtained write account number is consistent with the account number occupied by the write thread;
if not, updating the number of accounts occupied by the write thread according to the obtained number of the write accounts, and executing the following steps: and taking the result of dividing the maximum write thread number by the number of accounts occupied by the write threads as the maximum write thread number of the individuals currently used by each write account.
6. The thread allocation method of any one of claims 1-5, wherein the method further comprises:
detecting the number of single-thread accounts corresponding to a command to be executed in a single thread;
acquiring the single maximum execution command number of the single thread, and dividing the single maximum execution command number by the number of the single thread accounts to obtain the average execution command number of each single thread account;
and taking the average executing command number as the individual single maximum executing command number of each single thread account.
7. The thread allocation method of claim 6, wherein said step of obtaining said single-threaded maximum number of execution commands in a single pass is followed by the steps of:
judging whether the number of the single-thread accounts obtained by detection is consistent with the number of the single-thread accounts executing the command in the single thread;
when the detected number of the single-thread accounts is consistent with the number of the single-thread accounts executing the command, setting the maximum single-time execution command number of the individual corresponding to the number of the single-thread accounts executing the command;
when the detected number of the single-thread accounts is not consistent with the number of the single-thread accounts executing the command, after the fact that all executed commands in the single thread are executed is determined to be finished, executing the following steps: and dividing the single maximum execution command number by the single-thread account number to obtain the average execution command number of each single-thread account.
8. The thread allocation method of claim 7, wherein the method further comprises:
and when the detected number of the single-thread accounts is smaller than that of the single-thread accounts executing the command, releasing the cache corresponding to the reduced single-thread accounts.
9. A server, characterized in that the server comprises a memory, a processor and a computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, carries out the steps of the thread allocation method according to any one of claims 1 to 8.
10. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the thread allocation method according to any one of claims 1 to 8.
CN201911425959.9A 2019-12-31 2019-12-31 Thread allocation method, server and computer readable storage medium Active CN111221535B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911425959.9A CN111221535B (en) 2019-12-31 2019-12-31 Thread allocation method, server and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911425959.9A CN111221535B (en) 2019-12-31 2019-12-31 Thread allocation method, server and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111221535A true CN111221535A (en) 2020-06-02
CN111221535B CN111221535B (en) 2023-07-14

Family

ID=70829288

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911425959.9A Active CN111221535B (en) 2019-12-31 2019-12-31 Thread allocation method, server and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111221535B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008210038A (en) * 2007-02-23 2008-09-11 Aplix Corp User thread implementing method
US20100031266A1 (en) * 2008-07-31 2010-02-04 International Business Machines Corporation System and method for determining a number of threads to maximize utilization of a system
CN101996067A (en) * 2009-08-19 2011-03-30 阿里巴巴集团控股有限公司 Data export method and device
CN107450978A (en) * 2016-05-31 2017-12-08 北京京东尚科信息技术有限公司 The thread management method and device of distributed system
CN108415767A (en) * 2018-03-07 2018-08-17 中国平安人寿保险股份有限公司 Server thread control method, device, equipment and readable storage medium storing program for executing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008210038A (en) * 2007-02-23 2008-09-11 Aplix Corp User thread implementing method
US20100031266A1 (en) * 2008-07-31 2010-02-04 International Business Machines Corporation System and method for determining a number of threads to maximize utilization of a system
CN101996067A (en) * 2009-08-19 2011-03-30 阿里巴巴集团控股有限公司 Data export method and device
CN107450978A (en) * 2016-05-31 2017-12-08 北京京东尚科信息技术有限公司 The thread management method and device of distributed system
CN108415767A (en) * 2018-03-07 2018-08-17 中国平安人寿保险股份有限公司 Server thread control method, device, equipment and readable storage medium storing program for executing

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
任永青等: "众核结构上线程级推测执行能力评估器设计", 《小型微型计算机系统》, pages 1012 - 1016 *
聂鹏程等: "性能非对称多核处理器上的自适应调度", pages 773 - 781 *

Also Published As

Publication number Publication date
CN111221535B (en) 2023-07-14

Similar Documents

Publication Publication Date Title
US9336054B2 (en) Method and apparatus for configuring resource
US20180349193A1 (en) Streaming program execution method of intelligent terminal
CN110427258B (en) Resource scheduling control method and device based on cloud platform
CN111338779B (en) Resource allocation method, device, computer equipment and storage medium
CN111104208A (en) Process scheduling management method and device, computer equipment and storage medium
CN111666210A (en) Chip verification method and device
US20170364449A1 (en) Process running method and apparatus
CN113986402A (en) Function calling method and device, electronic equipment and storage medium
CN111858056B (en) Task scheduling method and device, computer equipment and storage medium
CN113835887A (en) Video memory allocation method and device, electronic equipment and readable storage medium
US8863060B2 (en) Programmable intelligent storage architecture based on application and business requirements
US6226725B1 (en) Method and system in a data processing system for the dedication of memory storage locations
CN109462663B (en) Method for limiting system resource occupation, voice interaction system and storage medium
CN110347546B (en) Dynamic adjustment method, device, medium and electronic equipment for monitoring task
CN111782717A (en) Data processing method and system, electronic equipment and storage medium
CN111562952A (en) Dynamic loading method and dynamic loading device for double-core intelligent ammeter management unit
CN110806891A (en) Method and device for generating software version of embedded equipment
CN111221535B (en) Thread allocation method, server and computer readable storage medium
US9348667B2 (en) Apparatus for managing application program and method therefor
CN104281587A (en) Connection establishing method and device
CN115934213A (en) Controller stack calling method, device, equipment and storage medium
CN113342376B (en) Method and device for upgrading operating system of Internet of things equipment
CN110737533B (en) Task scheduling method and device, electronic equipment and storage medium
CN116048600A (en) Applet function development method, device, computer equipment and storage medium
KR20070014724A (en) Memory controlling method for mobile communicationn terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant