CN109918141A - Thread execution method, device, terminal and storage medium - Google Patents

Thread execution method, device, terminal and storage medium Download PDF

Info

Publication number
CN109918141A
CN109918141A CN201910197390.9A CN201910197390A CN109918141A CN 109918141 A CN109918141 A CN 109918141A CN 201910197390 A CN201910197390 A CN 201910197390A CN 109918141 A CN109918141 A CN 109918141A
Authority
CN
China
Prior art keywords
thread
critical
dependence
cpu
execution
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
CN201910197390.9A
Other languages
Chinese (zh)
Other versions
CN109918141B (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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201910197390.9A priority Critical patent/CN109918141B/en
Publication of CN109918141A publication Critical patent/CN109918141A/en
Application granted granted Critical
Publication of CN109918141B publication Critical patent/CN109918141B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the present application provides a kind of thread execution method, device, terminal and storage medium.This method comprises: identification whether there is critical thread in the thread of blocked state;If in the thread in blocked state, there are critical threads, it is determined that the waiting chain of critical thread;It obtains and relies on the corresponding thread implementation strategy of thread;According to the corresponding thread implementation strategy of thread is relied on, executes and rely on thread.Technical solution provided by the embodiments of the present application, by in the case where determining to be in blocked state there are critical thread, analysis, which obtains, wakes up each thread that the critical thread is relied on, the corresponding thread implementation strategy of above-mentioned each thread is obtained later, and above-mentioned each thread is executed according to above-mentioned thread implementation strategy, so that the execution efficiency for waking up each thread that critical thread is relied on is promoted, critical thread is waken up required time shortening, so that the execution efficiency of critical thread is also promoted.

Description

Thread execution method, device, terminal and storage medium
Technical field
The invention relates to field of terminal technology, in particular to a kind of thread execution method, device, terminal and storage Medium.
Background technique
Thread is the minimum unit that operating system is able to carry out operation scheduling.The execution efficiency of thread directly influences terminal Service performance.
In practical application, operating system usually combines the execution priority of thread, different central processing unit (Central Processing Unit, CPU) power consumption and system load variation can it is various because usually determine thread execution plans Slightly, and carry out execution thread according to above-mentioned implementation strategy.
Summary of the invention
The embodiment of the present application provides a kind of thread execution method, device, terminal and storage medium.The technical solution is such as Under:
On the one hand, the embodiment of the present application provides a kind of thread execution method, which comprises
Identification whether there is critical thread in the thread of blocked state;
If in the thread in blocked state, there are the critical threads, it is determined that the waiting of the critical thread Chain, it is described wait include in chain the critical thread dependence thread, the dependences thread be wake up the critical thread according to Bad thread;
Obtain the corresponding thread implementation strategy of the dependence thread;
According to the corresponding thread implementation strategy of the dependence thread, the dependence thread is executed.
On the other hand, the embodiment of the present application provides a kind of thread executive device, and described device includes:
Thread identification module whether there is critical thread in the thread in blocked state for identification;
Chain determining module is waited, if for there are the critical threads in the thread in blocked state, it is determined that The waiting chain of the critical thread, the dependence thread waited in chain including the critical thread, the dependence thread is to call out The thread that the critical thread of waking up is relied on;
Strategy obtains module, for obtaining the corresponding thread implementation strategy of the dependence thread;
Thread execution module, for executing the dependence thread according to the corresponding thread implementation strategy of the dependence thread.
In another aspect, the embodiment of the present application provides a kind of terminal, the terminal includes processor and memory, the storage Device is stored with computer program, and the computer program is loaded as the processor and executed to realize line described in above-mentioned aspect Cheng Zhihang method.
Another aspect, the embodiment of the present application provide a kind of computer readable storage medium, the computer-readable storage medium Computer program is stored in matter, the computer program is loaded as processor and executed to realize thread described in above-mentioned aspect Execution method.
Technical solution provided by the embodiments of the present application can be brought the following benefits:
The critical thread institute is waken up by the way that in the case where determining to be in blocked state there are critical thread, analysis is obtained The each thread relied on, obtains the corresponding thread implementation strategy of above-mentioned each thread, and according to above-mentioned thread implementation strategy later Above-mentioned each thread is executed, so that the execution efficiency for waking up each thread that critical thread is relied on is promoted, critical thread It is waken up required time shortening, so that the execution efficiency of critical thread is also promoted.
Detailed description of the invention
Fig. 1 is the flow chart for the thread execution method that the application one embodiment provides;
Fig. 2 is the schematic diagram for the waiting chain that another embodiment of the application provides;
Fig. 3 is the flow chart for the thread execution method that the application one embodiment provides;
Fig. 4 is the block diagram for the thread executive device that the application one embodiment provides;
Fig. 5 is the block diagram for the terminal that the application one embodiment provides.
Specific embodiment
To keep the purposes, technical schemes and advantages of the application clearer, below in conjunction with attached drawing to the application embodiment party Formula is described in further detail.
Firstly, first to this application involves related terms be introduced.
Critical thread: be refer to influence system performance thread, above system performance be user can direct feel arrive Performance, such as the render time of current display picture, image quality, frame per second etc..Above-mentioned critical thread can be rendering line Journey.
The dependence thread of critical thread: refer to and wake up the thread that critical thread is relied on.Critical thread needs when being executed Rely on the resource that thread provides, for example rely on the implementing result of thread, synchrolock etc..In this case, critical thread needs Just start to execute relying on thread and being finished.
The waiting chain of critical thread: wait chain include wake up critical thread all dependence threads and it is above-mentioned it is all according to Rely the dependence between thread.Waiting chain includes m branch, and every branch includes n grades of threads, and m is positive integer, and n is also positive Integer.Wherein, the value of n corresponding to every branch can be identical, can not also be identical.The 1st grade of thread in every branch Refer to and wake up the thread that critical thread is relied on, the i+1 grade thread in every branch, which refers to, wakes up what i-stage thread was relied on Thread, the value of i are the positive integer less than or equal to n-1.The wake-up mode of n-th grade of thread in every branch is interruption side Formula.
Interrupt mode: CPU temporarily stops the execution of current program, and turning to go to execute is at the interruption of some random state of affairs service Program is managed, restores the execution of original program after being disposed automatically.
The big core of CPU: the higher CPU of running frequency, running frequency are usually 2.6Ghz, mainly for the treatment of operation type journey Sequence, such as game class application program, live streaming class application program etc..The quantity of the big core of CPU can be 1,2,4 etc..
CPU small nut: the lower CPU of running frequency, running frequency is usually 2.1Ghz, mainly for the treatment of common application Program.The quantity of the big core of CPU can be 4,6,9 etc..The running frequency of the big core of CPU is typically larger than the fortune of CPU small nut Line frequency.
In the related technology, if some critical thread relies on the implementing result of other threads when executing, terminal first carries out it Its thread executes critical thread again, if the execution priority of other threads above-mentioned at this time system resource that is lower, or being assigned to When less, the execution efficiency of other threads is lower, causes the execution efficiency of critical thread relatively low.
Based on this, the embodiment of the present application provides a kind of thread execution method, device, terminal and storage medium.In this Shen Please embodiment provide technical solution in, by the way that in the case where determining to be in blocked state there are critical thread, analysis is obtained It takes and wakes up each thread that the critical thread is relied on, obtain the corresponding thread implementation strategy of above-mentioned each thread later, and press Above-mentioned each thread is executed according to above-mentioned thread implementation strategy, so that waking up the execution efficiency for each thread that critical thread is relied on It is promoted, critical thread is waken up required time shortening, so that the execution efficiency of critical thread is also promoted.
Technical solution provided by the embodiments of the present application, the executing subject of each step are terminals.Optionally, there is operation in terminal Operating system, the operating system are also possible to Android (Android) operating system, are also possible to IOS operating system.Each step Executing subject is also possible to operating system.In the embodiment of the present application, it is only carried out so that the executing subject of each step is terminal as an example Explanation.
Referring to FIG. 1, it illustrates the flow charts of the thread execution method shown in the application one embodiment.This method can To be applied in terminal, this method is comprised the following steps:
Step 101, identification whether there is critical thread in the thread of blocked state.
Blocked state refers to thread because certain reason abandons the CPU right to use, temporarily ceases the state of operation.Thread is in Blocked state may have following reason:
1) obstruction, namely wait () method by calling thread, the completion for allowing thread that certain is waited to work are waited;2) synchronous Obstruction namely thread are obtaining the failure of synchronized synchrolock (because lock is occupied by other threads), it, which can enter, synchronizes Blocked state;3) other block, namely by call thread sleep () or join () or have issued I/O request when, thread Blocked state can be entered.
In the embodiment of the present application, thread is in the reason of blocked state usually waiting obstruction and synchronous obstruction.
Critical thread be refer to influence system performance thread, above system performance be user can direct feel arrive Performance, such as the current render time for showing picture, image quality, frame per second etc..
Optionally, above-mentioned critical thread can be rendering thread, step 101 specific implementation are as follows: in call operation system Preset interface identification is in the thread of blocked state with the presence or absence of rendering thread.
In one possible implementation, terminal is determining that currently running application program is the application of preset kind When program, the step of subsequent identification whether there is critical thread in the thread of blocked state is executed.Above-mentioned preset kind Application program can be game class application program, live streaming class application program, video calling class application program etc..Another kind can In the implementation of energy, terminal executes subsequent identification and is in obstruction shape in the case where currently display picture meets preset condition The step of whether there is critical thread in the thread of state.The image quality that above-mentioned preset condition can be current display picture is lower than Preset value is also possible to currently show that Caton occurs in picture.Wherein, currently show that picture Caton occurs and can refer to application program Frame per second be less than preset frame rate, may also mean that the frame per second of application program declines, can also be the frame per second of application program Decrease speed is greater than pre-set velocity, and the embodiment of the present application is not construed as limiting this.Wherein, above-mentioned preset value, preset frame rate, default speed Degree can be set according to actual needs, and the embodiment of the present application is not construed as limiting this.
Step 102, if there are critical threads in the thread in blocked state, it is determined that the waiting chain of critical thread.
Wait the dependence thread in chain including critical thread.It relies on thread and refers to the thread that wake-up critical thread is relied on. The quantity for relying on thread can be one, be also possible to multiple.It was introduced in foregoing embodiments, it may the reason of blocked state It is to wait obstruction, synchronous obstruction etc..In conjunction with above-mentioned reason, in the embodiment of the present application, dependence thread is directed to critical thread and mentions For presetting the thread of resource, above-mentioned default resource can be the implementing result for relying on thread, be also possible to synchrolock.
Optionally, step 102 may be implemented are as follows:
Step 102a is waken up in history by recursive fashion and determines dependence thread in record;
Recursive fashion refers to be triggered from primary condition, in such a way that recurrence relation is in the hope of result.History wakes up record For describing wake-up information of the critical thread in previous implementation procedure.
Optionally, relying on thread includes m branch, and m is positive integer.Every branch in m branch includes n grades, and n is positive Integer.The value of the corresponding n of every branch can be identical, can not also be identical.N-th grade in every branch relies on calling out for thread The mode of waking up is interrupt mode.Interrupt mode refers to that CPU temporarily stops the execution of current program, and turning to go to execute is some random state of affairs The interrupt handling routine of service restores the mode of the execution of original program automatically after being disposed.
Optionally, step 102a is implemented are as follows:
1, the 1st grade of dependence line being determined as the thread that critical thread was waken up in history wake-up record in kth article branch Journey, k are the positive integer less than or equal to m;
2, the thread of the i-stage dependence thread waken up in kth branch in history wake-up record is determined as kth item branch I+1 grade in chain relies on thread, and i is the positive integer less than or equal to n-1.
Step 102b will rely on thread and be added to waiting chain.
Above-mentioned each dependence thread is added to waiting chain by terminal.Optionally, terminal is after determining to wait chain, storage Above-mentioned waiting chain.The embodiment of the present application is not construed as limiting the storage mode and store path that wait chain.Optionally, terminal Above-mentioned waiting chain is stored in lists.
In a specific example, in conjunction with reference Fig. 2, it illustrates the waiting chains shown in the application one embodiment Schematic diagram.The waiting chain of critical thread A includes 3 branches.Wherein, the 1st article of branch includes relying on thread B, relies on calling out for thread B The mode of waking up is interrupt mode;2nd article of branch includes the 1st grade of dependence thread C, the 2nd grade of dependence thread E, and the 2nd grade relies on thread E's Wake-up mode is interrupt mode, and the 3rd article of branch includes the 1st grade of dependence thread D and the 2nd grade of dependence thread F and G, the 2nd grade of dependence line The wake-up mode of journey F and G are interrupt mode.
Step 103, it obtains and relies on the corresponding thread implementation strategy of thread.
It relies on the corresponding thread implementation strategy of thread and relies on thread for indicate how executing.Optionally, step 103 can be with It include: to improve the execution priority for relying on thread;And/or the big core of central processing unit CPU is tied to by thread is relied on.
What the execution priority of thread was used to indicate thread executes sequence.The execution priority of thread is higher, then the thread The sequence being performed is more forward;The execution priority of thread is lower, then the thread execution sequence more rearward.Under normal conditions, The execution priority highest of thread in the state of execution.In the embodiment of the present application, the execution of terminal raising dependence thread is excellent First grade, also will the dependence thread execution sequence shift to an earlier date.
The big core of CPU refers to the higher CPU of running frequency, and running frequency is usually 2.6Ghz, mainly for the treatment of operation Type program, such as game class application program, live streaming class application program etc..The quantity of the big core of CPU can be 1,2,4 etc. Deng.
Dependence thread, which is tied to the big core of CPU, that is to say the affinity set between the dependence thread and the big core of CPU, later The dependence thread can only be run on the bound big core of CPU.Will rely on thread be tied to the big core of CPU can be by mask form Or tabular form is completed, the embodiment of the present application is not construed as limiting this.Mask form refers to that mask is converted into binary form, covers The binary system that is converted of code is used to indicate the serial number of kernel from lowest order to highest order, when the value of a certain position is 1, then the position Corresponding kernel is bound.Tabular form refers to the serial number for directly recording the core to be bound in lists.
Optionally, when the quantity of the big core of CPU is multiple, terminal detects the load of the big core of each CPU, load is met pre- If the big core of the CPU of condition is determined as the big core of CPU with dependence thread binding.Above-mentioned preset condition can be the load of the big core of CPU Lower than preset value, the load for being also possible to the big core of CPU is minimum.Above-mentioned preset value can be set according to actual needs, and the application is real It applies example and this is not construed as limiting.
In a specific example, step 103 specific implementation are as follows:
1, it is the big core of CPU or CPU small nut that detection, which relies on bound in thread,;
If terminal carries out tying up core using mask form, first determine 1 in binary number that mask is converted to locating for position Number determines according to the digit rely on CPU core bound in thread later, later according to the operation of bound CPU core frequency Rate judgement is the big core of CPU or CPU small nut.
If terminal carries out tying up core using tabular form, terminal is read directly from list relies on CPU bound in thread Kernel is later the big core of CPU or CPU small nut according to the judgement of the running frequency of bound CPU core.
If 2, relying on bound in thread is CPU small nut, thread will be relied on and CPU small nut is unbinding, and will relied on Thread and the big core of CPU are bound.
If 3, rely on thread bound in be the big core of CPU, detect rely on thread execution priority whether be less than it is default Grade;
Predetermined level can be set according to actual needs, and the embodiment of the present application is not construed as limiting this.
If the execution priority for 4, relying on thread is less than predetermined level, the execution priority for relying on thread is improved.
Step 104, it according to the corresponding thread implementation strategy of thread is relied on, executes and relies on thread.
Terminal executes above-mentioned dependence thread according to the thread implementation strategy got.
Optionally, for terminal after having executed dependence thread, critical thread switches to ready state by blocked state, cuts later Shift to execution state.
In a specific example, in conjunction with reference Fig. 3, it illustrates the thread execution shown in the application one embodiment The flow chart of method.Terminal first identifies the pass thread in blocked state, searches critical thread by recursive fashion later Chain is waited, by critical thread and the thread priority in chain is waited to be promoted, is put into big core when necessary and executes.
In conclusion technical solution provided by the embodiments of the present application, by determining that there are critical threads to be in blocking In the case where state, analysis, which obtains, wakes up each thread that the critical thread is relied on, and it is corresponding to obtain above-mentioned each thread later Thread implementation strategy, and execute above-mentioned each thread according to above-mentioned thread implementation strategy, relied on so that waking up critical thread The execution efficiency of each thread promoted, critical thread is waken up the required time and shortens, so that critical thread Execution efficiency is also promoted.
In the process of running, user can interact application program, and terminal can be according to the friendship performed by user at this time Interoperability executes next task, and the critical thread run needed for terminal at this time is also the terminal institute in lists continually changing The critical thread of storage and the waiting chain of critical thread are also required to timely update.Based on embodiment illustrated in fig. 1 provide can It selects in embodiment, this method further include:
1, whether there are incidence relations with the real-time task of the application program in front stage operation for critical thread.
Real-time task refers to that will executing in preset duration for task, above-mentioned preset duration can be set according to actual needs Fixed, the embodiment of the present application is not construed as limiting this.
After critical thread and real-time task refer to that critical thread is performed there are incidence relation, terminal can show above-mentioned Real-time task.After critical thread and real-time task refer to that critical thread is performed there is no incidence relation, terminal will not be shown Show above-mentioned real-time task.
Optionally, whether terminal monitoring receives the interaction behaviour corresponding to the application program in front stage operation of user's triggering Make, if whether real-time with the application program of front stage operation terminal monitoring to the interactive operation is received, detects critical thread There are incidence relations for task.
In other possible implementations, whether terminal answers with front stage operation every preset time detection critical thread With the real-time task of program there are incidence relation, above-mentioned preset time can be set according to actual needs, the embodiment of the present application pair This is not construed as limiting.
If 2, incidence relation is not present in critical thread and real-time task, delete critical thread and critical thread etc. To chain.
If critical thread and real-time task are not present incidence relation, terminal is by the critical thread and key lines in list The waiting chain of journey is deleted, to update list.
User is possible to interact in the operational process of application program, terminal interaction according to performed by user Operation shows different pictures, therefore the critical thread urgently run in terminal is continually changing.In the embodiment of the present application, Terminal waits the list of chain to be updated storage according to real-time task, after avoiding terminal from first carrying out unnecessary critical thread Respond interactive operation performed by user, time needed for can reduce the interactive operation of terminal response user.
In conclusion technical solution provided by the embodiments of the present application, passes through the reality according to the application program in front stage operation When task the waiting chain of the critical thread and critical thread stored in list is updated, can be first carried out to avoid terminal Interactive operation performed by user is responded after unnecessary critical thread, is reduced needed for the interactive operation of terminal response user Time.
Referring to FIG. 4, the block diagram of the thread executive device provided it illustrates the application one embodiment.The device can be with Include: thread identification module 401, chain determining module 402, strategy is waited to obtain module 403 and thread execution module 404.
Thread identification module 401 whether there is critical thread in the thread in blocked state for identification.
Chain determining module 402 is waited, if for there are the critical threads in the thread in blocked state, really The waiting chain of the fixed critical thread, the dependence thread waited in chain including the critical thread, the dependence thread are Wake up the thread that the critical thread is relied on.
Strategy obtains module 403, for obtaining the corresponding thread implementation strategy of the dependence thread.
Thread execution module 404, for executing the dependence line according to the corresponding thread implementation strategy of the dependence thread Journey.
In conclusion technical solution provided by the embodiments of the present application, by determining that there are critical threads to be in blocking In the case where state, analysis, which obtains, wakes up each thread that the critical thread is relied on, and it is corresponding to obtain above-mentioned each thread later Thread implementation strategy, and execute above-mentioned each thread according to above-mentioned thread implementation strategy, relied on so that waking up critical thread The execution efficiency of each thread promoted, critical thread is waken up the required time and shortens, so that critical thread Execution efficiency is also promoted.
In the alternative embodiment provided based on Fig. 4 embodiment, the waiting chain determining module 402 is used for:
It is waken up by recursive fashion in history and determines the dependence thread in record, the recursive fashion refers to from initial strip Part triggering, in such a way that recurrence relation is in the hope of result;
The dependence thread is added to the waiting chain.
Optionally, the dependence thread includes m branch, and every branch in the m branch includes n grades, and the m is Positive integer, the n are positive integer, and the wake-up mode of n-th grade of dependence thread in every branch is interrupt mode;
The waiting chain determining module 402, is used for:
The 1st grade thread that the critical thread was waken up in history wake-up record is determined as in kth article branch Thread is relied on, the k is the positive integer less than or equal to m;
The thread of the i-stage dependence thread waken up in the kth branch in history wake-up record is determined as I+1 grade in the kth branch relies on thread, and the i is the positive integer less than or equal to n-1.
In the alternative embodiment that embodiment based on shown in Fig. 4 provides, the strategy obtains module 403, for mentioning The high execution priority for relying on thread;And/or the dependence thread is tied to the big core of central processing unit CPU.
Optionally, the strategy obtains module 403, is used for:
Detecting bound in the dependence thread is the big core of the CPU or CPU small nut;
If being the CPU small nut bound in the dependence thread, the dependence thread and the CPU small nut are released Binding, and the dependence thread and the big core of the CPU are bound;
If being the big core of the CPU bound in the dependence thread, detecting the execution priority for relying on thread is It is no to be less than predetermined level;
If the execution priority for relying on thread is less than the predetermined level, it is excellent to improve the execution for relying on thread First grade.
In the alternative embodiment that embodiment based on shown in Fig. 4 provides, the critical thread is rendering thread, described Thread identification module 401, in the preset interface identification thread in blocked state in call operation system whether There are the rendering threads.
In the alternative embodiment that embodiment based on shown in Fig. 4 provides, described device further include: first detection module With removing module (not shown).
First detection module, for detect the critical thread whether the real-time task with the application program in front stage operation There are incidence relations.
Removing module deletes institute if the incidence relation is not present for the critical thread and the real-time task State the waiting chain of critical thread and the critical thread.
Optionally, described device further include: the second detection module (not shown).
Second detection module, for detecting whether receiving the interaction behaviour for corresponding to the application program in front stage operation Make;
The first detection module, if executing the detection critical thread for detecting the interactive operation Whether with the real-time task of the application program in front stage operation there are incidence relations the step of.
It should be noted that device provided by the above embodiment is when realizing its function, only with above-mentioned each functional module It divides and carries out for example, can according to need in practical application and be completed by different functional modules above-mentioned function distribution, The internal structure of equipment is divided into different functional modules, to complete all or part of the functions described above.In addition, Apparatus and method embodiment provided by the above embodiment belongs to same design, and specific implementation process is detailed in embodiment of the method, this In repeat no more.
With reference to Fig. 5, it illustrates the structural block diagrams for the terminal that one exemplary embodiment of the application provides.In the application Terminal may include one or more such as lower component: processor 510 and memory 520.
Processor 510 may include one or more processing core.Processor 510 utilizes various interfaces and connection Various pieces in entire terminal, by running or executing the instruction being stored in memory 520, program, code set or instruction Collection, and the data being stored in memory 520 are called, execute the various functions and processing data of terminal.Optionally, processor 510 can use Digital Signal Processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA) at least one of example, in hardware realize.Processor 510 can integrating central processor (Central Processing Unit, CPU) and one or more of modem etc. combination.Wherein, the main processing operation system of CPU System and application program etc.;Modem is for handling wireless communication.It is understood that above-mentioned modem can not also It is integrated into processor 510, is realized separately through chip piece.
Optionally, above-mentioned each embodiment of the method mentions under realizing when processor 510 executes the program instruction in memory 520 The thread execution method of confession.
Memory 520 may include random access memory (Random Access Memory, RAM), also may include read-only Memory (Read-Only Memory).Optionally, which includes non-transient computer-readable medium (non- transitory computer-readable storage medium).Memory 520 can be used for store instruction, program, generation Code, code set or instruction set.Memory 520 may include storing program area and storage data area, wherein storing program area can store Instruction for realizing operating system, the instruction at least one function, for realizing the finger of above-mentioned each embodiment of the method Enable etc.;Storage data area, which can be stored, uses created data etc. according to terminal.
The structure of above-mentioned terminal is only illustrative, and in actual implementation, terminal may include more or fewer components, Such as: display screen etc., the present embodiment is not construed as limiting this.
It will be understood by those skilled in the art that the restriction of the not structure paired terminal 500 of structure shown in Fig. 5, can wrap It includes than illustrating more or fewer components, perhaps combine certain components or is arranged using different components.
In the exemplary embodiment, a kind of computer readable storage medium, the computer-readable storage medium are additionally provided Computer program is stored in matter, the computer program is loaded by the processor of terminal and executed to realize that the above method is implemented Each step in example.
In the exemplary embodiment, a kind of computer program product is additionally provided, when the computer program product is performed When, for realizing the function of each step in above method embodiment.
It should be understood that referenced herein " multiple " refer to two or more."and/or", description association The incidence relation of object indicates may exist three kinds of relationships, for example, A and/or B, can indicate: individualism A exists simultaneously A And B, individualism B these three situations.Character "/" typicallys represent the relationship that forward-backward correlation object is a kind of "or".
Above-mentioned the embodiment of the present application serial number is for illustration only, does not represent the advantages or disadvantages of the embodiments.
The foregoing is merely the exemplary embodiments of the application, all in spirit herein not to limit the application Within principle, any modification, equivalent replacement, improvement and so on be should be included within the scope of protection of this application.

Claims (11)

1. a kind of thread execution method, which is characterized in that the described method includes:
Identification whether there is critical thread in the thread of blocked state;
If in the thread in blocked state, there are the critical threads, it is determined that the waiting chain of the critical thread, institute The dependence thread waited in chain including the critical thread is stated, the thread that relies on is the line for waking up the critical thread and being relied on Journey;
Obtain the corresponding thread implementation strategy of the dependence thread;
According to the corresponding thread implementation strategy of the dependence thread, the dependence thread is executed.
2. the method according to claim 1, wherein the waiting chain of the determination critical thread, comprising:
It is waken up by recursive fashion in history and determines the dependence thread in record, the recursive fashion refers to be touched from primary condition Hair, in such a way that recurrence relation is in the hope of result;
The dependence thread is added to the waiting chain.
3. according to the method described in claim 2, it is characterized in that, the dependence thread includes m branch, the m branch In every branch include n grades, the m is positive integer, and the n is positive integer, n-th grade of dependence thread in every branch Wake-up mode be interrupt mode;
Described waken up by recursive fashion in history determines the dependence thread in record, comprising:
The 1st grade of dependence thread that the critical thread was waken up in history wake-up record being determined as in kth article branch Thread, the k are the positive integer less than or equal to m;
The thread of the i-stage dependence thread waken up in the kth branch in history wake-up record is determined as described I+1 grade in kth branch relies on thread, and the i is the positive integer less than or equal to n-1.
4. the method according to claim 1, wherein the corresponding thread of the dependence thread that obtains executes plan Slightly, comprising:
Improve the execution priority for relying on thread;And/or that the dependence thread is tied to central processing unit CPU is big Core.
5. according to the method described in claim 4, it is characterized in that, described improve the execution priority for relying on thread;With/ Or, the dependence thread is tied to the big core of central processing unit CPU, comprising:
Detecting bound in the dependence thread is the big core of the CPU or CPU small nut;
If being the CPU small nut bound in the dependence thread, the dependence thread and CPU small nut releasing are tied up It is fixed, and the dependence thread and the big core of the CPU are bound;
If being the big core of the CPU bound in the dependence thread, whether small the execution priority for relying on thread is detected In predetermined level;
If the execution priority for relying on thread is less than the predetermined level, it is preferential to improve the execution for relying on thread Grade.
6. method according to any one of claims 1 to 5, which is characterized in that the critical thread is rendering thread, described Identification whether there is critical thread in the thread of blocked state, comprising:
It whether there is the rendering thread in the preset interface identification thread in blocked state in call operation system.
7. method according to any one of claims 1 to 5, which is characterized in that the waiting of the determination critical thread After chain, further includes:
Detect the critical thread whether with the real-time task of the application program in front stage operation there are incidence relations;
If the incidence relation is not present in the critical thread and the real-time task, the critical thread, Yi Jisuo are deleted State the waiting chain of critical thread.
8. the method according to the description of claim 7 is characterized in that the detection critical thread whether in front stage operation The real-time task of application program there are before incidence relation, comprising:
It detects whether to receive the interactive operation for corresponding to the application program in front stage operation;
If detecting the interactive operation, execute the detection critical thread whether with the application program in front stage operation Real-time task the step of there are incidence relations.
9. a kind of thread executive device, which is characterized in that described device includes:
Thread identification module whether there is critical thread in the thread in blocked state for identification;
Chain determining module is waited, if for there are the critical threads in the thread in blocked state, it is determined that described The waiting chain of critical thread, the dependence thread waited in chain including the critical thread, the dependence thread is to wake up institute State the thread that critical thread is relied on;
Strategy obtains module, for obtaining the corresponding thread implementation strategy of the dependence thread;
Thread execution module, for executing the dependence thread according to the corresponding thread implementation strategy of the dependence thread.
10. a kind of terminal, which is characterized in that the terminal includes processor and memory, and the memory is stored with computer Program, the computer program are loaded by the processor and are executed to realize thread as claimed in any one of claims 1 to 8 Execution method.
11. a kind of computer readable storage medium, which is characterized in that be stored with computer in the computer readable storage medium Program, the computer program are loaded by processor and are executed to realize that thread as claimed in any one of claims 1 to 8 executes Method.
CN201910197390.9A 2019-03-15 2019-03-15 Thread execution method, thread execution device, terminal and storage medium Active CN109918141B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910197390.9A CN109918141B (en) 2019-03-15 2019-03-15 Thread execution method, thread execution device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910197390.9A CN109918141B (en) 2019-03-15 2019-03-15 Thread execution method, thread execution device, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN109918141A true CN109918141A (en) 2019-06-21
CN109918141B CN109918141B (en) 2020-11-27

Family

ID=66965024

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910197390.9A Active CN109918141B (en) 2019-03-15 2019-03-15 Thread execution method, thread execution device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN109918141B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111767138A (en) * 2020-06-09 2020-10-13 Oppo广东移动通信有限公司 Resource allocation method, storage medium, and electronic device
CN111767124A (en) * 2020-06-03 2020-10-13 Oppo广东移动通信有限公司 Request response method, device, storage medium and electronic equipment
CN111782410A (en) * 2020-06-30 2020-10-16 北京字节跳动网络技术有限公司 Lock jam monitoring method and device, electronic equipment and computer readable medium
CN111831462A (en) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 IO request processing method and device, storage medium and electronic equipment
CN112328392A (en) * 2020-10-27 2021-02-05 金蝶软件(中国)有限公司 Data processing method and related equipment
CN113377517A (en) * 2021-06-28 2021-09-10 上海鲲宜软件技术有限公司 Thread scheduling method and system based on real-time operating system
WO2021212885A1 (en) * 2020-04-23 2021-10-28 苏州大学 Thread signal operating method and system for embedded real-time operating system
CN116578422A (en) * 2023-06-15 2023-08-11 荣耀终端有限公司 Resource allocation method and electronic equipment
CN116701320A (en) * 2022-12-01 2023-09-05 荣耀终端有限公司 Log generation method and related device
CN116737346A (en) * 2023-08-14 2023-09-12 南京翼辉信息技术有限公司 Scheduling configuration system for large and small core processors and implementation method thereof
CN117130769A (en) * 2023-02-25 2023-11-28 荣耀终端有限公司 Frequency modulation method, training method of frequency adjustment neural network and electronic equipment

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1955931A (en) * 2005-09-30 2007-05-02 科威尔公司 Scheduling in a multicore architecture
US20130117139A1 (en) * 2008-11-17 2013-05-09 Greenwise Bankcard LLC Payment Transaction Processing
US20140258697A1 (en) * 2013-03-07 2014-09-11 Mips Technologies, Inc. Apparatus and Method for Transitive Instruction Scheduling
CN104094235A (en) * 2012-01-23 2014-10-08 超威半导体公司 Multithreaded computing
CN104111848A (en) * 2014-06-27 2014-10-22 华中科技大学 Multi-thread software dynamic upgrading method based on asynchronous check points
CN105955567A (en) * 2016-04-21 2016-09-21 北京元心科技有限公司 Method and device for displaying user interface and progress bar
CN107133092A (en) * 2017-05-24 2017-09-05 努比亚技术有限公司 Multi-thread synchronization processing method, terminal and computer-readable recording medium
CN107402813A (en) * 2017-06-21 2017-11-28 努比亚技术有限公司 The method and mobile terminal of a kind of resource allocation, computer-readable recording medium
CN108509260A (en) * 2018-01-31 2018-09-07 深圳市万普拉斯科技有限公司 Thread identifying processing method, apparatus, computer equipment and storage medium
CN109144863A (en) * 2018-08-10 2019-01-04 广东电网有限责任公司信息中心 A kind of automated testing method based on network system
CN109213601A (en) * 2018-09-12 2019-01-15 华东师范大学 A kind of load-balancing method and equipment based on CPU-GPU
CN109426563A (en) * 2017-08-31 2019-03-05 华为技术有限公司 A kind of process management method and device

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1955931A (en) * 2005-09-30 2007-05-02 科威尔公司 Scheduling in a multicore architecture
US20130117139A1 (en) * 2008-11-17 2013-05-09 Greenwise Bankcard LLC Payment Transaction Processing
CN104094235A (en) * 2012-01-23 2014-10-08 超威半导体公司 Multithreaded computing
US20140258697A1 (en) * 2013-03-07 2014-09-11 Mips Technologies, Inc. Apparatus and Method for Transitive Instruction Scheduling
CN104111848A (en) * 2014-06-27 2014-10-22 华中科技大学 Multi-thread software dynamic upgrading method based on asynchronous check points
CN105955567A (en) * 2016-04-21 2016-09-21 北京元心科技有限公司 Method and device for displaying user interface and progress bar
CN107133092A (en) * 2017-05-24 2017-09-05 努比亚技术有限公司 Multi-thread synchronization processing method, terminal and computer-readable recording medium
CN107402813A (en) * 2017-06-21 2017-11-28 努比亚技术有限公司 The method and mobile terminal of a kind of resource allocation, computer-readable recording medium
CN109426563A (en) * 2017-08-31 2019-03-05 华为技术有限公司 A kind of process management method and device
CN108509260A (en) * 2018-01-31 2018-09-07 深圳市万普拉斯科技有限公司 Thread identifying processing method, apparatus, computer equipment and storage medium
CN109144863A (en) * 2018-08-10 2019-01-04 广东电网有限责任公司信息中心 A kind of automated testing method based on network system
CN109213601A (en) * 2018-09-12 2019-01-15 华东师范大学 A kind of load-balancing method and equipment based on CPU-GPU

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021212885A1 (en) * 2020-04-23 2021-10-28 苏州大学 Thread signal operating method and system for embedded real-time operating system
CN111767124A (en) * 2020-06-03 2020-10-13 Oppo广东移动通信有限公司 Request response method, device, storage medium and electronic equipment
CN111767138A (en) * 2020-06-09 2020-10-13 Oppo广东移动通信有限公司 Resource allocation method, storage medium, and electronic device
CN111782410A (en) * 2020-06-30 2020-10-16 北京字节跳动网络技术有限公司 Lock jam monitoring method and device, electronic equipment and computer readable medium
CN111782410B (en) * 2020-06-30 2023-06-27 抖音视界有限公司 Lock jam monitoring method and device, electronic equipment and computer readable medium
CN111831462A (en) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 IO request processing method and device, storage medium and electronic equipment
CN112328392A (en) * 2020-10-27 2021-02-05 金蝶软件(中国)有限公司 Data processing method and related equipment
CN113377517A (en) * 2021-06-28 2021-09-10 上海鲲宜软件技术有限公司 Thread scheduling method and system based on real-time operating system
CN113377517B (en) * 2021-06-28 2023-02-28 上海鲲宜软件技术有限公司 Thread scheduling method and system based on real-time operating system
CN116701320A (en) * 2022-12-01 2023-09-05 荣耀终端有限公司 Log generation method and related device
CN117130769A (en) * 2023-02-25 2023-11-28 荣耀终端有限公司 Frequency modulation method, training method of frequency adjustment neural network and electronic equipment
CN116578422A (en) * 2023-06-15 2023-08-11 荣耀终端有限公司 Resource allocation method and electronic equipment
CN116737346A (en) * 2023-08-14 2023-09-12 南京翼辉信息技术有限公司 Scheduling configuration system for large and small core processors and implementation method thereof
CN116737346B (en) * 2023-08-14 2023-10-24 南京翼辉信息技术有限公司 Scheduling configuration system for large and small core processors and implementation method thereof

Also Published As

Publication number Publication date
CN109918141B (en) 2020-11-27

Similar Documents

Publication Publication Date Title
CN109918141A (en) Thread execution method, device, terminal and storage medium
CN106802826B (en) Service processing method and device based on thread pool
CN107450971B (en) Task processing method and device
CN103309588B (en) A kind of method, Apparatus and system preventing mobile terminal maloperation
US20140115603A1 (en) Method, apparatus, and system for scheduling processor core in multiprocessor core system
CN106569585B (en) A kind of method and terminal managing program process
CN107040578A (en) Method of data synchronization, device and system
CN109343902A (en) Operation method, device, terminal and the storage medium of audio processing components
CN108762831A (en) Application program preloads method, apparatus, storage medium and terminal
CN103064925A (en) Method and device for regularly processing webpage
CN110221936A (en) Database alert processing method, device, equipment and computer readable storage medium
CN110347427A (en) The optimization method and device of web page code
CN114466227B (en) Video analysis method and device, electronic equipment and storage medium
CN104714839A (en) Method and device for controlling life cycle of processes
CN113190427A (en) Caton monitoring method and device, electronic equipment and storage medium
CN109741159A (en) Clear account checking method, device and computer equipment
CN107809533A (en) A kind of information interacting method and device, terminal and readable storage medium storing program for executing
CN108011860A (en) A kind of method and device for handling broadcast message
CN110795239A (en) Application memory leakage detection method and device
CN103093529A (en) Method for dynamically refreshing data
CN106933681B (en) It is a kind of multipair as blocking method and its system
CN115955557A (en) Kadun analysis method and device thereof
CN102930046B (en) Data processing method, computing node and system
CN113687942B (en) Detection method and device and electronic equipment
CN115617518A (en) Thread management method and device, electronic equipment and storage medium

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