CN111221535B - 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
CN111221535B
CN111221535B CN201911425959.9A CN201911425959A CN111221535B CN 111221535 B CN111221535 B CN 111221535B CN 201911425959 A CN201911425959 A CN 201911425959A CN 111221535 B CN111221535 B CN 111221535B
Authority
CN
China
Prior art keywords
thread
maximum
account
accounts
server
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.)
Active
Application number
CN201911425959.9A
Other languages
Chinese (zh)
Other versions
CN111221535A (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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Multi Processors (AREA)

Abstract

The invention provides a thread allocation method, a server and a computer readable storage medium, wherein the method comprises the following steps: obtaining the maximum thread number of a server, and detecting the number of login accounts currently executing compiling operation; and taking the login account number as the thread occupation account number, and setting the personal maximum thread number which can be currently used by each login account according to the server maximum thread number and the thread occupation account number. The threads are distributed according to the number of accounts currently carrying out compiling work and the maximum number of threads of the server, so that the condition that a single user occupies a large number of threads is avoided, the compiling efficiency of each user is ensured, the developing efficiency is improved, and the influence on the developing 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 allocation method, a server, and a computer readable storage medium.
Background
With the current development of society, mobile phones, tablets, set-top boxes, televisions and other devices are popular, and a large number of software developers are put into the development of operating systems. Generally, a compiling server has the condition that a plurality of users compile simultaneously, and because the source code and the compiling of an operating system are huge, one-time complete compiling can occupy a large amount of resources, so that when the users complete compiling, other users can normally compile after waiting for complete compiling, the development efficiency is greatly reduced, and the development progress and engineering maintenance of an overall project are influenced.
Disclosure of Invention
The invention mainly aims to provide a thread allocation method, a server and a computer readable storage medium, and aims to solve the problems that in the prior art, when a user performs complete compiling, development efficiency is low, and development progress and engineering maintenance of an overall project are affected.
To achieve the above object, the present invention provides a thread allocation method, including the steps of:
obtaining the maximum thread number of a server, and detecting the number of login accounts currently executing compiling operation;
and taking the login account number as the thread occupation account number, and setting the personal maximum thread number which can be currently used by each login account according to the server maximum thread number and the thread occupation account number.
Optionally, the step of setting the maximum personal number of threads currently used by each login account according to the maximum number of threads of the server and the number of accounts occupied by threads includes:
and dividing the maximum thread number of the server and the thread occupation account number to obtain the current personal maximum thread number of each login account.
Optionally, after the step of detecting the number of login accounts currently performing the compiling operation, the method further includes:
judging whether the historical personal maximum thread number exists in the account occupied by the threads;
when there is no historical personal maximum thread number, executing the steps: taking the login account number as the thread occupation account number;
when the historical personal maximum thread number exists, judging whether the number of the login accounts obtained through detection is consistent with the number of the accounts occupied by the threads;
if the login account numbers are inconsistent, updating the thread occupation account numbers according to the detected login account numbers, and executing the steps: and setting the maximum personal thread number which can be used by each login account currently according to the maximum thread number of the server and the number of the thread occupied accounts.
Optionally, the step of obtaining the maximum number of threads of the server includes:
obtaining the maximum writing thread number of a server in the maximum thread number of the server;
the step of taking the login account number as the thread occupation account number and setting the personal maximum thread number which can be currently used by each login account according to the server maximum thread number and the thread occupation account number comprises the following steps:
acquiring the number of written accounts which need to execute a writing command in the login account, and taking the number of written accounts as the number of accounts occupied by writing threads;
and dividing the maximum writing thread number and the account number occupied by the writing thread as the maximum personal writing thread number which can be currently used by each writing account.
Optionally, the step of obtaining the number of the write account in the login account that needs to execute the write command includes:
judging whether the written account has a history personal maximum written thread number or not;
when there is no historical personal maximum written thread number, executing the steps: taking the written account number as the account number occupied by the writing thread;
when the maximum writing thread number of the historical individuals exists, judging whether the acquired writing account number is consistent with the account number occupied by the writing thread;
if not, updating the account number occupied by the writing thread according to the acquired number of the writing accounts, and executing the steps of: and dividing the maximum writing thread number and the account number occupied by the writing thread as the maximum personal writing thread number which can be currently used by each writing account.
Optionally, the method further comprises:
detecting the number of single lines Cheng Zhanghu corresponding to the command waiting to be executed in the single threads;
obtaining the single-thread single-time maximum execution command number, dividing the single-time maximum execution command number by the single-thread Cheng Zhanghu number, and obtaining the average execution command number of each single-thread account;
the average execution command number is taken as the individual single maximum execution command number of each single-thread account.
Optionally, the step of obtaining the single thread single maximum execution command number includes:
judging whether the number of the single-threaded accounts obtained through detection is consistent with the number of the single-threaded accounts in the single thread, which are executing commands;
when the number of detected single lines Cheng Zhanghu is consistent with the number of single-thread accounts executing the command, setting the maximum number of single-time executed commands of the individual corresponding to the number of single lines Cheng Zhanghu executing the command;
when the number of detected single lines Cheng Zhanghu is inconsistent with the number of single lines Cheng Zhanghu of the executing command, after determining that all the executing commands in the single thread are executed, executing the steps: dividing the single maximum execution command number by the single line Cheng Zhanghu number to obtain the average execution command number of each single-thread account.
Optionally, the method further comprises:
when the number of detected single lines Cheng Zhanghu is smaller than the number of single-thread accounts in which the command is being executed, the cache corresponding to the reduced single line Cheng Zhanghu is released.
To achieve the above object, the present invention also provides a server including a memory, a processor, and a computer program stored on the memory and executable on the processor, which when executed by the processor, implements the steps of the thread allocation method as described above.
To achieve the above object, the present invention also 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 allocation method, a server and a computer readable storage medium, wherein the maximum thread number of the server is obtained, and the number of login accounts currently executing compiling operation is detected; and taking the login account number as the thread occupation account number, and setting the personal maximum thread number which can be currently used by each login account according to the server maximum thread number and the thread occupation account number. The threads are distributed according to the number of accounts currently carrying out compiling work and the maximum number of threads of the server, so that the condition that a single user occupies a large number of threads is avoided, the compiling efficiency of each user is ensured, the developing efficiency is improved, and the influence on the developing progress and engineering maintenance of the whole project is reduced.
Drawings
FIG. 1 is a flowchart illustrating a first embodiment of a thread allocation method according to 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 for purposes of illustration only and are not intended to limit the scope of the invention.
The invention provides a thread allocation method, referring to fig. 1, fig. 1 is a flow chart of a first embodiment of the thread allocation method of the invention, the method comprises the steps of:
step S10, obtaining the maximum thread number of a server, and detecting the number of login accounts currently executing compiling operation;
the maximum number of threads of the server depends on the hardware architecture of the server and is generally fixed. The number of login accounts currently executing the compiling operation refers to the number of login accounts carrying out the compiling task in all login accounts.
And step S20, taking the number of login accounts as the number of thread occupation accounts, and setting the maximum personal thread number which can be used currently by each login account according to the maximum thread number of the server and the number of thread occupation accounts.
In order to be able to determine the account number which needs to be allocated with threads for compiling at present, the login account number is used as the thread occupation account number, and the personal maximum thread number which can be used by each login account at present is set according to the server maximum thread number and the thread occupation account number, so that each user can be ensured to obtain resources. Therefore, when a plurality of users use the compiling server at the same time, the engineers of local compiling can obtain resources, and the debugging efficiency is ensured. So that the maximum compound theory takes advantage of the resources and performance of the compilation server. 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 compile with threads smaller than the maximum thread number according to actual compiling requirements.
The method comprises the steps of obtaining the maximum thread number of a server and detecting the number of login accounts currently executing compiling operation; and taking the login account number as the thread occupation account number, and setting the personal maximum thread number which can be currently used by each login account according to the server maximum thread number and the thread occupation account number. The threads are distributed according to the number of accounts currently carrying out compiling work and the maximum number of threads of the server, so that the condition that a single user occupies a large number of threads is avoided, the compiling efficiency of each user is ensured, the developing efficiency is improved, and the influence on the developing progress and engineering maintenance of the whole project is reduced. Further, in a second embodiment of the thread allocation method according to the present invention set forth in the first embodiment of the present invention, the step S20 includes the steps of:
and S21, dividing the maximum number of threads of the server and the number of accounts occupied by the threads to obtain the maximum number of personal threads currently used by each login account.
Generally, when a server allocates a thread, a larger compiling task is preferentially required, for example, a complete compiling needs to occupy a large amount of thread resources, and meanwhile, the compiling time is long, so that the subsequent compiling task compiles even a partial compiling of a small range of codes, and the compiling speed is slow because the thread resources are already occupied. Therefore, the embodiment evenly distributes the maximum number of threads of the server to the accounts occupied by the current threads, does not incline the resources of the accounts with large compiling task amount, and ensures that each login account can have enough threads for compiling. Further, when the number of the maximum threads of the server is divided by the number of the thread occupation accounts and a remainder exists, the threads corresponding to the divisible part are evenly distributed to the thread occupation accounts, and the rest threads can be distributed according to the compiling task quantity in the thread occupation accounts.
According to the method, the device and the system, the result of dividing the maximum number of threads of the server by the number of the accounts occupied by the threads is used as the maximum number of personal threads which can be used currently by each thread occupied account, the maximum compound theory utilizes the resources and the performances of the compiling server, the compiling efficiency is improved, and the problems that a plurality of engineers use the same compiling server, the resources can not be obtained after long waiting for compiling and the compiling efficiency is low are solved.
Further, referring to fig. 2, in a third embodiment of the thread allocation method according to the present invention, which is set forth based on the first embodiment of the present invention, after the step S10, the steps are included:
step S30, judging whether a historical personal maximum thread number exists in the thread occupation account; wherein, when there is no history personal maximum thread number, step S20 is executed;
step S32, judging whether the number of the detected login accounts is consistent with the number of the accounts occupied by threads when the maximum historical personal thread number exists;
step S321, if not, updating the number of the accounts occupied by the threads according to the number of the login accounts obtained by detection, and executing the steps: and setting the maximum personal thread number which can be used by each login account currently according to the maximum thread number of the server and the number of the thread occupied accounts.
The historical personal maximum thread number refers to the personal maximum thread number which is distributed by the server according to the thread occupation account number at present. When the historical personal maximum thread number does not exist, the fact that the server does not carry out compiling work at the moment is indicated, and no thread occupies an account at the moment, so that the login account number can be directly used as the thread occupied account number. When the historical maximum number of threads exists, the server is stated to be in compiling work at the moment, and because the maximum number of threads of the server is evenly distributed to the accounts occupied by the current threads, under the condition that the total number of the accounts occupied by the threads is unchanged, the maximum number of threads of the individuals which can be used currently by each login account does not need to be changed, so that the number of the accounts occupied by the threads is confirmed to be changed before the maximum number of the threads of the individuals which can be used currently by each login account is changed, and when whether the number of the login accounts obtained through detection is consistent with the number of the accounts occupied by the threads, the maximum number of the threads which can be used currently by each login account is kept unchanged; and when the number of the login accounts obtained through detection is inconsistent with the number of the thread occupation accounts, updating the number of the thread occupation accounts into the number of the login accounts obtained through latest detection.
When the number of the current thread occupation accounts changes, the maximum number of the threads of the server is averagely distributed to each latest thread occupation account. For example, the maximum thread number of the current server is 48 threads, and only one thread occupies an account originally, and the maximum thread number of the individuals 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 thread occupation accounts is also 2, and the server allocates the threads again, so that the maximum number of the personal threads of the current two thread occupation accounts is 24 threads respectively.
When the number of each login account is changed, the maximum personal thread number which can be used by each login account is changed, so that the server thread allocation is adjusted along with the change of the number of the login accounts, and the compiling efficiency of the user is guaranteed.
Further, in a fourth embodiment of the thread allocation method according to the present invention set forth in the first embodiment of the present invention, the step S10 includes the steps of:
obtaining the maximum writing thread number of a server in the maximum thread number of the server;
the maximum thread number emphasized in this embodiment is broad, and may include not only the maximum acceptable thread number of the server, but also the maximum thread number corresponding to various types of thread operations, where the thread operations may include write operations, read-only operations, and so on.
The step S20 includes the steps of:
acquiring the number of written accounts which need to execute a writing command in the login account, and taking the number of written accounts as the number of accounts occupied by writing threads;
and dividing the maximum writing thread number and the account number occupied by the writing thread as the maximum personal writing thread number which can be currently used by each writing account.
The step of obtaining the number of the writing account needing to execute the writing command in the login account may further include the steps of: judging whether the written account has a history personal maximum written thread number or not; when there is no historical personal maximum written thread number, executing the steps: taking the written account number as the account number occupied by the writing thread; when the maximum writing thread number of the historical individuals exists, judging whether the acquired writing account number is consistent with the account number occupied by the writing thread; if not, updating the account number occupied by the writing thread according to the acquired number of the writing accounts, and executing the steps of: and dividing the maximum writing thread number and the account number occupied by the writing thread as the maximum personal writing thread number which can be currently used by each writing account.
The write command refers to a command that a user writes a file onto a hard disk or a flash, and since the write operation is an actual operation on the hardware, the write time and the timing interface are limited by the hard disk or the storage device, so that the write command needs to be compiled for a longer time. The present embodiment separately allocates the write threads evenly to the write account currently needed to execute the write command. For example, the maximum number of threads of the current server is 48 threads, wherein the maximum number of write threads occupies 24 threads, and the number of accounts occupied by the threads is 6, and the number of accounts occupied by the write threads is 4; the maximum number of personal threads which can be allocated to each thread occupying account is 8 threads currently, and the maximum number of personal write threads which can be allocated to each write thread occupying account in the thread occupying accounts is 6, so that the threads which can be allocated to 4 write thread occupying accounts are 6 write threads and 2 non-write threads, and the threads which can be allocated to the 2 threads occupying accounts except the write thread occupying accounts in the thread occupying accounts are 8 non-write threads. Further, when the number of the maximum write threads is divided by the number of the write thread occupied accounts, and a remainder exists, the write threads corresponding to the divisible part are evenly distributed to the write thread occupied accounts, and the rest write threads can be distributed according to the number of write commands in each write thread occupied account.
When the number of the writing accounts changes, the scheme of reassigning the maximum number of writing threads is similar to that of the login accounts when the number of the writing accounts changes, and is not repeated. It should be noted that, when the number of the write account decreases, the compiling may be exited for the log-in account in which the write command was executed before, or the compiling may be completed, or the write command in the compiling task of the log-in account may be completed, but other commands may be compiled.
In this embodiment, the write threads are separately and averagely allocated to the write account that needs to execute the write command at present, so as to avoid the problem that when the maximum number of threads of the server is averagely allocated to the login account, the write threads are unevenly allocated, or are allocated to the login account that does not need to execute the write command.
Further, in a fifth embodiment of the thread allocation method according to the present invention set forth in the first embodiment of the present invention, the method further includes the steps of:
detecting the number of single lines Cheng Zhanghu corresponding to the command waiting to be executed in the single threads;
obtaining the single-thread single-time maximum execution command number, dividing the single-time maximum execution command number by the single-thread Cheng Zhanghu number, and obtaining the average execution command number of each single-thread account;
the average execution command number is taken as the individual single maximum execution command number of each single-thread account.
The step of obtaining the single-thread single-time maximum execution command number comprises the following steps:
judging whether the number of the single-threaded accounts obtained through detection is consistent with the number of the single-threaded accounts in the single thread, which are executing commands;
when the number of detected single lines Cheng Zhanghu is consistent with the number of single-thread accounts executing the command, setting the maximum number of single-time executed commands of the individual corresponding to the number of single lines Cheng Zhanghu executing the command;
when the number of detected single lines Cheng Zhanghu is inconsistent with the number of single lines Cheng Zhanghu of the executing command, after determining that all the executing commands in the single thread are executed, executing the steps: dividing the single maximum execution command number by the single line Cheng Zhanghu 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 evenly distributed, for example: in one thread, the maximum number of single execution commands of the thread is 16, at this time, 4 single-threaded accounts are all provided with command inputs at the same time, and 4 single-executable commands of each single-threaded account are obtained; when a new single-thread account is added to the thread, the number of the execution commands of each single thread Cheng Zhanghu needs to be further split so as 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 single-thread accounts can be 3 in a single-time manner. Further, when there is a remainder in dividing the number of single maximum execution commands of the thread by the number of single lines Cheng Zhanghu, single execution commands corresponding to the divisible portion are equally allocated to the single lines Cheng Zhanghu, and the remaining commands may be allocated according to the number of commands in each single-thread account.
By equally distributing the single maximum execution command number in a single thread to the single thread Cheng Zhanghu, each user can effectively acquire the compiling resources, and the compiling efficiency of each user is improved.
Further, the method further comprises: when the number of detected single lines Cheng Zhanghu is smaller than the number of single-thread accounts in which the command is being executed, the cache corresponding to the reduced single line Cheng Zhanghu is released.
The number of detected single lines Cheng Zhanghu is smaller than the number of single lines Cheng Zhanghu of the command being executed on the basis that the number of currently detected single lines Cheng Zhanghu is inconsistent with the number of single lines Cheng Zhanghu of the command being executed, and at the moment, the memory can be released as well as the average number of the command being executed by readjusting the single-thread account. That is, after the single-threaded account completes executing the command to be executed on the thread, the single-threaded account still occupies the thread even if there is no command to be executed on the current thread, so that the buffer corresponding to the single thread Cheng Zhanghu needs to be released to update the number of single-threaded accounts.
The buffer memory corresponding to the reduced single lines Cheng Zhanghu is released, so that the server can detect the number of the single lines Cheng Zhanghu for actually performing compiling work on a single thread in real time, and the thread is prevented from being occupied and the thread resource is wasted.
Referring to fig. 3, the server may include components such as a communication module 10, a memory 20, and a processor 30 in a hardware configuration. In the server, the processor 30 is connected to the memory 20 and the communication module 10, respectively, and the memory 20 stores a computer program, and the computer program is executed by the processor 30 at the same time, where the computer program implements the steps of the method embodiments described above.
The communication module 10 is connectable to an external communication device via a network. The communication module 10 may receive a request sent by 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, and so on.
The memory 20 is used for storing software programs and various data. The memory 20 may mainly include a memory program area and a memory data area, where the memory program area may store an operating system, an application program required by at least one function (such as determining whether a historical personal maximum thread number exists in a thread occupation account), and the like; the storage data area may include a database, may store data or information created according to the use of the system, and the like. In addition, 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, performs various functions of the server and processes data by running 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 that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that 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 to connect with a power source to ensure normal operation of other components. Those skilled in the art will appreciate that the server architecture shown in fig. 3 is not limiting of the server and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The present 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 of fig. 3, or may be at least one of ROM (Read-Only Memory)/RAM (Random Access Memory ), magnetic disk, or optical disk, and the computer readable storage medium includes several instructions for causing 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 perform the method according to the embodiments of the present invention.
In the present invention, the terms "first", "second", "third", "fourth", "fifth" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance, and the specific meaning of the above terms in the present invention will be understood by those of ordinary skill in the art depending on the specific circumstances.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means 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 present invention. In this specification, schematic representations of the above terms are not necessarily directed 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, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, the scope of the present invention is not limited thereto, and it should be understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications and substitutions of the above embodiments may be made by those skilled in the art within the scope of the present invention, and are intended to be included in the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (5)

1. A method of thread allocation, the method comprising the steps of:
obtaining the maximum thread number of a server, and detecting the number of login accounts currently executing compiling operation;
taking the login account number as the thread occupation account number, and setting the personal maximum thread number which can be currently used by each login account according to the server maximum thread number and the thread occupation account number;
after the step of detecting the number of login accounts currently executing the compiling operation, the method further comprises the following steps:
judging whether the historical personal maximum thread number exists in the account occupied by the threads;
when there is no historical personal maximum thread number, executing the steps: taking the login account number as the thread occupation account number;
when the historical personal maximum thread number exists, judging whether the number of the login accounts obtained through detection is consistent with the number of the accounts occupied by the threads;
if the login account numbers are inconsistent, updating the thread occupation account numbers according to the detected login account numbers, and executing the steps: 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;
the step of obtaining the maximum thread number of the server comprises the following steps:
obtaining the maximum writing thread number of a server in the maximum thread number of the server;
the step of setting the number of login accounts as the number of thread occupation accounts and setting the maximum personal number of threads which can be used by each login account currently according to the maximum number of threads and the number of thread occupation accounts of the server comprises the following steps:
acquiring the number of written accounts which need to execute a writing command in the login account, and taking the number of written accounts as the number of accounts occupied by writing threads;
the result of dividing the maximum writing thread number and the account number occupied by the writing thread is used as the personal maximum writing thread number which can be currently used by each writing account;
the step of obtaining the number of the write account needing to execute the write command in the login account includes:
judging whether the written account has a history personal maximum written thread number or not;
when there is no historical personal maximum written thread number, executing the steps: taking the written account number as the account number occupied by the writing thread;
when the maximum writing thread number of the historical individuals exists, judging whether the acquired writing account number is consistent with the account number occupied by the writing thread;
if not, updating the account number occupied by the writing thread according to the acquired number of the writing accounts, and executing the steps of: the result of dividing the maximum writing thread number and the account number occupied by the writing thread is used as the personal maximum writing thread number which can be currently used by each writing account;
wherein the method further comprises:
detecting the number of single lines Cheng Zhanghu corresponding to the command waiting to be executed in the single threads;
obtaining the single-thread single-time maximum execution command number, dividing the single-time maximum execution command number by the single-thread Cheng Zhanghu number, and obtaining the average execution command number of each single-thread account;
taking the average execution command number as the individual single maximum execution command number of each single-threaded account;
the step of obtaining the single-thread single-time maximum execution command number comprises the following steps:
judging whether the number of the single-threaded accounts obtained through detection is consistent with the number of the single-threaded accounts in the single thread, which are executing commands;
when the number of detected single lines Cheng Zhanghu is consistent with the number of single-thread accounts executing the command, setting the maximum number of single-time executed commands of the individual corresponding to the number of single lines Cheng Zhanghu executing the command;
when the number of detected single lines Cheng Zhanghu is inconsistent with the number of single lines Cheng Zhanghu of the executing command, after determining that all the executing commands in the single thread are executed, executing the steps: dividing the single maximum execution command number by the single line Cheng Zhanghu number to obtain the average execution command number of each single-thread account.
2. The thread allocation method according to claim 1, wherein the step of setting the personal maximum number of threads currently usable by each login account according to the server maximum number of threads and the thread occupation account number comprises:
and dividing the maximum thread number of the server and the thread occupation account number to obtain the current personal maximum thread number of each login account.
3. The thread allocation method of claim 1, wherein the method further comprises:
when the number of detected single lines Cheng Zhanghu is smaller than the number of single-thread accounts in which the command is being executed, the cache corresponding to the reduced single line Cheng Zhanghu is released.
4. A server comprising a memory, a processor and a computer program stored on the memory and executable on the processor, which when executed by the processor implements the steps of the thread allocation method of any one of claims 1 to 3.
5. A computer readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, implements the steps of the thread allocation method according to any of claims 1 to 3.
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 CN111221535A (en) 2020-06-02
CN111221535B true 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)

Family Cites Families (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
US8219999B2 (en) * 2008-07-31 2012-07-10 International Business Machines Corporation System and method for determining a number of threads to maximize utilization of a system
CN101996067B (en) * 2009-08-19 2014-07-16 阿里巴巴集团控股有限公司 Data export method and device
CN107450978A (en) * 2016-05-31 2017-12-08 北京京东尚科信息技术有限公司 The thread management method and device of distributed system
CN108415767B (en) * 2018-03-07 2020-07-31 中国平安人寿保险股份有限公司 Server thread control method, device, equipment and readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
众核结构上线程级推测执行能力评估器设计;任永青等;《小型微型计算机系统》;1012-1016 *

Also Published As

Publication number Publication date
CN111221535A (en) 2020-06-02

Similar Documents

Publication Publication Date Title
KR102150774B1 (en) Method and apparatus for loading a terminal application
US9003381B2 (en) Context-specific optimized code
US11556348B2 (en) Bootstrapping profile-guided compilation and verification
CN102662740B (en) Asymmetric multi-core system and realization method thereof
US20180349193A1 (en) Streaming program execution method of intelligent terminal
CN111078323A (en) Coroutine-based data processing method and device, computer equipment and storage medium
US20170364449A1 (en) Process running method and apparatus
CN111104208A (en) Process scheduling management method and device, computer equipment and storage medium
US8954969B2 (en) File system object node management
CN111666210A (en) Chip verification method and device
CN103246568A (en) Mobile phone application priority setting method and device
CN107820605B (en) System and method for dynamic low-latency optimization
US8863060B2 (en) Programmable intelligent storage architecture based on application and business requirements
CN103488517A (en) PHP code compiling method and device and PHP code running method and device
CN111221535B (en) Thread allocation method, server and computer readable 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
CN109462663B (en) Method for limiting system resource occupation, voice interaction system and storage medium
KR101950485B1 (en) Task Management Method for Providing Real-time Performance to Android
CN113342376B (en) Method and device for upgrading operating system of Internet of things equipment
CN115934213A (en) Controller stack calling method, device, equipment and storage medium
US20090320036A1 (en) File System Object Node Management
CN110990018B (en) Compiling method and compiling system of embedded system
KR102456017B1 (en) Apparatus and method for file sharing between applications
US9489246B2 (en) Method and device for determining parallelism of tasks of a program

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