CN105824691B - The method and device of dynamic regulation thread - Google Patents
The method and device of dynamic regulation thread Download PDFInfo
- Publication number
- CN105824691B CN105824691B CN201510009627.8A CN201510009627A CN105824691B CN 105824691 B CN105824691 B CN 105824691B CN 201510009627 A CN201510009627 A CN 201510009627A CN 105824691 B CN105824691 B CN 105824691B
- Authority
- CN
- China
- Prior art keywords
- data
- thread
- buffer zone
- buffered
- preset
- 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
Links
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
Abstract
The invention discloses a kind of methods of dynamic regulation thread, comprising the following steps: from input data file to be treated read preset quantity buffered data into preset data buffer zone;Current thread is monitored to the execution efficiency of buffered data in data buffer zone;The number of threads that buffered data in data buffer zone is executed based on the execution efficiency dynamic regulation.The invention also discloses a kind of devices of dynamic regulation thread.The present invention not only can guarantee the processing speed to data, but also be avoided that causes machine loading to aggravate because Thread Count is excessively high, realizes and has executed input data file to be treated in the case where systematic entirety can be unaffected with prestissimo.
Description
Technical field
The present invention relates to thread management technical field more particularly to a kind of method and devices of dynamic regulation thread.
Background technique
Currently, multi-thread concurrent technology has large-scale use in more and more systems, though the use of multithreading
So without improving CPU efficiency, but greatly improve the interactivity and responsiveness of user.It is generally used in existing multi-threading
Fixed number of threads, when high-volume executes task, fixed number of threads is excessively high, will lead to machine loading aggravation, system
Overall performance is affected;Fixed number of threads is too low, can make concurrent Limited Number, efficiency is too low, not can guarantee to data
Faster processing speed.Therefore, number of threads is fixed in existing multi-threading can not be reasonable, efficient negative using machine
Systematic entirety energy is neither influenced under load, and can execute task with prestissimo.
Summary of the invention
The main purpose of the present invention is to provide a kind of method and devices of dynamic regulation thread, it is intended to which automatic dynamic is adjusted
Number of threads has executed task with prestissimo.
To achieve the above object, the method for a kind of dynamic regulation thread provided by the invention, the method includes following steps
It is rapid:
From in input data file to be treated read preset quantity buffered data into preset data buffer zone;
Current thread is monitored to the execution efficiency of buffered data in data buffer zone;
The number of threads that buffered data in data buffer zone is executed based on the execution efficiency dynamic regulation.
Preferably, the buffered data of preset quantity that reads from input data file to be treated is to preset number
Include: according to the step in buffer area
When the data volume in data buffer zone is less than preset remaining data threshold values, from input data text to be treated
The buffered data of preset quantity is read in part, and passes through a preset data buffering queue for the buffered data of the preset quantity of reading
It stores into data buffer zone.
Preferably, the monitoring current thread to including: the step of the execution efficiency of buffered data in data buffer zone
Current thread is monitored to remaining data volume in data buffer zone after buffered data execution in data buffer zone.
Preferably, the Thread Count that buffered data in data buffer zone is executed based on the execution efficiency dynamic regulation
Purpose step includes:
When data volume remaining in data buffer zone is greater than preset remaining data threshold values, increase current logarithmic according to buffering
The thread that buffered data executes in area, wherein setting is less than most to the number of threads that buffered data in data buffer zone executes
Big thread value;If the waiting time for the thread that buffered data in data buffer zone has been executed and has been waited for is more than pre-
The high latency first set then terminates the thread.
Preferably, the Thread Count that buffered data in data buffer zone is executed based on the execution efficiency dynamic regulation
Purpose step further include:
It is slow to data by waking up when data volume remaining in data buffer zone is greater than preset remaining data threshold values
Rush that buffered data in area has executed and the thread that is waited for or newly-built thread delay to increase current logarithmic according in buffer area
Rush the thread of data execution.
In addition, to achieve the above object, the present invention also provides a kind of device of dynamic regulation thread, described device includes:
Read module, for reading the buffered data of preset quantity from input data file to be treated to preset
In data buffer zone;
Monitoring modular, for monitoring current thread to the execution efficiency of buffered data in data buffer zone;
Dynamic regulation module, for what is executed based on the execution efficiency dynamic regulation to buffered data in data buffer zone
Number of threads.
Preferably, the read module is specifically used for:
When the data volume in data buffer zone is less than preset remaining data threshold values, from input data text to be treated
The buffered data of preset quantity is read in part, and passes through a preset data buffering queue for the buffered data of the preset quantity of reading
It stores into data buffer zone.
Preferably, the monitoring modular is specifically used for:
Current thread is monitored to remaining data volume in data buffer zone after buffered data execution in data buffer zone.
Preferably, the dynamic regulation module is specifically used for:
When data volume remaining in data buffer zone is greater than preset remaining data threshold values, increase current logarithmic according to buffering
The thread that buffered data executes in area, wherein setting is less than most to the number of threads that buffered data in data buffer zone executes
Big thread value;If the waiting time for the thread that buffered data in data buffer zone has been executed and has been waited for is more than pre-
The high latency first set then terminates the thread.
Preferably, the dynamic regulation module is also used to:
It is slow to data by waking up when data volume remaining in data buffer zone is greater than preset remaining data threshold values
Rush that buffered data in area has executed and the thread that is waited for or newly-built thread delay to increase current logarithmic according in buffer area
Rush the thread of data execution.
The method and device of a kind of dynamic regulation thread proposed by the present invention, using data buffer zone to be treated defeated
Enter to buffer the data of input in data file, and execution efficiency of the current thread to buffered data in data buffer zone is supervised
It surveys, to know that current thread, can be according to the processing speed dynamic regulation current logarithmic of current thread to the processing speed of data
According to the number of threads that buffered data in buffer area executes, the execution efficiency of data is moved by the current thread thus according to monitoring
State adjusts number of threads, not only can guarantee the processing speed to data, but also be avoided that causes machine loading to aggravate because Thread Count is excessively high,
It realizes and input data file to be treated has been executed with prestissimo in the case where systematic entirety can be unaffected.
Detailed description of the invention
Fig. 1 is the flow diagram of one embodiment of method of dynamic regulation thread of the present invention;
Fig. 2 is the functional block diagram of one embodiment of device of dynamic regulation thread of the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The present invention provides a kind of method of dynamic regulation thread.
Referring to Fig.1, Fig. 1 is the flow diagram of one embodiment of method of dynamic regulation thread of the present invention.
In one embodiment, the method for the dynamic regulation thread includes:
Step S10 reads the buffered data of preset quantity to preset data from input data file to be treated
In buffer area;
In the present embodiment, when needing to be implemented high-volume data, since data flow is excessive, it is impossible to be executed all
High-volume data are all read in memory, therefore, are preset a data buffer zone, are used for from high-volume input data to be treated
The buffered data of preset quantity is read in file, and is cached, and is delayed so that current thread is read directly from data buffer zone
Data are rushed to execute.
Step S20, execution efficiency of the monitoring current thread to buffered data in data buffer zone;
The execution efficiency for executing buffered data in data buffer zone to current thread is monitored, and can such as monitor current thread
Current thread, which executes, to be reflected to remaining data volume in the processing speed of buffered data in data buffer zone, data buffer zone etc.
The various parameters of efficiency.
Step S30, the number of threads that buffered data in data buffer zone is executed based on the execution efficiency dynamic regulation.
According to the current thread of monitoring to remaining in the processing speed of buffered data in data buffer zone, data buffer zone
The parameters such as data volume can carry out dynamic regulation to number of threads, if current thread is to the place of buffered data in data buffer zone
Excessive velocities are managed, then can reduce number of threads by terminate part thread;If current thread is to buffer number in data buffer zone
According to processing speed it is excessively slow, then number of threads can be promoted by increasing partial line journey, to reach dynamic regulation number of threads
Purpose.
The present embodiment buffers the data of input using data buffer zone from input data file to be treated, and to working as
Preceding thread is monitored the execution efficiency of buffered data in data buffer area, to know current thread to the processing speed of data
Degree, the Thread Count that can be executed according to the processing speed dynamic regulation current logarithmic of current thread according to buffered data in buffer area
Mesh both can guarantee to data the execution efficiency of data come dynamic regulation number of threads by the current thread thus according to monitoring
Processing speed, and be avoided that causes machine loading to aggravate because Thread Count is excessively high, and realizing can be impregnable in systematic entirety
In the case of input data file to be treated executed with prestissimo.
Further, in other embodiments, above-mentioned steps S10 may include: when the data volume in data buffer zone is small
When preset remaining data threshold values, the buffered data of preset quantity is read from input data file to be treated, and is led to
A preset data buffering queue is crossed to store the buffered data of the preset quantity of reading into data buffer zone.
During current thread executes buffered data in data buffer zone, data volume in data buffer zone can be by
It is decrescence few, when data volume remaining in data buffer zone is less than preset remaining data threshold values, then illustrate current thread logarithm
It has all been executed fastly according to buffered data in buffer area, in order to guarantee current thread to the processing speed and efficiency of data, data
It needs to continue supplementary data in buffer area, then reads the buffered data R of preset quantity from input data file to be treated,
And the buffered data of the preset quantity of reading is stored into data buffer zone by a preset data buffering queue, wherein pre-
If the data volume of data buffering queue be D, as D >=R, illustrate in input data file to be treated there are also mass data not
Processing, then stored the buffered data R of the preset quantity of reading into data buffer zone by the preset data buffering queue;When
When D < R, illustrate only to remain part low volume data in input data file to be treated, it is a small amount of by what is only remained in input data file
Data are stored by the preset data buffering queue to data buffer zone, and the buffered data in pending data buffer area is all held
Row finishes, and can close all threads, that completes entire input data file executes operation.
Above-mentioned steps S20 may include: data buffering after monitoring current thread executes buffered data in data buffer zone
Remaining data volume in area.Data are slow after being executed by monitoring current thread to buffered data in data buffer zone in the present embodiment
Rush whether remaining data volume in area is greater than preset remaining data threshold values to monitor current thread execution efficiency.
Above-mentioned steps S30 may include: when data volume remaining in data buffer zone is greater than preset remaining data threshold values
When, then illustrate that current thread is too low to the execution efficiency of buffered data in data buffer zone, processing speed is excessively slow, causes data slow
It rushes and has accumulated mass data in area, then need to increase the thread that current logarithmic is executed according to buffered data in buffer area, with raising pair
The execution efficiency and processing speed of buffered data in data buffer zone, to gradually decrease remaining data in data buffer zone
Amount.
In the present embodiment, per thread can all have creation, ready, waiting, dead, five states of operation, new thread quilt
Data can be directly acquired after creation to be run;After thread has executed data, then it can enter wait state, wait the thread
Data are reacquired after being waken up again and are reruned.Wherein, the wait state of thread is a kind of special state, is equivalent to
The qualification for temporarily depriving CPU time slice and CPU time slice that thread is currently owned by, returns it to ready state, unless by again
It wakes up, otherwise the thread will wait always, will not be chosen by thread scheduler and assign CPU time slice, be waited for
After thread is waken up, data can be normally continued to execute as the thread of other normal ready states.
In the present embodiment, the thread that current logarithmic is executed according to buffered data in buffer area is from preset initial line number of passes Tmin
Start to increase, with the increase of number of threads, the thread for carrying out parallel processing to buffered data in data buffer zone increases, then mentions
High execution efficiency and processing speed to buffered data in data buffer zone, remaining data volume also accelerates in data buffer zone
It reduces, in this way, the buffered data in data buffer zone can be executed with most fast speed by being continuously increased number of threads.Together
When, when the increase with number of threads, if the excessive velocities that current thread executes buffered data in data buffer zone, logarithm
The thread executed according to buffered data in buffer area can enter wait state, if current data executes excessive velocities, data are slow
It rushes buffered data in area to be used by other threads, and passes through preset data buffering queue at this time from input data to be treated
The buffered data of the preset quantity read in file is also not stored into data buffer zone, in this way, the thread can be because obtain not
It is waited for for a long time to data, in the present embodiment, a high latency is preset, if to data buffer zone
The waiting time for the thread that middle buffered data has been executed and has been waited for is more than preset high latency, then eventually
The only thread, the i.e. thread enter dead state, thus the speed executed in current thread to buffered data in data buffer zone
Waiting time too long thread is terminated when too fast, is reduced parallel number of threads, to mitigate the load of whole system, and be ensure that
Current thread is to the higher execution efficiency of buffered data in data buffer zone.
Further, in order to avoid occurring causing machine loading to aggravate because number of threads is excessively high, systematic entirety can be by
The case where influence, occurs, and in the present embodiment, presets a maximum thread value Tmax, buffered data is held in data buffer zone
Capable thread is from preset initial line number of passes TminStart it is increased during, number of threads maximum is no more than preset
Maximum thread value Tmax。
Moreover, when needing to increase the thread that current logarithmic is executed according to buffered data in buffer area, both may be used in the present embodiment
It wakes up the thread that buffered data in data buffer zone has been executed and has been waited for and executes data again, can also not have
When having the thread being waited for, is directly acquired by newly-built thread and execute data.In this way, according to system load and
The different of processing speed require, can preliminary setting data buffer area remaining data threshold values and every time from input number to be treated
According to the buffered data quantity into data buffer zone is read in file, when the data volume in each data buffer zone is less than preset
When remaining data threshold values, then the buffered data of identical quantity is read from input data file to be treated to data buffering
Qu Zhong guarantees the data stabilization being input in data buffer zone.Again by current thread to buffered data in data buffer zone
Execution efficiency carrys out dynamic regulation number of threads: if the overabundance of data accumulated in data buffer zone, increasing current logarithmic according to buffering
The thread that buffered data executes in area, to improve execution efficiency and processing speed to buffered data in data buffer zone;If working as
The excessive velocities that preceding thread executes buffered data in data buffer area, then terminated by preset high latency
Waiting time too long thread, reduces parallel number of threads, so that both can guarantee the processing speed to data in the present embodiment,
Be avoided that again causes machine loading to aggravate because Thread Count is excessively high, realizes in the case where systematic entirety can be unaffected with most fast
Speed has executed input data file to be treated.
The present invention further provides a kind of devices of dynamic regulation thread.
It is the functional block diagram of one embodiment of device of dynamic regulation thread of the present invention referring to Fig. 2, Fig. 2.
In one embodiment, the device of the dynamic regulation thread includes:
Read module 01, for reading the buffered data of preset quantity from input data file to be treated to default
Data buffer zone in;
Monitoring modular 02, for monitoring current thread to the execution efficiency of buffered data in data buffer zone;
Dynamic regulation module 03, for being executed based on the execution efficiency dynamic regulation to buffered data in data buffer zone
Number of threads.
In the present embodiment, when needing to be implemented high-volume data, since data flow is excessive, it is impossible to be executed all
High-volume data are all read in memory, therefore, are preset a data buffer zone, are used for from high-volume input data to be treated
The buffered data of preset quantity is read in file, and is cached, and is delayed so that current thread is read directly from data buffer zone
Data are rushed to execute.
The execution efficiency for executing buffered data in data buffer zone to current thread is monitored, and can such as monitor current thread
Current thread, which executes, to be reflected to remaining data volume in the processing speed of buffered data in data buffer zone, data buffer zone etc.
The various parameters of efficiency.
According to the current thread of monitoring to remaining in the processing speed of buffered data in data buffer zone, data buffer zone
The parameters such as data volume can carry out dynamic regulation to number of threads, if current thread is to the place of buffered data in data buffer zone
Excessive velocities are managed, then can reduce number of threads by terminate part thread;If current thread is to buffer number in data buffer zone
According to processing speed it is excessively slow, then number of threads can be promoted by increasing partial line journey, to reach dynamic regulation number of threads
Purpose.
The present embodiment buffers the data of input using data buffer zone from input data file to be treated, and to working as
Preceding thread is monitored the execution efficiency of buffered data in data buffer area, to know current thread to the processing speed of data
Degree, the Thread Count that can be executed according to the processing speed dynamic regulation current logarithmic of current thread according to buffered data in buffer area
Mesh both can guarantee to data the execution efficiency of data come dynamic regulation number of threads by the current thread thus according to monitoring
Processing speed, and be avoided that causes machine loading to aggravate because Thread Count is excessively high, and realizing can be impregnable in systematic entirety
In the case of input data file to be treated executed with prestissimo.
Further, in other embodiments, above-mentioned read module 01 can be used for: when the data volume in data buffer zone
When less than preset remaining data threshold values, the buffered data of preset quantity is read from input data file to be treated, and
The buffered data of the preset quantity of reading is stored into data buffer zone by a preset data buffering queue.
During current thread executes buffered data in data buffer zone, data volume in data buffer zone can be by
It is decrescence few, when data volume remaining in data buffer zone is less than preset remaining data threshold values, then illustrate current thread logarithm
It has all been executed fastly according to buffered data in buffer area, in order to guarantee current thread to the processing speed and efficiency of data, data
It needs to continue supplementary data in buffer area, then reads the buffered data R of preset quantity from input data file to be treated,
And the buffered data of the preset quantity of reading is stored into data buffer zone by a preset data buffering queue, wherein pre-
If the data volume of data buffering queue be D, as D >=R, illustrate in input data file to be treated there are also mass data not
Processing, then stored the buffered data R of the preset quantity of reading into data buffer zone by the preset data buffering queue;When
When D < R, illustrate only to remain part low volume data in input data file to be treated, it is a small amount of by what is only remained in input data file
Data are stored by the preset data buffering queue to data buffer zone, and the buffered data in pending data buffer area is all held
Row finishes, and can close all threads, that completes entire input data file executes operation.
Above-mentioned monitoring modular 02 can be used for: data are slow after monitoring current thread executes buffered data in data buffer zone
Rush remaining data volume in area.Data after being executed by monitoring current thread to buffered data in data buffer zone in the present embodiment
Whether remaining data volume is greater than preset remaining data threshold values to monitor current thread execution efficiency in buffer area.
Above-mentioned dynamic regulation module 03 can be used for: when data volume remaining in data buffer zone is greater than preset remainder
When according to threshold values, increase the thread that current logarithmic is executed according to buffered data in buffer area, wherein to buffered data in data buffer zone
The number of threads of execution is less than the maximum thread value of setting;If having been executed to buffered data in data buffer zone and being in waiting
The waiting time of the thread of state is more than preset high latency, then terminates the thread.
When data volume remaining in data buffer zone is greater than preset remaining data threshold values, then illustrate current thread logarithm
Execution efficiency according to buffered data in buffer area is too low, and processing speed is excessively slow, causes to have accumulated mass data in data buffer zone,
Need to increase the thread that current logarithmic is executed according to buffered data in buffer area, then to improve to buffered data in data buffer zone
Execution efficiency and processing speed, to gradually decrease remaining data volume in data buffer zone.
In the present embodiment, per thread can all have creation, ready, waiting, dead, five states of operation, new thread quilt
Data can be directly acquired after creation to be run;After thread has executed data, then it can enter wait state, wait the thread
Data are reacquired after being waken up again and are reruned.Wherein, the wait state of thread is a kind of special state, is equivalent to
The qualification for temporarily depriving CPU time slice and CPU time slice that thread is currently owned by, returns it to ready state, unless by again
It wakes up, otherwise the thread will wait always, will not be chosen by thread scheduler and assign CPU time slice, be waited for
After thread is waken up, data can be normally continued to execute as the thread of other normal ready states.
In the present embodiment, the thread that current logarithmic is executed according to buffered data in buffer area is from preset initial line number of passes Tmin
Start to increase, with the increase of number of threads, the thread for carrying out parallel processing to buffered data in data buffer zone increases, then mentions
High execution efficiency and processing speed to buffered data in data buffer zone, remaining data volume also accelerates in data buffer zone
It reduces, in this way, the buffered data in data buffer zone can be executed with most fast speed by being continuously increased number of threads.Together
When, when the increase with number of threads, if the excessive velocities that current thread executes buffered data in data buffer zone, logarithm
The thread executed according to buffered data in buffer area can enter wait state, if current data executes excessive velocities, data are slow
It rushes buffered data in area to be used by other threads, and passes through preset data buffering queue at this time from input data to be treated
The buffered data of the preset quantity read in file is also not stored into data buffer zone, in this way, the thread can be because obtain not
It is waited for for a long time to data, in the present embodiment, a high latency is preset, if to data buffer zone
The waiting time for the thread that middle buffered data has been executed and has been waited for is more than preset high latency, then eventually
The only thread, the i.e. thread enter dead state, thus the speed executed in current thread to buffered data in data buffer zone
Waiting time too long thread is terminated when too fast, is reduced parallel number of threads, to mitigate the load of whole system, and be ensure that
Current thread is to the higher execution efficiency of buffered data in data buffer zone.
Further, in order to avoid occurring causing machine loading to aggravate because number of threads is excessively high, systematic entirety can be by
The case where influence, occurs, and in the present embodiment, presets a maximum thread value Tmax, buffered data is held in data buffer zone
Capable thread is from preset initial line number of passes TminStart it is increased during, number of threads maximum is no more than preset
Maximum thread value Tmax。
Moreover, when needing to increase the thread that current logarithmic is executed according to buffered data in buffer area, both may be used in the present embodiment
It wakes up the thread that buffered data in data buffer zone has been executed and has been waited for and executes data again, can also not have
When having the thread being waited for, is directly acquired by newly-built thread and execute data.In this way, according to system load and
The different of processing speed require, can preliminary setting data buffer area remaining data threshold values and every time from input number to be treated
According to the buffered data quantity into data buffer zone is read in file, when the data volume in each data buffer zone is less than preset
When remaining data threshold values, then the buffered data of identical quantity is read from input data file to be treated to data buffering
Qu Zhong guarantees the data stabilization being input in data buffer zone.Again by current thread to buffered data in data buffer zone
Execution efficiency carrys out dynamic regulation number of threads: if the overabundance of data accumulated in data buffer zone, increasing current logarithmic according to buffering
The thread that buffered data executes in area, to improve execution efficiency and processing speed to buffered data in data buffer zone;If working as
The excessive velocities that preceding thread executes buffered data in data buffer area, then terminated by preset high latency
Waiting time too long thread, reduces parallel number of threads, so that both can guarantee the processing speed to data in the present embodiment,
Be avoided that again causes machine loading to aggravate because Thread Count is excessively high, realizes in the case where systematic entirety can be unaffected with most fast
Speed has executed input data file to be treated.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.Pass through above embodiment party
The description of formula, it is required general that those skilled in the art can be understood that above-described embodiment method can add by software
The mode of hardware platform is realized, naturally it is also possible to which by hardware, but in many cases, the former is more preferably embodiment.It is based on
Such understanding, substantially the part that contributes to existing technology can be with software product in other words for technical solution of the present invention
Form embody, which is stored in a storage medium (such as ROM/RAM, magnetic disk, CD), including
Some instructions are used so that a terminal device (can be mobile phone, computer, server or the network equipment etc.) executes this hair
Method described in bright each embodiment.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.
Claims (8)
1. a kind of method of dynamic regulation thread, which is characterized in that the described method comprises the following steps:
From in input data file to be treated read preset quantity buffered data into preset data buffer zone;
Current thread is monitored to remaining data volume in data buffer zone after buffered data execution in data buffer zone;
The number of threads that buffered data in data buffer zone is executed based on execution efficiency dynamic regulation;
Wherein, when data volume remaining in data buffer zone is greater than preset remaining data threshold values, increase current logarithmic according to slow
The thread that buffered data executes in area is rushed, the max line of setting is less than to the number of threads that buffered data in data buffer zone executes
Journey value.
2. the method for dynamic regulation thread as described in claim 1, which is characterized in that described from input data to be treated
Step of the buffered data of preset quantity into preset data buffer zone is read in file includes:
When the data volume in data buffer zone is less than preset remaining data threshold values, from input data file to be treated
The buffered data of preset quantity is read, and is stored the buffered data of the preset quantity of reading by a preset data buffering queue
Into data buffer zone.
3. the method for dynamic regulation thread as described in claim 1, which is characterized in that described to be based on execution efficiency dynamic regulation
To in data buffer zone buffered data execute number of threads the step of further include:
If the waiting time for the thread that buffered data in data buffer zone has been executed and has been waited for is more than to set in advance
Fixed high latency then terminates the thread.
4. the method for dynamic regulation thread as claimed in claim 3, which is characterized in that described to be based on execution efficiency dynamic regulation
To in data buffer zone buffered data execute number of threads the step of further include:
When data volume remaining in data buffer zone is greater than preset remaining data threshold values, by waking up to data buffer zone
Middle buffered data has executed and the thread that is waited for or newly-built thread increase current logarithmic according to buffer number in buffer area
According to the thread of execution.
5. a kind of device of dynamic regulation thread, which is characterized in that described device includes:
Read module, for reading the buffered data of preset quantity from input data file to be treated to preset data
In buffer area;
Monitoring modular, for monitoring current thread to remaining number in data buffer zone after buffered data execution in data buffer zone
According to amount;
Dynamic regulation module, the Thread Count for being executed based on execution efficiency dynamic regulation to buffered data in data buffer zone
Mesh;It is also used to increase current logarithmic according to slow when data volume remaining in data buffer zone is greater than preset remaining data threshold values
The thread that buffered data executes in area is rushed, the max line of setting is less than to the number of threads that buffered data in data buffer zone executes
Journey value.
6. device as claimed in claim 5, which is characterized in that the read module is specifically used for:
When the data volume in data buffer zone is less than preset remaining data threshold values, from input data file to be treated
The buffered data of preset quantity is read, and is stored the buffered data of the preset quantity of reading by a preset data buffering queue
Into data buffer zone.
7. device as claimed in claim 5, which is characterized in that the dynamic regulation module is specifically used for:
If the waiting time for the thread that buffered data in data buffer zone has been executed and has been waited for is more than to set in advance
Fixed high latency then terminates the thread.
8. device as claimed in claim 7, which is characterized in that the dynamic regulation module is also used to:
When data volume remaining in data buffer zone is greater than preset remaining data threshold values, by waking up to data buffer zone
Middle buffered data has executed and the thread that is waited for or newly-built thread increase current logarithmic according to buffer number in buffer area
According to the thread of execution.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510009627.8A CN105824691B (en) | 2015-01-08 | 2015-01-08 | The method and device of dynamic regulation thread |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510009627.8A CN105824691B (en) | 2015-01-08 | 2015-01-08 | The method and device of dynamic regulation thread |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105824691A CN105824691A (en) | 2016-08-03 |
CN105824691B true CN105824691B (en) | 2019-11-22 |
Family
ID=56514900
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510009627.8A Active CN105824691B (en) | 2015-01-08 | 2015-01-08 | The method and device of dynamic regulation thread |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105824691B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107450854B (en) * | 2017-08-07 | 2020-09-18 | 苏州浪潮智能科技有限公司 | Method and system for determining maximum thread number under expected speed |
CN107908471B (en) * | 2017-09-26 | 2021-06-08 | 聚好看科技股份有限公司 | Task parallel processing method and processing system |
CN108011840A (en) * | 2017-12-07 | 2018-05-08 | 中国银行股份有限公司 | Control method, server and the system of transaction request |
CN109117286A (en) * | 2018-07-30 | 2019-01-01 | 佛山市甜慕链客科技有限公司 | A kind of method of data collection and adjusting |
CN109144699A (en) * | 2018-08-31 | 2019-01-04 | 阿里巴巴集团控股有限公司 | Distributed task dispatching method, apparatus and system |
CN109977339A (en) * | 2019-03-26 | 2019-07-05 | 新华三信息安全技术有限公司 | A kind of data processing method and device |
CN112612607B (en) * | 2020-12-16 | 2024-07-09 | 平安消费金融有限公司 | Data processing method, device, computer equipment and medium based on message queue |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101178671A (en) * | 2007-12-11 | 2008-05-14 | 北大方正集团有限公司 | Method and system for dynamically configuring service treatment progress on server terminal |
CN103838547A (en) * | 2012-11-27 | 2014-06-04 | 中国电信股份有限公司 | Queue management method and device |
CN103902361A (en) * | 2014-04-04 | 2014-07-02 | 浪潮电子信息产业股份有限公司 | Thread pool capable of dynamically adjusting size |
CN104182361A (en) * | 2014-08-20 | 2014-12-03 | 北京国双科技有限公司 | Data caching processing method and device |
-
2015
- 2015-01-08 CN CN201510009627.8A patent/CN105824691B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101178671A (en) * | 2007-12-11 | 2008-05-14 | 北大方正集团有限公司 | Method and system for dynamically configuring service treatment progress on server terminal |
CN103838547A (en) * | 2012-11-27 | 2014-06-04 | 中国电信股份有限公司 | Queue management method and device |
CN103902361A (en) * | 2014-04-04 | 2014-07-02 | 浪潮电子信息产业股份有限公司 | Thread pool capable of dynamically adjusting size |
CN104182361A (en) * | 2014-08-20 | 2014-12-03 | 北京国双科技有限公司 | Data caching processing method and device |
Also Published As
Publication number | Publication date |
---|---|
CN105824691A (en) | 2016-08-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105824691B (en) | The method and device of dynamic regulation thread | |
US8813080B2 (en) | System and method to optimize OS scheduling decisions for power savings based on temporal characteristics of the scheduled entity and system workload | |
US9618997B2 (en) | Controlling a turbo mode frequency of a processor | |
CN106708578B (en) | Log output method and device based on double threads | |
US9858115B2 (en) | Task scheduling method for dispatching tasks based on computing power of different processor cores in heterogeneous multi-core processor system and related non-transitory computer readable medium | |
US20160210174A1 (en) | Hybrid Scheduler and Power Manager | |
US8056083B2 (en) | Dividing a computer job into micro-jobs for execution | |
WO2015106687A1 (en) | Method and apparatus for processing computational task | |
US9448839B2 (en) | Backoff job queue polling mechanism | |
US20150121387A1 (en) | Task scheduling method for dispatching tasks based on computing power of different processor cores in heterogeneous multi-core system and related non-transitory computer readable medium | |
US10467054B2 (en) | Resource management method and system, and computer storage medium | |
EP3278220B1 (en) | Power aware scheduling and power manager | |
JP2012118987A (en) | Computer implementation method, computer program, and system for memory usage query governor (memory usage query governor) | |
CN106155931B (en) | Method and device for limiting speed of disk reading | |
CN107766160B (en) | queue message processing method and terminal equipment | |
KR101513398B1 (en) | Terminal device for reducing power consumption and Method for controlling the same | |
CN114253683B (en) | Task processing method and device, electronic equipment and storage medium | |
CN102426539B (en) | Timer task automatic processing method and system | |
CN110417678A (en) | A kind of method and device of application programming interfaces current limliting | |
CN109582460B (en) | Redis memory data elimination method and device | |
KR20160040260A (en) | Concurrent network application scheduling for reduced power consumption | |
US10528387B2 (en) | Computer processing system with resource optimization and associated methods | |
EP2413240A1 (en) | Computer micro-jobs | |
CN109885261B (en) | Method for improving performance of storage system | |
US8046543B2 (en) | Selectively retaining a topmost subpool expansion to prevent thrashing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |