CN108710538A - A kind of thread configuration method, computer readable storage medium and terminal device - Google Patents
A kind of thread configuration method, computer readable storage medium and terminal device Download PDFInfo
- Publication number
- CN108710538A CN108710538A CN201810457038.XA CN201810457038A CN108710538A CN 108710538 A CN108710538 A CN 108710538A CN 201810457038 A CN201810457038 A CN 201810457038A CN 108710538 A CN108710538 A CN 108710538A
- Authority
- CN
- China
- Prior art keywords
- task
- thread
- configuration
- count
- handled
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Abstract
The invention belongs to a kind of field of computer technology more particularly to thread configuration method, computer readable storage medium and terminal devices.The method is when carrying out task processing, the general assignment number, task type and task process limited of pending task batch are obtained first, and the minimum task treatment effeciency completed needed for the pending task batch is determined according to the general assignment number and the task process limited, then thread configuration sublist corresponding with the task type is inquired in preset thread configuration table, and score number of passes is determined according to thread configuration sublist corresponding with the task type, the thread of the pending task batch is finally handled according to score number of passes configuration.Since the score number of passes is the minimum Thread Count met needed for the minimum task treatment effeciency, while ensureing treatment effeciency, and reduce unnecessary resource consumption.
Description
Technical field
The invention belongs to field of computer technology more particularly to a kind of thread configuration method, computer readable storage mediums
And terminal device.
Background technology
In multi-threaded system, thread is the independently operated base unit of energy, and independently dispatches and assign substantially single
Position.Existing multi-threaded system configures excessive Thread Count sometimes during processing task, so as to cause the wave of resource
Take, can configure very few Thread Count again sometimes, it is low so as to cause the treatment effeciency of task, it tends to be difficult to be closed for the task of processing
Reason configures enough Thread Counts.
Invention content
In view of this, an embodiment of the present invention provides a kind of thread configuration method, computer readable storage medium and terminals
Equipment, to solve the problems, such as the enough Thread Counts of the task reasonable disposition for being difficult for processing in the prior art.
The first aspect of the embodiment of the present invention provides a kind of thread configuration method, may include:
Obtain the general assignment number, task type and task process limited of pending task batch;
It is determined and is completed needed for the pending task batch according to the general assignment number and the task process limited
Minimum task treatment effeciency;
Thread configuration sublist corresponding with the task type, the thread configuration are inquired in preset thread configuration table
Table includes matching for recording various threads with the one-to-one thread configuration sublist of various task types, the thread configuration sublist
Task treatment effeciency under the conditions of setting;
Score number of passes is determined according to thread configuration sublist corresponding with the task type, and the score number of passes is full
Minimum Thread Count needed for the foot minimum task treatment effeciency;
The thread of the pending task batch is handled according to score number of passes configuration.
The second aspect of the embodiment of the present invention provides a kind of computer readable storage medium, the computer-readable storage
Media storage has computer-readable instruction, the computer-readable instruction to realize following steps when being executed by processor:
Obtain the general assignment number, task type and task process limited of pending task batch;
It is determined and is completed needed for the pending task batch according to the general assignment number and the task process limited
Minimum task treatment effeciency;
Thread configuration sublist corresponding with the task type, the thread configuration are inquired in preset thread configuration table
Table includes matching for recording various threads with the one-to-one thread configuration sublist of various task types, the thread configuration sublist
Task treatment effeciency under the conditions of setting;
Score number of passes is determined according to thread configuration sublist corresponding with the task type, and the score number of passes is full
Minimum Thread Count needed for the foot minimum task treatment effeciency;
The thread of the pending task batch is handled according to score number of passes configuration.
The third aspect of the embodiment of the present invention provide a kind of thread configuration terminal device, including memory, processor with
And it is stored in the computer-readable instruction that can be run in the memory and on the processor, described in the processor execution
Following steps are realized when computer-readable instruction:
Obtain the general assignment number, task type and task process limited of pending task batch;
It is determined and is completed needed for the pending task batch according to the general assignment number and the task process limited
Minimum task treatment effeciency;
Thread configuration sublist corresponding with the task type, the thread configuration are inquired in preset thread configuration table
Table includes matching for recording various threads with the one-to-one thread configuration sublist of various task types, the thread configuration sublist
Task treatment effeciency under the conditions of setting;
Score number of passes is determined according to thread configuration sublist corresponding with the task type, and the score number of passes is full
Minimum Thread Count needed for the foot minimum task treatment effeciency;
The thread of the pending task batch is handled according to score number of passes configuration.
Existing advantageous effect is the embodiment of the present invention compared with prior art:The embodiment of the present invention pre-sets thread
Allocation list includes matching with the one-to-one thread configuration sublist of various task types, the thread in the thread configuration table
Sublist is set for recording task treatment effeciency under the conditions of various thread configurations, to for rationally progress thread configuration provide according to
According to when carrying out task processing, when obtaining general assignment number, task type and the task processing of pending task batch first
Limit, and it is minimum needed for the general assignment number and the task process limited determination completion pending task batch
Then task treatment effeciency inquires thread configuration sublist corresponding with the task type in preset thread configuration table, and
Score number of passes is determined according to thread configuration sublist corresponding with the task type, is finally configured according to the score number of passes
Handle the thread of the pending task batch.By the score number of passes to meet the minimum task treatment effeciency institute
The minimum Thread Count needed, while ensureing treatment effeciency, and reduces unnecessary resource consumption.
Description of the drawings
It to describe the technical solutions in the embodiments of the present invention more clearly, below will be to embodiment or description of the prior art
Needed in attached drawing be briefly described, it should be apparent that, the accompanying drawings in the following description be only the present invention some
Embodiment for those of ordinary skill in the art without having to pay creative labor, can also be according to these
Attached drawing obtains other attached drawings.
Fig. 1 is a kind of one embodiment flow chart of thread configuration method in the embodiment of the present invention;
Fig. 2 is the schematic flow diagram of the setting up procedure of thread allocation list of the embodiment of the present invention;
Fig. 3 is a kind of one embodiment structure chart of thread configuration device in the embodiment of the present invention;
Fig. 4 is a kind of schematic block diagram of thread configuration terminal device in the embodiment of the present invention.
Specific implementation mode
In order to make the invention's purpose, features and advantages of the invention more obvious and easy to understand, below in conjunction with the present invention
Attached drawing in embodiment, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that disclosed below
Embodiment be only a part of the embodiment of the present invention, and not all embodiment.Based on the embodiments of the present invention, this field
All other embodiment that those of ordinary skill is obtained without making creative work, belongs to protection of the present invention
Range.
Referring to Fig. 1, a kind of one embodiment of thread configuration method may include in the embodiment of the present invention:
Step S101, general assignment number, task type and the task process limited of pending task batch are obtained.
In the present embodiment, task is divided into and calculates the several task types such as type, storage class, communication type.Together
The task task type having the same of one task batch.
Step S102, it is determined according to the general assignment number and the task process limited and completes the pending task batch
Secondary required minimum task treatment effeciency.
Specifically, the minimum task treatment effeciency can be calculated according to the following formula:
Wherein, TotalNum is the general assignment number, and LimitTime is the task process limited, EfficminIt is described
Minimum task treatment effeciency.
Step S103, thread configuration sublist corresponding with the task type is inquired in preset thread configuration table.
The thread configuration table includes and the one-to-one thread configuration sublist of various task types, the thread configuration are sub
Table is used to record the task treatment effeciency under the conditions of various thread configurations.
As shown in Fig. 2, the setting up procedure of the thread configuration table may include:
Step S201, any one task type that thread configuration sublist was not yet set is chosen from various task types
As current test-types.
In the present embodiment, it can be that a flag is arranged in each task type, be for identifying the task type
It is no that thread configuration sublist had been set.When the flag value is 0, indicate that thread configuration was not yet arranged in the task type
Table indicates that thread configuration sublist had been arranged in the task type when the flag value is 1.
Step S202, preset count value is initialized.
In the present embodiment, the count value is denoted as Count, then its initialization procedure can be denoted as:Count=0.
Step S203, the Thread Count of configuration is gradually incremented to preset second Thread Count from preset First Line number of passes,
And it calculates separately the first task handled the task of the current task type under the conditions of various thread configurations and handles
Efficiency.
The First Line number of passes is the minimum Thread Count that can configure, and usually, the First Line number of passes is 1.Described second
Thread Count is the maximum thread that can configure, and specific determination process will elaborate in subsequent content, and details are not described herein again.
Specifically, can calculate according to the following formula task under the conditions of various thread configurations to the current task type into
The first task treatment effeciency of row processing:
Or
Wherein, m is the serial number of the current task type, and 1≤m≤M, M are the sum of task type, and n is the line of configuration
Number of passes, Nmin≤n≤Nmax, NminFor the First Line number of passes, NmaxFor second Thread Count, IncTaskNumm,nFor when configuration
Thread Count when being n, the task number of the task type of serial number m handled within the preset task processing period, RunTime is
The task handles the period, and η is preset proportionality coefficient, and 0<η<1, RunTime ' are the period of the day from 11 p.m. to 1 a.m in the task processing period
Section, and RunTime '=(1- η) × RunTime, IncTaskNum 'm,nFor when the Thread Count of configuration is n, in the sub-period
The task number of the task type of the serial number m of interior processing, IncEfficm,nWhen the Thread Count of configuration is n, to appoint to serial number m
The first task treatment effeciency that the task of service type is handled.
The introducing of η is allowed for when carrying out Thread Count change, will produce certain data fluctuations, and knot is calculated in order to improve
The accuracy of fruit, in calculating process, a period of time that the task can be handled to period beginning is not counted in statistics, and η is not
The initial time section for being included in statistics accounts for the ratio of the entire task processing period, can be 10% according to actual conditions value,
15%, 20% etc., if for example, the task processing period be 10 minutes, coprocessing type-A task 100, then according to the first
Algorithm, task treatment effeciency are 10, it is contemplated that data fluctuations are larger in the starting 2 minutes of Thread Count change, are disregarded
Enter statistics, i.e. η=20%, and at latter 8 minutes, coprocessing type-A number of tasks 88, then according to second algorithm, at task
It is 11 to manage efficiency.
Step S204, the Thread Count of configuration is gradually decremented to the First Line number of passes from second Thread Count, and divided
The the second task treatment effeciency handled the task of the current task type under the conditions of various thread configurations is not calculated;
Specifically, can calculate according to the following formula task under the conditions of various thread configurations to the current task type into
Second task treatment effeciency of row processing:
Or
Wherein, DecTaskNumm,nFor the sequence when the Thread Count of configuration is n, handled within the preset task processing period
The task number of the task type of number m, DecTaskNum 'm,nWhen the Thread Count of configuration is n, to be handled in the sub-period
Serial number m task type task number, DecEfficm,nFor when the Thread Count of configuration is n, to the task type of serial number m
The second task treatment effeciency for being handled of task.
The setting up procedure of second Thread Count may include:
The N of the following conditions will be metmaxValue is set as second Thread Count:
Alternatively, the N that the following conditions will be metmaxValue is set as second Thread Count:
It should be noted that second Thread Count why is arranged, be due between Thread Count and processing number of tasks simultaneously
It is not necessarily positively related relationship, i.e., not necessarily Thread Count is more, and processing number of tasks is also more.Since the switching of cross-thread also can
Elapsed time and resource, after Thread Count is more than a certain range, processing number of tasks can may decline instead, therefore, in we
In case, in order to save the testing time, do not need to all traverse number of tasks, but only that by number of tasks in First Line
It is traversed between number of passes and the second Thread Count.
Step S205, the count value is increased into a digit.
That is Count=Count+1.
Step S206, judge whether the count value is less than preset count threshold.
The count threshold can be set as 10,20,50,100 etc. according to actual conditions.
If the count value is less than the count threshold, S203 and its subsequent step are returned to step, if the meter
Numerical value is equal to the count threshold, thens follow the steps S207 and its subsequent step.
Step S207, it calculates separately and the task of the current test-types is handled under the conditions of various thread configurations
Average task treatment effeciency
Specifically, it can calculate separately and the current test-types are appointed according to the following formula under the conditions of various thread configurations
The average task treatment effeciency that business is handled:
Wherein, t is the count value, and 1≤t≤T, T are the count threshold,It is t to work as count value, configuration
Thread Count when being n, to the first task treatment effeciency that the task of the task type of serial number m is handled,To work as
When count value is t, the Thread Count of configuration is n, the second task handled the task of the task type of serial number m handles effect
Rate, AveEfficm,nFor the average task when the Thread Count of configuration is n, handled the task of the task type of serial number m
Treatment effeciency.
Step S208, flat according to being handled the task of the current test-types under the conditions of various thread configurations
Thread configuration sublist corresponding with the current task type is arranged in equal task treatment effeciency.
For example, can following form be denoted as the thread configuration sublist:
Step S209, judge whether thread configuration sublist corresponding with various task types has been set.
If it is not, S201 and its subsequent step are then returned to step, until thread configuration corresponding with various task types
Until sublist has been set, if so, thening follow the steps S210.
Step S210, the configuration that the thread configuration table is completed is determined.
In the present embodiment, the thread configuration table is preferably recorded as following form:
By above procedure, the thread configuration table examined by actual test has been obtained, has been matched for the follow-up thread that rationally carries out
It sets and provides foundation.
Step S104, score number of passes is determined according to thread configuration sublist corresponding with the task type.
The score number of passes is the minimum Thread Count met needed for the minimum task treatment effeciency.It specifically, can be with
According to thread configuration sublist corresponding with the task type, the N of the following conditions will be metmValue is determined as the subject thread
Number:
Wherein, EfficminFor the minimum task treatment effeciency.
Step S105, the thread of the pending task batch is handled according to score number of passes configuration.
Since the score number of passes is the minimum Thread Count met needed for the minimum task treatment effeciency, at guarantee
While managing efficiency, and reduce unnecessary resource consumption.
In conclusion the embodiment of the present invention pre-sets thread configuration table, the thread configuration table include with respectively
The kind one-to-one thread configuration sublist of task type, the thread configuration sublist are used to record under the conditions of various thread configurations
Task treatment effeciency, when carrying out task processing, obtains pending first to provide foundation rationally to carry out thread configuration
Task batch general assignment number, task type and task process limited, and according to the general assignment number and the task at
The minimum task treatment effeciency needed for the time limit determination completion pending task batch is managed, then in preset thread configuration
Thread configuration sublist corresponding with the task type is inquired in table, and according to thread configuration corresponding with task type
Table determines score number of passes, and the thread of the pending task batch is finally handled according to score number of passes configuration.By
It is the minimum Thread Count met needed for the minimum task treatment effeciency in the score number of passes, is ensureing the same for the treatment of effeciency
When, and reduce unnecessary resource consumption.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each process
Execution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limit
It is fixed.
Corresponding to a kind of thread configuration method described in foregoing embodiments, Fig. 3 shows provided in an embodiment of the present invention one
One embodiment structure chart of kind thread configuration device.
In the present embodiment, a kind of thread configuration device may include:
Mission bit stream acquisition module 301, for obtaining the general assignment number of pending task batch, task type and appointing
It is engaged in the process limited;
Minimum task treatment effeciency computing module 302, for true according to the general assignment number and the task process limited
Surely the minimum task treatment effeciency needed for the pending task batch is completed;
Thread configuration sublist enquiry module 303, for the inquiry in preset thread configuration table and the task type pair
The thread configuration sublist answered, the thread configuration table include with the one-to-one thread configuration sublist of various task types, it is described
Thread configuration sublist is used to record the task treatment effeciency under the conditions of various thread configurations;
Score number of passes determining module 304, for determining mesh according to thread configuration sublist corresponding with the task type
Graticule number of passes, the score number of passes are the minimum Thread Count met needed for the minimum task treatment effeciency;
Thread configuration module 305, for handling the pending task batch according to score number of passes configuration
Thread.
Further, the thread configuration device can also include:
Current test-types choose module, and thread, which was not yet arranged, for choosing any one from various task types matches
The task type of sublist is set as current test-types;
Count value initialization module, for initializing preset count value;
First task treatment effeciency computing module, the Thread Count for that will configure gradually are incremented by from preset First Line number of passes
To preset second Thread Count, and calculates separately task under the conditions of various thread configurations to the current task type and carry out
The first task treatment effeciency of processing, the First Line number of passes are the minimum Thread Count that can configure, and second Thread Count is can
The maximum thread of configuration;
Second task treatment effeciency computing module, for the Thread Count of configuration to be gradually decremented to from second Thread Count
The First Line number of passes, and calculate separately and the task of the current task type is handled under the conditions of various thread configurations
The second task treatment effeciency;
Count value increases module, for the count value to be increased a digit, and whether judges the count value
Less than preset count threshold;
Average task treatment effeciency computing module, if being equal to the count threshold for the count value, according to the following formula
It calculates separately the average task handled the task of the current test-types under the conditions of various thread configurations and handles effect
Rate:
Wherein, m is the serial number of the current task type, and 1≤m≤M, M are the sum of task type, and n is the line of configuration
Number of passes, Nmin≤n≤Nmax, NminFor the First Line number of passes, NmaxFor second Thread Count, t is the count value, 1≤t≤
T, T are the count threshold,For when count value is t, the Thread Count of configuration is n, to the task type of serial number m
The first task treatment effeciency that is handled of task,It is right for when count value is t, the Thread Count of configuration is n
The second task treatment effeciency that the task of the task type of serial number m is handled, AveEfficm,nThread Count to work as configuration is n
When, average task treatment effeciency that the task of the task type of serial number m is handled;
Thread configuration sublist setup module, for basis to the current test-types under the conditions of various thread configurations
Thread configuration sublist corresponding with the current task type is arranged in the average task treatment effeciency that task is handled.
Further, the first task treatment effeciency computing module may include:
First computing unit, for calculating according to the following formula under the conditions of various thread configurations to the current task type
The first task treatment effeciency that task is handled:
Or
Wherein, IncTaskNumm,nFor the sequence when the Thread Count of configuration is n, handled within the preset task processing period
The task number of the task type of number m, RunTime are that the task handles the period, and η is preset proportionality coefficient, and 0<η<1,
RunTime ' handles the sub-period in the period, and RunTime '=(1- η) × RunTime, IncTaskNum ' for the taskm,n
For when the Thread Count of configuration is n, the task number of the task type of the serial number m handled in the sub-period,
IncEfficm,nFor when the Thread Count of configuration is n, the first task handled the task of the task type of serial number m is handled
Efficiency;
Further, the second task treatment effeciency computing module may include:
Second computing unit, for calculating according to the following formula under the conditions of various thread configurations to the current task type
The second task treatment effeciency that task is handled:
Or
Wherein, DecTaskNumm,nFor the sequence when the Thread Count of configuration is n, handled within the preset task processing period
The task number of the task type of number m, DecTaskNum 'm,nWhen the Thread Count of configuration is n, to be handled in the sub-period
Serial number m task type task number, DecEfficm,nFor when the Thread Count of configuration is n, to the task type of serial number m
The second task treatment effeciency for being handled of task.
Further, the thread configuration device can also include:
First setup module, the N for the following conditions will to be metmaxValue is set as second Thread Count:
Or
Second setup module, the N for the following conditions will to be metmaxValue is set as second Thread Count:
Further, the score number of passes determining module may include:
Score number of passes determination unit, for according to thread configuration sublist corresponding with the task type, will meet with
The N of lower conditionmValue is determined as the score number of passes:
Wherein, EfficminFor the minimum task treatment effeciency.
It is apparent to those skilled in the art that for convenience and simplicity of description, the device of foregoing description,
The specific work process of module and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in detail or remembers in some embodiment
The part of load may refer to the associated description of other embodiments.
Fig. 4 shows a kind of schematic block diagram of thread configuration terminal device provided in an embodiment of the present invention, for the ease of saying
It is bright, it illustrates only and the relevant part of the embodiment of the present invention.
In the present embodiment, the thread configuration terminal device 4 can be desktop PC, notebook, palm PC
And the computing devices such as cloud server.The thread configuration terminal device 4 may include:It processor 40, memory 41 and is stored in
In the memory 41 and the computer-readable instruction 42 that can be run on the processor 40, such as executes above-mentioned thread and match
Set the computer-readable instruction of method.The processor 40 realizes above-mentioned each thread when executing the computer-readable instruction 42
Step in configuration method embodiment, such as step S101 to S105 shown in FIG. 1.Alternatively, the processor 40 execute it is described
The function of each module/unit in above-mentioned each device embodiment, such as module 301 shown in Fig. 3 are realized when computer-readable instruction 42
To 305 function.
Illustratively, the computer-readable instruction 42 can be divided into one or more module/units, one
Or multiple module/units are stored in the memory 41, and executed by the processor 40, to complete the present invention.Institute
It can be the series of computation machine readable instruction section that can complete specific function, the instruction segment to state one or more module/units
For describing implementation procedure of the computer-readable instruction 42 in the thread configuration terminal device 4.
The processor 40 can be central processing unit (Central Processing Unit, CPU), can also be
Other general processors, digital signal processor (Digital Signal Processor, DSP), application-specific integrated circuit
(Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor can also be any conventional processor
Deng.
The memory 41 can be the internal storage unit of the thread configuration terminal device 4, such as thread configuration end
The hard disk or memory of end equipment 4.The memory 41 can also be the External memory equipment of the thread configuration terminal device 4,
Such as the plug-in type hard disk being equipped on the thread configuration terminal device 4, intelligent memory card (Smart Media Card, SMC),
Secure digital (Secure Digital, SD) blocks, flash card (Flash Card) etc..Further, the memory 41 may be used also
With both include the thread configuration terminal device 4 internal storage unit and also including External memory equipment.The memory 41 is used
In other instruction and datas needed for the storage computer-readable instruction and the thread configuration terminal device 4.It is described to deposit
Reservoir 41 can be also used for temporarily storing the data that has exported or will export.
Each functional unit in each embodiment of the present invention can be integrated in a processing unit, can also be each
Unit physically exists alone, can also be during two or more units are integrated in one unit.Above-mentioned integrated unit both may be used
It realizes, can also be realized in the form of SFU software functional unit in the form of using hardware.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product
When, it can be stored in a computer readable storage medium.Based on this understanding, technical scheme of the present invention substantially or
Person says that all or part of the part that contributes to existing technology or the technical solution can body in the form of software products
Reveal and, which is stored in a storage medium, including several computer-readable instructions are used so that one
Platform computer equipment (can be personal computer, server or the network equipment etc.) executes described in each embodiment of the present invention
The all or part of step of method.And storage medium above-mentioned includes:USB flash disk, mobile hard disk, read-only memory (ROM, Read-
Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD etc. are various can be with
Store the medium of computer-readable instruction.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although with reference to aforementioned reality
Applying example, invention is explained in detail, it will be understood by those of ordinary skill in the art that:It still can be to aforementioned each
Technical solution recorded in embodiment is modified or equivalent replacement of some of the technical features;And these are changed
Or it replaces, the spirit and scope for various embodiments of the present invention technical solution that it does not separate the essence of the corresponding technical solution.
Claims (10)
1. a kind of thread configuration method, which is characterized in that including:
Obtain the general assignment number, task type and task process limited of pending task batch;
It is determined according to the general assignment number and the task process limited minimum needed for the completion pending task batch
Task treatment effeciency;
Thread configuration sublist corresponding with the task type, the thread configuration table packet are inquired in preset thread configuration table
It includes and is used to record various thread configuration items with the one-to-one thread configuration sublist of various task types, the thread configuration sublist
Task treatment effeciency under part;
Score number of passes is determined according to thread configuration sublist corresponding with the task type, and the score number of passes is meets
State the minimum Thread Count needed for minimum task treatment effeciency;
The thread of the pending task batch is handled according to score number of passes configuration.
2. thread configuration method according to claim 1, which is characterized in that the setting up procedure packet of the thread configuration table
It includes:
The task type that thread configuration sublist was not yet arranged in any one is chosen from various task types to test as current
Type;
Initialize preset count value;
The Thread Count of configuration is gradually incremented to preset second Thread Count from preset First Line number of passes, and is calculated separately each
The first task treatment effeciency that the task of the current task type is handled under the conditions of kind thread configuration, the First Line
Number of passes is the minimum Thread Count that can configure, and second Thread Count is the maximum thread that can configure;
The Thread Count of configuration is gradually decremented to the First Line number of passes from second Thread Count, and is calculated separately in various lines
The second task treatment effeciency that the task of the current task type is handled under journey configuration condition;
The count value is increased into a digit, and judges whether the count value is less than preset count threshold;
If the count value is less than the count threshold, returns and execute the Thread Count by configuration from preset first thread
The step of number is gradually incremented to preset second Thread Count;
If the count value is equal to the count threshold, calculate separately according to the following formula under the conditions of various thread configurations to described
The average task treatment effeciency that the task of current test-types is handled:
Wherein, m is the serial number of the current task type, and 1≤m≤M, M are the sum of task type, and n is the Thread Count of configuration,
Nmin≤n≤Nmax, NminFor the First Line number of passes, NmaxFor second Thread Count, t is the count value, and 1≤t≤T, T are
The count threshold,For when count value is t, the Thread Count of configuration is n, to the task of the task type of serial number m
The first task treatment effeciency handled,For when count value is t, the Thread Count of configuration is n, to serial number m's
The second task treatment effeciency that the task of task type is handled, AveEfficm,nFor when the Thread Count of configuration is n, to sequence
The average task treatment effeciency that the task of the task type of number m is handled;
Effect is handled according to the average task handled the task of the current test-types under the conditions of various thread configurations
Thread configuration sublist corresponding with the current task type is arranged in rate;
It returns and chooses any one task type that thread configuration sublist was not yet set from various task types described in executing
The step of as current test-types, until thread configuration sublist corresponding with various task types has been set.
3. thread configuration method according to claim 2, which is characterized in that described to calculate separately in various thread configuration items
The first task treatment effeciency handled the task of the current task type under part includes:
Calculate according to the following formula the task of the current task type is handled under the conditions of various thread configurations it is first
Business treatment effeciency:
Or
Wherein, IncTaskNumm,nFor the serial number m when the Thread Count of configuration is n, handled within the preset task processing period
Task type task number, RunTime is that the task handles the period, and η is preset proportionality coefficient, and 0<η<1,
RunTime ' handles the sub-period in the period, and RunTime '=(1- η) × RunTime, IncTaskNum ' for the taskm,n
For when the Thread Count of configuration is n, the task number of the task type of the serial number m handled in the sub-period,
IncEfficm,nFor when the Thread Count of configuration is n, the first task handled the task of the task type of serial number m is handled
Efficiency;
It is described to calculate separately second handled the task of the current task type under the conditions of various thread configurations
Business treatment effeciency include:
Second handled the task of the current task type under the conditions of various thread configurations is calculated according to the following formula
Business treatment effeciency:
Or
Wherein, DecTaskNumm,nFor the serial number m when the Thread Count of configuration is n, handled within the preset task processing period
Task type task number, DecTaskNum 'm,nWhen the Thread Count of configuration is n, to be handled in the sub-period
The task number of the task type of serial number m, DecEfficm,nFor when the Thread Count of configuration is n, to the task type of serial number m
The second task treatment effeciency that task is handled.
4. thread configuration method according to claim 2, which is characterized in that the setting up procedure packet of second Thread Count
It includes:
The N of the following conditions will be metmaxValue is set as second Thread Count:
Alternatively, the N that the following conditions will be metmaxValue is set as second Thread Count:
5. thread configuration method according to any one of claim 2 to 4, which is characterized in that the basis with described
The corresponding thread configuration sublist of service type determines that score number of passes includes:
According to thread configuration sublist corresponding with the task type, the N of the following conditions will be metmValue is determined as the target
Thread Count:
Wherein, EfficminFor the minimum task treatment effeciency.
6. a kind of computer readable storage medium, the computer-readable recording medium storage has computer-readable instruction, special
Sign is, realizes that the thread as described in any one of claim 1 to 5 is matched when the computer-readable instruction is executed by processor
The step of setting method.
7. a kind of thread configuration terminal device, including memory, processor and it is stored in the memory and can be described
The computer-readable instruction run on processor, which is characterized in that the processor executes real when the computer-readable instruction
Existing following steps:
Obtain the general assignment number, task type and task process limited of pending task batch;
It is determined according to the general assignment number and the task process limited minimum needed for the completion pending task batch
Task treatment effeciency;
Thread configuration sublist corresponding with the task type, the thread configuration table packet are inquired in preset thread configuration table
It includes and is used to record various thread configuration items with the one-to-one thread configuration sublist of various task types, the thread configuration sublist
Task treatment effeciency under part;
Score number of passes is determined according to thread configuration sublist corresponding with the task type, and the score number of passes is meets
State the minimum Thread Count needed for minimum task treatment effeciency;
The thread of the pending task batch is handled according to score number of passes configuration.
8. thread configuration terminal device according to claim 7, which is characterized in that the setting up procedure of the thread configuration table
Including:
The task type that thread configuration sublist was not yet arranged in any one is chosen from various task types to test as current
Type;
Initialize preset count value;
The Thread Count of configuration is gradually incremented to preset second Thread Count from preset First Line number of passes, and is calculated separately each
The first task treatment effeciency that the task of the current task type is handled under the conditions of kind thread configuration, the First Line
Number of passes is the minimum Thread Count that can configure, and second Thread Count is the maximum thread that can configure;
The Thread Count of configuration is gradually decremented to the First Line number of passes from second Thread Count, and is calculated separately in various lines
The second task treatment effeciency that the task of the current task type is handled under journey configuration condition;
The count value is increased into a digit, and judges whether the count value is less than preset count threshold;
If the count value is less than the count threshold, returns and execute the Thread Count by configuration from preset first thread
The step of number is gradually incremented to preset second Thread Count;
If the count value is equal to the count threshold, calculate separately according to the following formula under the conditions of various thread configurations to described
The average task treatment effeciency that the task of current test-types is handled:
Wherein, m is the serial number of the current task type, and 1≤m≤M, M are the sum of task type, and n is the Thread Count of configuration,
Nmin≤n≤Nmax, NminFor the First Line number of passes, NmaxFor second Thread Count, t is the count value, and 1≤t≤T, T are
The count threshold,For when count value is t, the Thread Count of configuration is n, to the task of the task type of serial number m
The first task treatment effeciency handled,For when count value is t, the Thread Count of configuration is n, to serial number m's
The second task treatment effeciency that the task of task type is handled, AveEfficm,nFor when the Thread Count of configuration is n, to sequence
The average task treatment effeciency that the task of the task type of number m is handled;
Effect is handled according to the average task handled the task of the current test-types under the conditions of various thread configurations
Thread configuration sublist corresponding with the current task type is arranged in rate;
It returns and chooses any one task type that thread configuration sublist was not yet set from various task types described in executing
The step of as current test-types, until thread configuration sublist corresponding with various task types has been set.
9. thread configuration terminal device according to claim 8, which is characterized in that described calculate separately is matched in various threads
The first task treatment effeciency handled the task of the current task type under the conditions of setting includes:
Calculate according to the following formula the task of the current task type is handled under the conditions of various thread configurations it is first
Business treatment effeciency:
Or
Wherein, IncTaskNumm,nFor the serial number m when the Thread Count of configuration is n, handled within the preset task processing period
Task type task number, RunTime is that the task handles the period, and η is preset proportionality coefficient, and 0<η<1,
RunTime ' handles the sub-period in the period, and RunTime '=(1- η) × RunTime, IncTaskNum ' for the taskm,n
For when the Thread Count of configuration is n, the task number of the task type of the serial number m handled in the sub-period,
IncEfficm,nFor when the Thread Count of configuration is n, the first task handled the task of the task type of serial number m is handled
Efficiency;
It is described to calculate separately second handled the task of the current task type under the conditions of various thread configurations
Business treatment effeciency include:
Second handled the task of the current task type under the conditions of various thread configurations is calculated according to the following formula
Business treatment effeciency:
Or
Wherein, DecTaskNumm,nFor the serial number m when the Thread Count of configuration is n, handled within the preset task processing period
Task type task number, DecTaskNum 'm,nWhen the Thread Count of configuration is n, to be handled in the sub-period
The task number of the task type of serial number m, DecEfficm,nFor when the Thread Count of configuration is n, to the task type of serial number m
The second task treatment effeciency that task is handled.
10. thread configuration terminal device according to claim 8, which is characterized in that the setting of second Thread Count
Journey includes:
The N of the following conditions will be metmaxValue is set as second Thread Count:
Alternatively, the N that the following conditions will be metmaxValue is set as second Thread Count:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810457038.XA CN108710538B (en) | 2018-05-14 | 2018-05-14 | Thread configuration method, computer readable storage medium and terminal equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810457038.XA CN108710538B (en) | 2018-05-14 | 2018-05-14 | Thread configuration method, computer readable storage medium and terminal equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108710538A true CN108710538A (en) | 2018-10-26 |
CN108710538B CN108710538B (en) | 2023-06-02 |
Family
ID=63868091
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810457038.XA Active CN108710538B (en) | 2018-05-14 | 2018-05-14 | Thread configuration method, computer readable storage medium and terminal equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108710538B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109976891A (en) * | 2019-03-28 | 2019-07-05 | 北京网聘咨询有限公司 | The server task processing method of task based access control thread configuration |
CN113703933A (en) * | 2020-05-22 | 2021-11-26 | 北京沃东天骏信息技术有限公司 | Task processing method and device |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020124196A1 (en) * | 2001-01-05 | 2002-09-05 | Morrow Lewis A. | Computer system having low energy consumption |
WO2010145429A1 (en) * | 2009-06-30 | 2010-12-23 | 中兴通讯股份有限公司 | Method and system for managing thread pool |
CN102662765A (en) * | 2012-04-28 | 2012-09-12 | 中国科学技术大学 | Resource distribution method for running efficiency instructed reconfigurable chip multiprocessor |
US20140089935A1 (en) * | 2011-05-19 | 2014-03-27 | Nec Corporation | Parallel processing device, parallel processing method, optimization device, optimization method and computer program |
US9910704B1 (en) * | 2016-12-01 | 2018-03-06 | International Business Machines Corporation | Run time task scheduling based on metrics calculated by micro code engine in a socket |
CN107832126A (en) * | 2017-10-20 | 2018-03-23 | 平安科技(深圳)有限公司 | The method of adjustment and its terminal of a kind of thread |
-
2018
- 2018-05-14 CN CN201810457038.XA patent/CN108710538B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020124196A1 (en) * | 2001-01-05 | 2002-09-05 | Morrow Lewis A. | Computer system having low energy consumption |
WO2010145429A1 (en) * | 2009-06-30 | 2010-12-23 | 中兴通讯股份有限公司 | Method and system for managing thread pool |
US20140089935A1 (en) * | 2011-05-19 | 2014-03-27 | Nec Corporation | Parallel processing device, parallel processing method, optimization device, optimization method and computer program |
CN102662765A (en) * | 2012-04-28 | 2012-09-12 | 中国科学技术大学 | Resource distribution method for running efficiency instructed reconfigurable chip multiprocessor |
US9910704B1 (en) * | 2016-12-01 | 2018-03-06 | International Business Machines Corporation | Run time task scheduling based on metrics calculated by micro code engine in a socket |
CN107832126A (en) * | 2017-10-20 | 2018-03-23 | 平安科技(深圳)有限公司 | The method of adjustment and its terminal of a kind of thread |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109976891A (en) * | 2019-03-28 | 2019-07-05 | 北京网聘咨询有限公司 | The server task processing method of task based access control thread configuration |
CN109976891B (en) * | 2019-03-28 | 2020-11-03 | 北京网聘咨询有限公司 | Server task processing method based on task thread configuration |
CN113703933A (en) * | 2020-05-22 | 2021-11-26 | 北京沃东天骏信息技术有限公司 | Task processing method and device |
Also Published As
Publication number | Publication date |
---|---|
CN108710538B (en) | 2023-06-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108446176A (en) | A kind of method for allocating tasks, computer readable storage medium and terminal device | |
CN107526645B (en) | A kind of communication optimization method and system | |
CN108549583A (en) | Big data processing method, device, server and readable storage medium storing program for executing | |
CN104461737B (en) | A kind of EMS memory management process and device | |
CN106502918B (en) | A kind of scheduling memory method and device | |
CN115880132B (en) | Graphics processor, matrix multiplication task processing method, device and storage medium | |
CN107784070A (en) | A kind of method, apparatus and equipment for improving data cleansing efficiency | |
WO2023051505A1 (en) | Job solving method and apparatus | |
CN107728878A (en) | Display methods, terminal and the computer-readable recording medium of application icon | |
CN110505165A (en) | A kind of edge calculations task discharging method and device based on two way auction mechanism | |
CN109343972A (en) | Task processing method and terminal device | |
CN109783232A (en) | Video data handling procedure, device and storage medium | |
CN111984400A (en) | Memory allocation method and device of neural network | |
CN108334408A (en) | code execution method, device, terminal device and computer readable storage medium | |
CN109583890A (en) | Recognition methods, device and the equipment of abnormal trading object | |
CN110428139A (en) | The information forecasting method and device propagated based on label | |
CN108710538A (en) | A kind of thread configuration method, computer readable storage medium and terminal device | |
CN109062936A (en) | A kind of data query method, computer readable storage medium and terminal device | |
CN110515734A (en) | The load processing method and device of data processing task | |
CN108830663B (en) | Electric power customer value evaluation method and system and terminal equipment | |
CN109582467A (en) | Processing method, system and the relevant apparatus of I/O request in a kind of storage system | |
CN107528969A (en) | Management method, managing device and the terminal device of telephone call time | |
CN108304980A (en) | Sorter and piece supplying table stand-by period configuration method and system | |
CN106484879B (en) | A kind of polymerization of the Map end data based on MapReduce | |
CN109063926A (en) | Plan generated energy determines method, system and terminal device in period |
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 |