CN101122870A - Thread wakening control systems and method - Google Patents

Thread wakening control systems and method Download PDF

Info

Publication number
CN101122870A
CN101122870A CNA2007101641440A CN200710164144A CN101122870A CN 101122870 A CN101122870 A CN 101122870A CN A2007101641440 A CNA2007101641440 A CN A2007101641440A CN 200710164144 A CN200710164144 A CN 200710164144A CN 101122870 A CN101122870 A CN 101122870A
Authority
CN
China
Prior art keywords
thread
dormancy
time interval
time
waiting task
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CNA2007101641440A
Other languages
Chinese (zh)
Other versions
CN100489788C (en
Inventor
钟发然
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CNB2007101641440A priority Critical patent/CN100489788C/en
Publication of CN101122870A publication Critical patent/CN101122870A/en
Application granted granted Critical
Publication of CN100489788C publication Critical patent/CN100489788C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The present invention provides a line wakeup control method, including the following steps: the tread wakes up and runs to check whether there are armed tasks or not. If there are, the armed tasks are implemented and the line dormancy time is reset as Delta t of the preset minimal unit time interval. Otherwise, the sum Delta at of the latest two dormancy time intervals is computed and set as line dormancy time interval . The present invention achieves a short service line dormancy interval when there are a plurality of armed tasks and a long interval when armed tasks are few, avoid wasting the system resources and reasonably solving the contradiction between task processing efficiency and system resource waste.

Description

A kind of thread wakening control method and system
Technical field
The present invention relates to computer realm, particularly relate to a kind of thread wakening control method and system.
Background technology
Thread is an entity in the process, the base unit of independently being dispatched and assigning by system, thread oneself does not have system resource, only has the requisite resource that partly is in operation, but it can share whole resources that process is had with other thread that belongs to a process together.Another thread can be created and cancel to a thread, can concurrently carry out between a plurality of threads in the same process.Because the mutual restriction between the thread causes thread to be in operation and presents discontinuity.That thread has is ready, block and move three kinds of basic status.Thread is single sequential control flow in the program, and it has well solved tight coupling and has shared parallel processing behavior on the multiprocessor architecture of main memory.The thread dormancy is meant that thread is in can not running status, is waiting to fix time or incident is resumed operation after activating again.
Existing system triggers carries out the bottom service thread, and dual mode is generally arranged:
A kind of is that passive type triggers execution: when the external world reaches certain condition, trigger and carry out service thread, to carry out required service.
Another kind is that active triggering is carried out, and is set at interval regular time, after the time of every interval appointment, all can go to trigger service thread, to carry out required service.
Above described two kinds of modes of trigger carrying out the bottom service threads following deficiency is arranged:
Trigger execution for passive type: need the external world to reach certain condition at every turn, could trigger and carry out service thread, controlling of active can't be accomplished by system, this mode, only being suitable for system does not need to regulate fully, only carry out the passive simple scenario of calling, under most complicated business scenes, all can not satisfy professional demand.
Carry out at interval active triggering of regular time is set, system is back, interval triggering service thread initiatively at the appointed time.Though this mode system obtains initiatively, but it is often reasonable not enough, when the triggering of service thread is not very regular, having needs the service thread that triggers many especially in certain time period, and in certain time period, need the service thread that triggers especially after a little while, the mode that adopts this set at interval active triggering of regular time to carry out service thread can not well satisfy, and is special, triggering service thread can cause system resource in few time period a large amount of wastes.In real business scenario,, go to trigger service thread at different time often along with different conditions.Especially work as system and relatively pay close attention to for performance, when perhaps service thread compared consumes resources, the mode of this Fixed Time Interval dispatch service thread was also unreasonable, has wasted a large amount of system resource.
Summary of the invention
Technical matters to be solved by this invention provides the method and system of a kind of thread wakening control, to service thread with the mode of science initiatively trigger, dormancy, thereby rational using system resource is avoided expending of unnecessary system resource.
In order to address the above problem, the invention discloses a kind of thread wakening control method, comprising:
Frequency dynamic according to pending task presets the time interval of waking thread up;
The thread wakening operation;
Whether detect has waiting task;
When having detected waiting task, then carry out described waiting task, enter next step after disposing; Then directly enter next step when detecting when not having waiting task;
The dormancy time of putting thread is the described time interval of waking thread up of dynamically presetting.
It is preferably, described that dynamically to preset the time interval of waking thread up be arbitrary time span.
It is preferably, described that dynamically to preset the time interval of waking thread up be the multiple of Fixed Time Interval.
The invention also discloses another kind of thread wakening control method, comprising:
The thread wakening operation;
Whether detect has waiting task;
When having detected waiting task, then carry out described waiting task, handle that the dormancy time of thread resets to the minimum unit time interval Δ t that presets behind the described waiting task, otherwise;
Calculate the time interval sum Δ at of nearest twice dormancy, the time interval of putting the thread dormancy is Δ at.
Wherein, when thread dormancy for the first time, the time interval sum Δ at of described nearest twice dormancy is the minimum unit time interval Δ t that presets.
When thread dormancy for the second time, the time interval of described nearest twice dormancy all is the minimum unit time interval Δ t that presets, and the time interval sum Δ at of described nearest twice dormancy is 2 Δ t.
Preferably, also comprise:
Preset the maximum time interval delta T, when the time interval of nearest twice dormancy sum Δ at exceeds described default maximum time during interval delta T, then the dormancy time of described thread resets to the minimum unit time interval Δ t that presets.
The invention also discloses a kind of thread wakening control system, comprising:
The thread wakening unit is used for the thread wakening operation;
The task detecting unit is used for detecting whether waiting task is arranged;
Task processing unit is used to finish the processing of waiting task;
The dynamic reset cell of dormancy time, the dormancy time of the thread that is used for dynamically resetting.
The invention also discloses another kind of thread wakening control system, comprising:
The thread wakening unit is used for the thread wakening operation;
The task detecting unit is used for detecting whether waiting task is arranged;
Task processing unit is used to finish the processing of waiting task;
The dormancy time reset cell, when detecting unit detects waiting task then behind the intact described waiting task of processing unit processes the dormancy time of replacement thread be the minimum unit time interval Δ t that presets, otherwise;
The time interval of putting the thread dormancy is the time interval sum Δ at of nearest twice dormancy.
Preferably, described system also comprises:
Judging unit is used to judge whether the time interval sum Δ at of nearest twice dormancy exceeds default maximum time interval delta T.
Compared with prior art, the present invention has the following advantages:
Scheme of the present invention adopts active triggering to carry out service thread, frequency dynamic according to pending task presets the time interval of waking thread up, service thread is executed the task according to after the frequency interval certain time interval of executing the task, service thread was carried out dormancy when the execution back was idle, thereby reduced expending system resource.
Sleep interval of the present invention and on-fixed, but use dynamic weighting to set interval according to the frequency of pending task, dynamically allow thread carry out rational dormancy and wake up, thereby make each dormancy time dynamic change of service thread, more reasonably the using system resource reduces expending system resource
Further, after service thread of the present invention detects and do not have pending task, and make the sleep interval of service thread have memory function.After promptly having detected waiting task, after handling pending task, the dormancy time of thread resets to the minimum unit time interval, when detect do not have pending task after, each sleep interval is nearest twice sleep interval time sum, realized working as pending task for a long time, then the service thread dormancy time is short, when pending task after a little while, the long purpose of service thread dormancy time then, avoid resource waste, reasonably solved the efficient of Processing tasks and the contradiction between the system resource waste.
Description of drawings
Fig. 1 is the process flow diagram of a kind of thread wakening control method first embodiment of the present invention;
Fig. 2 is the process flow diagram of a kind of thread wakening control method second embodiment of the present invention;
Fig. 3 is the concrete synoptic diagram of the process flow diagram of a kind of thread wakening control method second embodiment of the present invention shown in Figure 2;
Fig. 4 is the process flow diagram of a kind of thread wakening control method the 3rd embodiment of the present invention;
Fig. 5 is the concrete synoptic diagram of the process flow diagram of a kind of thread wakening control method the 3rd embodiment of the present invention shown in Figure 4;
Fig. 6 is the structured flowchart of a kind of thread wakening control system first embodiment of the present invention;
Fig. 7 is the structured flowchart of a kind of thread wakening control system second embodiment of the present invention;
Fig. 8 is the structured flowchart of a kind of thread wakening control system the 3rd embodiment of the present invention.
Embodiment
The applied environment of scheme of the present invention can be in java middleware application server, also can be in other application server environment, as the web server.In a word, can use technical solutions according to the invention in needs call the scene of service thread, the present invention does not limit the applied environment of described technical scheme.
Service thread of the present invention can be that message sends, mail sends, dynamic process is submitted document or other service thread, to some bottom service threads, no matter be the service thread in the web server or the server of middleware application server and other types, if meet the following conditions, technical scheme of the present invention can preferably be suitable for:
Can compare consume system resources when 1, carrying out, need reasonably wake/sleep thread, to save system resource.Otherwise,, can not expend too many system resource when then constantly circulation is carried out if do not expend system resource when carrying out yet;
2, task is handled does not need synchronous execution, but certain efficient requirement is arranged.
Message sends, mail sends this class service, both do not required the synchronous execution (transmission/reception both sides must just can carry out synchronously) as telephone communication, but require in the regular hour, to finish, and relatively expend system resource, therefore can the advantageous applications technical solutions according to the invention.Certainly, the present invention does not limit the application scenarios of described technical scheme, can learn, uses technical scheme of the present invention and fall within protection scope of the present invention yet in other scene.
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
First embodiment provided by the invention with reference to Fig. 1, shows the process flow diagram of a kind of thread wakening control method of the present invention, comprising:
Step 101, preset the time interval of waking thread up according to the frequency dynamic of pending task.
Step 102, thread wakening operation enter step 103.
Whether step 103, detection have waiting task.
Behind the thread wakening, system detects whether pending task is arranged, and enters step 104.
Step 104, when having detected waiting task, then carry out described waiting task.
After having detected waiting task, finish the processing of described waiting task, enter step 105; Do not have pending task if detect, then directly enter step 105.
Step 105, the dormancy time of putting thread are the described time interval of waking thread up of dynamically presetting.
When after the processing of finishing waiting task or detect do not have waiting task after, thread is put dormant state, the time interval of thread dormancy is changed to the time interval that dynamic weighting is provided with.The dormancy time of described thread can be provided with according to the Automatic Frequency weighting of waiting task, can be arbitrary time span, also can be certain Fixed Time Interval, and perhaps its multiple can also be into time interval of the number of permutations.The present invention does not limit it.
Second embodiment provided by the invention with reference to Fig. 2, illustrates the process flow diagram of a kind of thread wakening control method of the present invention, comprising:
Step 201, thread wakening operation.
Some are relatively expended the service thread of system resource, if described thread is in running status always, then can cause a large amount of wastes of system resource, for conserve system resources, when described service thread when not having waiting task, allow it be in dormant state, promptly described line is in can not running status, waiting to fix time or incident is resumed operation after activating again, preferably waking operation up in embodiments of the present invention through after the time interval of dynamic weighting.Specifically waking mode up will describe in detail in step 203,204.
Whether step 202, detection have waiting task.
Behind the thread wakening, detect whether waiting task is arranged, have waiting task then to enter step 203; No waiting task then enters step 204.
Step 203, when having detected waiting task, then carry out described waiting task, handle that the dormancy time of thread resets to the minimum unit time interval Δ t that presets behind the described waiting task.
When having detected waiting task behind the thread wakening, then finish the processing of described waiting task, as the transmission of message, the transmission of mail.After all waiting tasks are all finished, when thread is in idle condition, be conserve system resources, putting described thread is dormant state, being in can not running status.For the sleep interval that makes thread has memory function, the dormancy time of scientific and rational arrangement thread, reach thread in the waiting task short purpose of dormancy time for a long time, the embodiment of the invention preferably take to reset after thread the is finished waiting task dormancy time of described thread is minimum unit time interval Δ t.Also be that thread dormancy time at this moment is the shortest, thereby can not cause the low of task treatment effeciency, guaranteed the timely processing of task, can not influence the efficient that task is handled, reasonably solved the contradiction that economizes on resources with the efficient processing of task because of economizing on resources.
The time interval sum Δ at of step 204, nearest twice dormancy of calculating, the time interval of putting the thread dormancy is Δ at.
Behind thread wakening, system detects when not having waiting task, shows that the waiting task amount is few in this time period.At this moment, dormancy time is long after a little while at waiting task in order to reach thread, the purpose of conserve system resources, the dormancy time that the embodiment of the invention is preferably taked has memory function, also promptly when detect do not have waiting task after, then calculate the time interval sum Δ at of nearest twice dormancy, the sleep interval of thread is changed to the time interval sum Δ at of nearest twice dormancy with this moment, behind thread dormancy Δ at, wake detection again up whether waiting task is arranged, have and then enter step 203, no waiting task then enters step 204, so always circulation.
According to above description to the embodiment of the invention, can know, for service thread, when its waiting task for a long time, handle at every turn then that the dormancy time of replacement thread is minimum unit time interval Δ t behind the waiting task, the present invention can be provided with arbitrarily to described minimum unit time interval Δ t without limits as required, as 0.5s, 1s, 2s, 5s.......Assurance can both high efficiencyly be handled all waiting tasks at every turn like this.When not having waiting task, then the each dormancy time of thread is nearest twice dormancy time sum, the dormancy time of thread has memory function like this, when not having waiting task, the dormancy time of thread is more and more longer, the system resource of waste is fewer and feweri, thereby has reasonably solved waste system resource and the not high contradiction of Processing tasks efficient.
Further, if thread is dormancy for the first time, then the time interval sum Δ at of described nearest twice dormancy is exactly the minimum unit time interval Δ t that presets.
If when thread was dormancy for the second time, the time interval of described nearest twice dormancy all was the minimum unit time interval Δ t that presets, the time interval sum Δ at of described nearest twice dormancy is 2 times of minimum unit time interval Δ t.
With instantiation the embodiment of the invention is carried out a detailed introduction below, with reference to Fig. 3.
It is 1s that minimum unit time interval Δ t is set, and waiting task is the transmission of message, after thread is waken up, whether have More-Messages-To-Send send, if detected message to be sent, then send and all wait to send out message if detecting, send all wait to send out message after, replacement thread dormancy time is 1s.Do not have message to be sent if detect after thread is waken up, then the dormancy time of thread is nearest twice dormancy time sum, if thread is dormancy for the first time, then the dormancy time of described thread is 1s.Be waken up behind the thread dormancy 1s, detect whether remain message once more, if having, then send all message, the dormancy time that sends back replacement thread is the minimum unit time interval, i.e. 1s.If there is not message to be sent, then the dormancy time of thread is changed to 2s.So circulation is gone down, easily as learning: if message to be sent is all arranged at every turn, then the dormancy time of each thread all is the minimum unit time interval, be 1s, do not have message to be sent if all detect always, then the dormancy time of thread is followed successively by 1s, 2s, 3s, 5s, 8s, 12s, 20s, 32s......, the dormancy time that is each thread all is the dormancy time sum of nearest twice thread, like this, when not having message to be sent, the dormancy time of thread has memory function.Detected message to be sent after certain thread dormancy is waken up after, then the dormancy time of replacement thread is the minimum unit time interval, i.e. 1s after sending message to be sent.Behind thread dormancy 20s, detected message to be sent, then the dormancy time of thread is not 32s next time, but 1s, thereby has guaranteed to send the efficient of message, can be because of by sacrifice efficient and conserve system resources.The saving and the efficient contradiction that sends message of system resource have reasonably been solved.
The 3rd embodiment provided by the invention with reference to Fig. 4, illustrates the process flow diagram of a kind of thread wakening control method of the present invention, comprising:
Step 401, thread wakening operation.
Some are relatively expended the service thread of system resource, if described thread is in running status always, then can cause a large amount of wastes of system resource, for conserve system resources, when described service thread when not having waiting task, allow it be in dormant state, promptly described line is in can not running status, waiting to fix time or incident is resumed operation after activating again, preferably waking operation up in embodiments of the present invention through after the time interval of dynamic weighting.Specifically waking mode up will describe in detail in step 403,404.
Whether step 402, detection have waiting task.
Behind the thread wakening, detect whether waiting task is arranged, have waiting task then to enter step 403; No waiting task then enters step 404.
Step 403, when having detected waiting task, then carry out described waiting task, handle that the dormancy time of thread resets to the minimum unit time interval Δ t that presets behind the described waiting task.
When having detected waiting task behind the thread wakening, then finish the processing of described waiting task, as the transmission of message, the transmission of mail.After all waiting tasks are all finished, when thread is in idle condition, be conserve system resources, putting described thread is dormant state, being in can not running status.For the sleep interval that makes thread has memory function, the dormancy time of scientific and rational arrangement thread, reach thread in the waiting task short purpose of dormancy time for a long time, the embodiment of the invention preferably take to reset after thread the is finished waiting task dormancy time of described thread is minimum unit time interval Δ t.Also be that thread dormancy time at this moment is the shortest, thereby can not cause the low of task treatment effeciency, guaranteed the timely processing of task, can not influence the efficient that task is handled, reasonably solved the contradiction that economizes on resources with the efficient processing of task because of economizing on resources.
The time interval sum Δ at of step 404, nearest twice dormancy of calculating.
Step 405, preset the maximum time interval delta T, the maximum time interval delta T relation of judging the time interval sum Δ at of nearest twice dormancy and presetting, described maximum time, interval delta T can be provided with arbitrarily according to actual conditions, as 10s, 30s, 60s......, the present invention does not limit this:
Step 406, when the time interval of nearest twice dormancy sum Δ at greater than described default maximum time during interval delta T, then the dormancy time of described thread resets to the minimum unit time interval Δ t that presets.
If the time interval sum Δ at of described nearest twice dormancy of step 407 is not more than described default maximum time during interval delta T, the time interval of then putting the thread dormancy is Δ at.
According to above description to the embodiment of the invention, can know, for service thread, when its waiting task for a long time, handle at every turn then that the dormancy time of replacement thread is minimum unit time interval Δ t behind the waiting task, the present invention can be provided with arbitrarily to described minimum unit time interval Δ t without limits as required, as 0.5s, 1s, 2s, 5s.......Assurance can both high efficiencyly be handled all waiting tasks at every turn like this.When not having waiting task, then the each dormancy time of thread is nearest twice dormancy time sum, the dormancy time of thread has memory function like this, when not having waiting task, the dormancy time of thread is more and more longer, the system resource of waste is fewer and feweri, and be provided with one maximum time interval delta T, when the time interval of nearest twice dormancy sum Δ at greater than described default maximum time during interval delta T, the dormancy time of thread of then resetting is the minimum unit time interval, avoided like this since thread for a long time dormancy and can not be waken up, detect waiting task, can not cause the low of Processing tasks efficient.
Further, if thread is dormancy for the first time, then the time interval sum Δ at of described nearest twice dormancy is exactly the minimum unit time interval Δ t that presets.
If when thread was dormancy for the second time, the time interval of described nearest twice dormancy all was the minimum unit time interval Δ t that presets, the time interval sum Δ at of described nearest twice dormancy is 2 times of minimum unit time interval Δ t.
With instantiation the embodiment of the invention is carried out a detailed introduction below, with reference to Fig. 5.
It is 1s that the minimum unit time interval is set, waiting task is the transmission of message, maximum time, interval delta T was 30s, after thread is waken up, whether have More-Messages-To-Send send, if detected message to be sent, then send and all wait to send out message if detecting, send all wait to send out message after, replacement thread dormancy time is 1s.Do not have message to be sent if detect after thread is waken up, then the dormancy time of thread is nearest twice dormancy time sum, if thread is dormancy for the first time, then the dormancy time of described thread is 1s.Be waken up behind the thread dormancy 1s, detect whether remain message once more, if having, then send all message, the dormancy time that sends back replacement thread is the minimum unit time interval, i.e. 1s.If there is not message to be sent, then the dormancy time of thread is changed to 2s.So circulation is gone down, easily as learning: if message to be sent is all arranged at every turn, then the dormancy time of each thread all is the minimum unit time interval, be 1s, do not have message to be sent if all detect always, then the dormancy time of thread is followed successively by 1s, 2s, 3s, 5s, 8s, 12s, 20s, 32s......, the dormancy time that is each thread all is the dormancy time sum of nearest twice thread, like this, when not having message to be sent, the dormancy time of thread has memory function.Detected message to be sent after certain thread dormancy is waken up after, then the dormancy time of replacement thread is the minimum unit time interval, i.e. 1s after sending message to be sent.Detecting when does not always have message to be sent, and when thread carried out the 8th dormancy, because described time that will dormancy surpasses 30s at interval of default maximum time, then the 8th of thread the dormancy time was not 32s, but the minimum unit time interval, i.e. 1s.Avoided like this since thread for a long time dormancy and can not be waken up, detect waiting task, can not cause the low of Processing tasks efficient.
The present invention also discloses a kind of thread wakening control system,, show the structural representation of the embodiment one of a kind of thread wakening control system of the present invention with reference to Fig. 6.
Native system comprises: thread wakening unit 601 is used for the thread wakening operation; Task detecting unit 602 is used for detecting whether waiting task is arranged; Task processing unit 603 is used to finish the processing of waiting task; The dynamic reset cell 604 of dormancy time, the dormancy time of the thread that is used for dynamically resetting.
Native system the principle of work and the course of work as follows:
After dormancy finished, thread wakening unit 601 woke the thread operation up, and behind the thread wakening, task detecting unit 602 detects whether waiting task is arranged, if waiting task is arranged, then calling task processing unit 603 is finished the processing of described waiting task.Call the dormancy time of dormancy time reset cell 604 dynamic replacement threads then,, then directly call the dormancy time of the dynamic reset cell 604 dynamic replacement threads of dormancy time if there is not waiting task.The dormancy time of described thread can be provided with according to the Automatic Frequency weighting of waiting task, can be arbitrary time span, also can be certain Fixed Time Interval, and perhaps its multiple can also be into time interval of the number of permutations.The present invention does not limit it.
With reference to Fig. 7, show the structural representation of the embodiment two of a kind of thread wakening control system of the present invention.
Native system comprises: thread wakening unit 701 is used for the thread wakening operation; Task detecting unit 702 is used for detecting whether waiting task is arranged; Task processing unit 703 is used to finish the processing of waiting task; Dormancy time reset cell 704, when detecting unit detects waiting task then after handling described waiting task the dormancy time of replacement thread be the minimum unit time interval Δ t that presets, otherwise;
The time interval of putting the thread dormancy is the time interval sum Δ at of nearest twice dormancy.Native system the principle of work and the course of work as follows:
After dormancy finished, thread wakening unit 701 woke the thread operation up, and behind the thread wakening, task detecting unit 702 detects whether waiting task is arranged, if waiting task is arranged, then calling task processing unit 703 is finished the processing of described waiting task.The dormancy time that calls dormancy time reset cell 704 replacement threads then is minimum unit time interval Δ t, if there is not waiting task, then directly calling dormancy time reset cell 704, to put the dormancy time of thread be nearest twice thread dormancy time sum Δ at.
With reference to Fig. 8, show the structural representation of the embodiment three of a kind of thread wakening control system of the present invention.
Native system comprises: thread wakening unit 801 is used for the thread wakening operation; Task detecting unit 802 is used for detecting whether waiting task is arranged; Task processing unit 803 is used to finish the processing of waiting task; Dormancy time reset cell 804, when detecting unit detects waiting task then after handling described waiting task the dormancy time of replacement thread be the minimum unit time interval Δ t that presets, otherwise;
The time interval of putting the thread dormancy is the time interval sum Δ at of nearest twice dormancy.
Judging unit 805 is used to judge whether the time interval sum Δ at of nearest twice dormancy exceeds described default maximum time interval delta T
Native system the principle of work and the course of work as follows:
After dormancy finished, thread wakening unit 801 woke the thread operation up, and behind the thread wakening, task detecting unit 802 detects whether waiting task is arranged, if waiting task is arranged, then calling task processing unit 803 is finished the processing of described waiting task.The dormancy time that calls dormancy time reset cell 804 replacement threads then is minimum unit time interval Δ t, if there is not waiting task, then calculate nearest twice dormancy time sum Δ at, and call judging unit 805 and judge whether the time interval sum Δ at of nearest twice dormancy exceeds described default maximum time interval delta T, if the time interval sum Δ at of nearest twice dormancy is greater than described default maximum time interval delta T, the dormancy time of thread of then resetting is minimum unit time interval Δ t, if the time interval sum Δ at of nearest twice dormancy is not more than described default maximum time interval delta T, the dormancy time of then putting thread is the time interval sum Δ at of nearest twice dormancy.
Because Fig. 6, Fig. 7, system shown in Figure 8 and Fig. 1, Fig. 2, method shown in Figure 4 are corresponding one by one, therefore, in the system in the part reference method of detailed introduction appropriate section get final product.
More than to a kind of thread wakening control method provided by the present invention and system, be described in detail, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (10)

1. a thread wakening control method is characterized in that, comprising:
Frequency dynamic according to pending task presets the time interval of waking thread up;
The thread wakening operation;
Whether detect has waiting task;
When having detected waiting task, then carry out described waiting task, enter next step after disposing; Then directly enter next step when detecting when not having waiting task;
The dormancy time of putting thread is the described time interval of waking thread up of dynamically presetting.
2. thread wakening control method as claimed in claim 1 is characterized in that:
It is described that dynamically to preset the time interval of waking thread up be arbitrary time span.
3. thread wakening control method as claimed in claim 1 is characterized in that:
It is described that dynamically to preset the time interval of waking thread up be the multiple of Fixed Time Interval.
4. a thread wakening control method is characterized in that, comprising:
The thread wakening operation;
Whether detect has waiting task;
When having detected waiting task, then carry out described waiting task, handle that the dormancy time of thread resets to the minimum unit time interval Δ t that presets behind the described waiting task, otherwise;
Calculate the time interval sum Δ at of nearest twice dormancy, the time interval of putting the thread dormancy is Δ at.
5. thread wakening control method as claimed in claim 4 is characterized in that:
When thread dormancy for the first time, the time interval sum Δ at of described nearest twice dormancy is the minimum unit time interval Δ t that presets.
6. thread wakening control method as claimed in claim 4 is characterized in that:
When thread dormancy for the second time, the time interval of described nearest twice dormancy all is the minimum unit time interval Δ t that presets, and the time interval sum Δ at of described nearest twice dormancy is 2 Δ t.
7. thread wakening control method as claimed in claim 4 is characterized in that, also comprises:
Preset the maximum time interval delta T, when the time interval of nearest twice dormancy sum Δ at exceeds described default maximum time during interval delta T, then the dormancy time of described thread resets to the minimum unit time interval Δ t that presets.
8. a thread wakening control system is characterized in that, comprising:
The thread wakening unit is used for the thread wakening operation;
The task detecting unit is used for detecting whether waiting task is arranged;
Task processing unit is used to finish the processing of waiting task;
The dynamic reset cell of dormancy time, the dormancy time of the thread that is used for dynamically resetting.
9. a thread wakening control system is characterized in that, comprising:
The thread wakening unit is used for the thread wakening operation;
The task detecting unit is used for detecting whether waiting task is arranged;
Task processing unit is used to finish the processing of waiting task;
The dormancy time reset cell, when detecting unit detects waiting task then behind the intact described waiting task of processing unit processes the dormancy time of replacement thread be the minimum unit time interval Δ t that presets, otherwise;
The time interval of putting the thread dormancy is the time interval sum Δ at of nearest twice dormancy.
10. thread wakening control system as claimed in claim 9 is characterized in that, also comprises:
Judging unit is used to judge whether the time interval sum Δ at of nearest twice dormancy exceeds default maximum time interval delta T.
CNB2007101641440A 2007-09-30 2007-09-30 Thread wakening control systems and method Active CN100489788C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2007101641440A CN100489788C (en) 2007-09-30 2007-09-30 Thread wakening control systems and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2007101641440A CN100489788C (en) 2007-09-30 2007-09-30 Thread wakening control systems and method

Publications (2)

Publication Number Publication Date
CN101122870A true CN101122870A (en) 2008-02-13
CN100489788C CN100489788C (en) 2009-05-20

Family

ID=39085213

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2007101641440A Active CN100489788C (en) 2007-09-30 2007-09-30 Thread wakening control systems and method

Country Status (1)

Country Link
CN (1) CN100489788C (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923493A (en) * 2010-09-21 2010-12-22 深圳市华力特电气股份有限公司 Task scheduling method and task scheduling equipment
CN103249122A (en) * 2012-02-14 2013-08-14 宏达国际电子股份有限公司 Connection dormancy method and wireless communicaiton device and computer readalbe recording medium
CN103853605A (en) * 2012-11-28 2014-06-11 宏达国际电子股份有限公司 Thread management method and electronic device thereof
CN104951361A (en) * 2014-03-27 2015-09-30 阿里巴巴集团控股有限公司 Method and device for triggering timing task
CN104977979A (en) * 2014-04-09 2015-10-14 珠海全志科技股份有限公司 Clock source switching method and clock source switching system
CN105117277A (en) * 2015-08-26 2015-12-02 深圳市华验防伪科技有限公司 Task cycle realization method and system
US9465655B2 (en) 2012-11-28 2016-10-11 Htc Corporation Method for managing threads using executing time scheduling technique and electronic device using the same method
CN107590005A (en) * 2017-08-31 2018-01-16 武汉光谷信息技术股份有限公司 The acquisition methods and system of data in a kind of Redis memory queues
CN108306816A (en) * 2017-12-30 2018-07-20 方正璞华软件(武汉)股份有限公司 A kind of mail push method and system
CN108319508A (en) * 2017-01-18 2018-07-24 中国移动通信集团公司 HTTP synchronization requests switch to the method and server of asynchronous process
CN108810557A (en) * 2017-07-10 2018-11-13 北京视联动力国际信息技术有限公司 A kind of method for processing video frequency, device, electronic equipment and storage medium
CN109213577A (en) * 2017-06-30 2019-01-15 武汉斗鱼网络科技有限公司 A kind of method, apparatus and computer equipment of thread sleep
CN110769046A (en) * 2019-10-17 2020-02-07 新华三信息安全技术有限公司 Message acquisition method and device, electronic equipment and machine-readable storage medium
CN112559160A (en) * 2021-02-19 2021-03-26 智道网联科技(北京)有限公司 Map engine multithread control method and device
WO2024099017A1 (en) * 2022-11-07 2024-05-16 蔚来移动科技有限公司 Process management method, and electronic device and storage medium

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923493A (en) * 2010-09-21 2010-12-22 深圳市华力特电气股份有限公司 Task scheduling method and task scheduling equipment
CN103249122B (en) * 2012-02-14 2016-06-01 宏达国际电子股份有限公司 Method, radio communication device and computer-readable recording medium
CN103249122A (en) * 2012-02-14 2013-08-14 宏达国际电子股份有限公司 Connection dormancy method and wireless communicaiton device and computer readalbe recording medium
US9380616B2 (en) 2012-02-14 2016-06-28 Htc Corporation Connection dormancy method and wireless communication device and computer readable recording medium
CN103853605B (en) * 2012-11-28 2017-06-09 宏达国际电子股份有限公司 Thread management method and its electronic installation
US9465655B2 (en) 2012-11-28 2016-10-11 Htc Corporation Method for managing threads using executing time scheduling technique and electronic device using the same method
CN103853605A (en) * 2012-11-28 2014-06-11 宏达国际电子股份有限公司 Thread management method and electronic device thereof
CN104951361A (en) * 2014-03-27 2015-09-30 阿里巴巴集团控股有限公司 Method and device for triggering timing task
CN104951361B (en) * 2014-03-27 2018-10-09 阿里巴巴集团控股有限公司 A kind of triggering method and device of timed task
CN104977979A (en) * 2014-04-09 2015-10-14 珠海全志科技股份有限公司 Clock source switching method and clock source switching system
CN104977979B (en) * 2014-04-09 2019-03-19 珠海全志科技股份有限公司 Clock source switch method and system
CN105117277A (en) * 2015-08-26 2015-12-02 深圳市华验防伪科技有限公司 Task cycle realization method and system
CN108319508B (en) * 2017-01-18 2020-10-20 中国移动通信集团公司 Method for converting HTTP synchronous request into asynchronous processing and server
CN108319508A (en) * 2017-01-18 2018-07-24 中国移动通信集团公司 HTTP synchronization requests switch to the method and server of asynchronous process
CN109213577A (en) * 2017-06-30 2019-01-15 武汉斗鱼网络科技有限公司 A kind of method, apparatus and computer equipment of thread sleep
CN108810557A (en) * 2017-07-10 2018-11-13 北京视联动力国际信息技术有限公司 A kind of method for processing video frequency, device, electronic equipment and storage medium
CN107590005A (en) * 2017-08-31 2018-01-16 武汉光谷信息技术股份有限公司 The acquisition methods and system of data in a kind of Redis memory queues
CN108306816A (en) * 2017-12-30 2018-07-20 方正璞华软件(武汉)股份有限公司 A kind of mail push method and system
CN110769046A (en) * 2019-10-17 2020-02-07 新华三信息安全技术有限公司 Message acquisition method and device, electronic equipment and machine-readable storage medium
CN110769046B (en) * 2019-10-17 2022-11-18 新华三信息安全技术有限公司 Message acquisition method and device, electronic equipment and machine-readable storage medium
CN112559160A (en) * 2021-02-19 2021-03-26 智道网联科技(北京)有限公司 Map engine multithread control method and device
WO2024099017A1 (en) * 2022-11-07 2024-05-16 蔚来移动科技有限公司 Process management method, and electronic device and storage medium

Also Published As

Publication number Publication date
CN100489788C (en) 2009-05-20

Similar Documents

Publication Publication Date Title
CN100489788C (en) Thread wakening control systems and method
CN102929720B (en) A kind of energy-conservation job scheduling system
US20140215236A1 (en) Power-efficient inter processor communication scheduling
CN105487634B (en) A kind of quantization power consumption control method towards isomery many-core chip
CN102073572B (en) For method for supervising and the system of polycaryon processor
CN108536531B (en) Task scheduling and power management method based on single chip microcomputer
CN101196836A (en) Method and device for resetting circuit of watchdog
CN102955549A (en) Power supply management method and power supply management system for multi-core CPU (central processing unit) and CPU
CN102014021A (en) Method and device for controlling connection/disconnection of data link
CN105608049A (en) Method and device for controlling CPU of intelligent terminal
WO2016115956A1 (en) Scheduling method and scheduling device for business system based on cloud computing
CN103345415A (en) Terminal energy-saving method and device for management timer
CN104050137A (en) Method and device for operating inner cores in heterogeneous operation system
CN101916138A (en) Method and device for switching working state and sleep state of central processing unit
CN111200541B (en) Network data processing method and device
CN106970835A (en) Fixed priority resource limited system level energy consumption optimization method
CN103092319A (en) Method and device for processing data
CN104754704A (en) Method for controlling terminal to hibernate and terminal
CN103108039A (en) Service quality guarantee method in low-energy cluster environment
CN105451311B (en) The synchronous method and device of a kind of dormancy awakening
CN115756143B (en) Energy-saving method and device for data packet processing, computer equipment and storage medium
CN101943944A (en) Idle history information-based energy-saving method for computing array
CN116513966A (en) Crane control method and device, electronic equipment and crane
CN102438230A (en) Terminal and data service processing method
CN103257894A (en) Program management method and electronic terminal

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant