[go: nahoru, domu]

CN107491346A - A kind of task processing method of application, apparatus and system - Google Patents

A kind of task processing method of application, apparatus and system Download PDF

Info

Publication number
CN107491346A
CN107491346A CN201610407172.XA CN201610407172A CN107491346A CN 107491346 A CN107491346 A CN 107491346A CN 201610407172 A CN201610407172 A CN 201610407172A CN 107491346 A CN107491346 A CN 107491346A
Authority
CN
China
Prior art keywords
task
application
thread
idle condition
queue
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
CN201610407172.XA
Other languages
Chinese (zh)
Other versions
CN107491346B (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610407172.XA priority Critical patent/CN107491346B/en
Publication of CN107491346A publication Critical patent/CN107491346A/en
Application granted granted Critical
Publication of CN107491346B publication Critical patent/CN107491346B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

This application provides a kind of task processing method of application, apparatus and system, methods described includes:The background task of application is stored in task queue;Monitor whether application is in idle condition;When listening to using idle condition is in, trigger a default mission thread and being preserved in the task queue for task is performed according to serial executive mode.The technical scheme that the application provides, causes to apply interim card problem in face of multitask, it is proposed that handles task mechanism using idle, can effectively improve using startability and process performance.For the characteristic of terminal system resource-constrained, the mode that background task is serially performed using single thread is proposed, so as to ensure the normal execution of background task, and can enough rationally utilizes terminal system resource, as far as possible after execution platform task when, reduce to application foreground task influence.

Description

A kind of task processing method of application, apparatus and system
Technical field
The application is related to field of computer technology, more particularly to a kind of task processing method of application, apparatus and system.
Background technology
Using also referred to as application program (Application, abridge APP), it refers to the third-party application journey of intelligent terminal Sequence.User realizes various software functions by the APP on intelligent terminal.
At present, APP in start-up course or in use, usually occur many tasks main thread or its The situation that his thread performs simultaneously.And the limitation of the processor performance, memory size due to intelligent terminal, excessive tasks in parallel Processing may result in system and be unable to timely processing completion, and APP interim card problems can be caused when serious, cause APP runnabilities poor, Consumer's Experience is bad.
The content of the invention
Technical problems to be solved in this application are to provide a kind of task processing method of application, for improving APP operations Performance.
Present invention also provides a kind of Task Processing Unit of application and system, to ensure the above method in practice Realize and apply.
In order to solve the above-mentioned technical problem, the application first aspect provides a kind of task processing system of application, and this is System includes:
At least one processor and at least one memory, at least one application is stored with least one memory Instruction;At least one processor be used to performing stored at least one memory to give an order:
The background task of application is stored in task queue;
Monitor whether application is in idle condition;
When listening to using idle condition is in, trigger a default mission thread and performed according to serial executive mode Being preserved in the task queue for task.
The application second aspect provides a kind of task processing method of application, and this method includes:
The background task of application is stored in task queue;
Monitor whether application is in idle condition;
When listening to using idle condition is in, trigger a default mission thread and performed according to serial executive mode Being preserved in the task queue for task.
The application third aspect provides a kind of Task Processing Unit of application, and the device includes:
Memory cell, for the background task of application to be stored in task queue;
Monitoring unit, for monitoring whether application is in idle condition;
Trigger element, for when listening to using idle condition is in, triggering a default mission thread according to string Row executive mode performs being preserved in the task queue for task.
Compared with prior art, the application includes advantages below:
The technical scheme that the application provides, the problem of easily causing for multi-task parallel processing using operation interim card, carry Go out the mechanism using idle processing background task mechanism and single thread serial process background task, under both mechanism, The background task of application is stored in task queue;Monitor whether application is in idle condition;Applied when listening in sky During not busy state, trigger a default mission thread and being preserved in the task queue for task is performed according to serial executive mode. The technical scheme can either ensure the normal execution of background task, and and can enough rationally utilizes terminal system resource, held as far as possible During row background task, reduce the influence to application foreground task, so as to improve APP runnabilities, improve Consumer's Experience.
Brief description of the drawings
In order to illustrate more clearly of the technical scheme in the embodiment of the present application, make required in being described below to embodiment Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present application, for For those of ordinary skill in the art, without having to pay creative labor, it can also be obtained according to these accompanying drawings His accompanying drawing.
Fig. 1 is a kind of structural representation of the task processing system for application that the embodiment of the present application provides;
Fig. 2 is a kind of flow chart of the task processing method for application that the embodiment of the present application provides;
Fig. 3 is the flow chart for being directed to the tasks carrying process using background task that the embodiment of the present application provides;
Fig. 4 is a kind of structural representation of the Task Processing Unit for application that the embodiment of the present application provides.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is carried out clear, complete Site preparation describes, it is clear that described embodiment is only some embodiments of the present application, rather than whole embodiments.It is based on Embodiment in the application, those of ordinary skill in the art are obtained every other under the premise of creative work is not made Embodiment, belong to the scope of the application protection.
Exemplary explanation first is carried out to the system that the application provides.
A kind of task processing system for application that the application provides, can include:At least one processor and at least one Memory, storage application at least one memory, with the corresponding task queue of application, processor establishment thread, with And instruction;At least one processor is used to perform the instruction stored at least one memory.
In order to more clearly illustrate the structure of the system and operation principle, below with the system construction drawing shown in Fig. 1 Exemplified by come it is illustrative to the system.
A kind of task processing system structure chart of application shown in Figure 1, the system 100, including:
Processor 101 and memory 102;Processor 101 reads the instruction in memory 102, performs the instruction read.
Wherein, some exercisable instructions are stored with memory 102:
The background task of application is stored in task queue;
Monitor whether application is in idle condition;
When listening to using idle condition is in, trigger a default mission thread and performed according to serial executive mode Being preserved in the task queue for task.
Processor 101 will be first stored in corresponding with applying when performing these instructions to the related background task of application In task queue, the task queue is stored in memory 102.
As shown in figure 1, it is stored with memory using 1 and corresponding task queue 1;Certainly, also had in memory more It is individual to apply and each apply each self-corresponding task queue;Application 2 as shown in dotted portion in Fig. 1 and with applying 2 pairs The task queue 2 answered;Using 3 and with applying 3 corresponding task queues 3.Certainly, when realizing, an application can correspond to In a task queue, multiple tasks queue can also be corresponding with.It can be used in storing how many applications and right for memory The task queue answered, depending on the amount of capacity of memory, this application is not limited in any way.
In the system when realizing, memory can be that finger processor can be deposited by what the address in instruction directly accessed Reservoir, it is usually used in program and data that storage is active.
In the system when realizing, memory may also mean that additional storage, or claim external memory, such as:Hard disk, Disk, CD etc.;Memory such as can also be caching, deposit soon at the memory.
After the task of application is stored in into task queue, processor 101 monitors the busy-idle condition of application, when listening to During using in idle condition, processor 101 with regard to triggering prestore in the memory 102, for handling background task Thread, trigger the task in mission thread execution task queue.
Using the system, the background task that can be directed to application is managed, and a particular thread string for passing through establishment Row handles these background tasks, avoids creating multithreading and excessive expense is caused to system, so as to minimize occupancy system System resource, and can enough ensure the execution of background task.Analyzed from the operation angle of application, after handling application using single thread Platform task, the processing using foreground task can't be influenceed, the runnability of application can be greatly enhanced, so as to lift user Experience.
Processor 101 is when performing these instructions, it is not limited to which the background task specifically applied for which is entered Row processing, but can adapt to the application for needing to carry out background task processing in any one.Processor 101 can be only for one The background task of individual application is handled, and the background task of multiple applications can also be handled simultaneously.
A kind of task processing system of application shown in Fig. 1 only includes a processor and a memory.The application carries The system of confession can also have following several structural forms:
The first, system includes:Multiple processors (it is multiple including:And a memory at least two);This structure System, multiple processors all carry out data interaction with memory, and different processors is used for the background task for handling different application, Specific execute instruction is the same as described above.
Second, system includes:One processor and multiple memories;Different memories can be different for storing Using and its background task task queue;Then processor is used for the background task for handling all applications, and processor is according to application Mark, task triggering thread is read from corresponding memory and performs the background task of the application.
The third, system includes:Multiple processors and multiple memories;Different memories can be different for storing Using and its background task task queue;Then different processor is used for the background task for handling different applications;One processing Device can carry out data interaction with a memory or multiple memories;Specifically, mark of the processor according to application, from right Task triggering thread is read in the memory answered to perform the background task of the application.
A kind of task processing system for application that above content is provided the application is described.
Next, a kind of task processing method of the application provided the application is explained.
Fig. 2 is participated in, Fig. 2 is the method flow diagram that the application provides, and this method comprises the following steps 201 to step 203;
Step 201:The background task of application is stored in task queue.
Using referring to complete the computer program of a certain or multinomial particular job, it operates in user model, Ke Yihe User interacts, and can provide the user a variety of application experience.A application can be installed on user equipment, also may be used To install more money applications;Generally, user would generally install more money applications in equipment, to realize different functions.
Apply and be required for performing some background tasks in startup stage, to support the normal operation of application.Certainly, apply Need to be performed except also having some background tasks in startup stage, service stage upon actuation, such as application function Property parameters regularly update task, regular optimization task of application specific functions etc..The different backstages using its association Task identical may also may differ.
Such as:The startup stage applied in mobile phone Taobao is, it is necessary to perform netinit task, log-on message initialization is appointed Business, exception catching SDK initialization tasks, abnormal modified module initialization task etc..
Application scenarios for being provided with more money applications in equipment, then be directed to and establish a corresponding task per a application Queue, the background task of application is stored in applying in corresponding task queue.
When realizing, task queue corresponding to foundation is applied for what is had been turned in equipment, and preserve application and task team One-to-one relationship between row.Such as:One between the unique mark of application and the unique mark of task queue can be preserved One corresponding relation;The one-to-one relationship between the title of application and the address of task queue can also be preserved.
This corresponding relation based on preservation, quickly and accurately the background task related to some application can be stored In task queue corresponding to this application.
Then, it is described that the background task of application is stored in task queue, including:
According to the hierarchical relationship of the background task of application, the task of inferior grade is stored in first task queue, and will High-grade task is stored in the second task queue;
Then the default mission thread of triggering performs what is preserved in the task queue according to serial executive mode Task, it is specially:
Trigger a default mission thread and times preserved in the first task queue is performed according to serial executive mode Business;
Then methods described also includes:
Multiple tasks thread is created, the multiple mission thread is triggered and performs what is preserved in second task queue parallel Task.
Step 102:Monitor whether application is in idle condition.
In view of under class Unix system (such as iOS of Apple Inc.), how to judge to apply whether be in idle condition, It is still a problem.It is specific as follows this application provides specific technological means in order to be better adapted to the system:
The operation of main thread is monitored by the observer (observer) of the main thread operating loop (run loop) of application The state in loop;
When listening to operating loop and entering sleep state, then show using being in idle condition;
Wherein, the observer includes a call back function, for monitoring the state change situation of operating loop.
For the ease of skilled artisan understands that above-mentioned technological means, next to main thread, the run of main thread Loop and run loop observer are explained.
Main thread, when an application starts, just have a process and created by operating system, simultaneously a thread Also run at once, the thread is generally termed the main thread of application.
Run loop are actually an object, and it needs event and message to be processed to the Object Management group, and provides One entrance function performs event loop logic.After thread performs the function, " connecing inside this function will be constantly in Receive message-wait-processing " circulation in, until this circulation terminates, for example be passed to quit message, function is returned to.
Run loop processing comes from input source (input source) and timing source (timer source)
Incoming event, input source transmit asynchronous message, typically from other threads or program.Timing source then transmits Synchronization message, occur in special time or certain time interval.
Except handling input source, run loop can also generate the notice (notification) on run loop behaviors. Run loop observers can receive these notification, and do corresponding processing, and the pattern of its operation.
Which operated in during Run loop each runs necessarily all referring to fixed its under pattern, run loop patterns are all to supervise Depending on input source and timing source and to be notified registration observer set.Under normal circumstances, by specifying name to determine Pattern, i.e. each pattern has corresponding name, such as character string identification.
Systems process user is clicked on, and the active states such as network request returns are required for main thread Run loop in wake-up states Performed, and main thread Run loop can correspondingly enter sleep state when application enters idle condition.So lead to here Cross addition observer and receive the state that Run loop enter sleep and wake-up, can interpolate that whether application is idle, as run loop Then represent to apply idle condition into sleep state, then represent to apply to be in busy condition when run loop enter wake-up states.
The listening mode that the embodiment of the present application provides, the notice of various actions is exactly received using Run loop observers, So as to come monitor using whether be in idle condition.
Step 103:When listening to using idle condition is in, trigger a default mission thread and performed according to serial Mode performs being preserved in the task queue for task.
When realizing, step 103 can be realized in the following way, and which includes:
When listening to using idle condition is in, trigger a default mission thread and use FIFO algorithm Read from the task queue and perform task;
When a tasks carrying finishes, judge apply currently whether be in idle condition;If it is, triggering is described pre- If a mission thread continue to read and perform task.
Certainly, except being read according to above-mentioned FIFO (First In First Out, FIFO) algorithm and performing task Outside, it can also be successively read according to the important level sequence of task and perform task.
Next above-mentioned implementation is more particularly described.
Participate in Fig. 3, as shown in figure 3, a default mission thread according to step (1), (2), (3), (4) processing logic Order performs corresponding operating.
A default mission thread, step (1) is performed according to FIFO principle from task queue corresponding to application, Obtain first task;Perform step (2), i.e. perform the task, when the tasks carrying finishes, perform step (3), check Whether it is idle condition using current state, if it is, return to step (1), i.e. continuation obtains next from task queue Business, it is further continued for performing step (2), and when task is finished, then check using whether current state is idle condition, successively Mode circulates execution.
But when a tasks carrying finishes, check out using current state when being busy state, then this default one Mission thread terminates to handle.
From the discussion above it will be seen that the application offer is directed to the task processing method applied, in face of multitask Cause to apply interim card problem, it is proposed that using idle treatment mechanism, be effectively improved using startability and usage experience.
In addition, for how to judge to apply idle condition problem, it is proposed that by monitoring main thread Run loop state sides Formula come judge using whether idle condition.Finally, for the characteristic of limited system resources, it is proposed that appoint for all backstages of application Business creates single thread, using the technological means of single thread serial process background task, so as to avoid creating multithreading to System causes expense excessive, the problem of influence using foreground task processing.
After APP starts, user may initiate to operate accordingly at any time, in order to ensure that APP can timely respond to user Operation, present invention also provides another technological means, the technological means is:
The priority level of a default mission thread is set to be less than the priority level of main thread, so that described A default mission thread and the main thread are performed according to priority sequencing and appointed in the case where there is tasks carrying Business.
Main thread is must to respond Client-initiated operation requests in the very first time, therefore, is caused using the technological means A default mission thread does not influence the operation of main thread, to ensure that main thread preferentially utilizes system resource, before priority treatment Platform task, so as to effectively lift Consumer's Experience.
In addition, when monitoring using busy state is in, the default mission thread pause can also be triggered and worked as Before being carrying out of the task.So, also system resource can be provided for foreground task in time so that before main thread timely processing Platform task.
Generally, apply startup stage or in service stage, it is necessary to perform background task important level Degree is similar, but also has some in particular cases, and background tasks of some applications have a strict grade distinguishing, and grade is high Task directly affects the normal operation of application.Then the high task of grade must preferentially, be quickly performed.And the task pair that grade is low The normal operation within a period of time is applied to influence little, then the low task of this grade, can postpone to perform.For this feelings Condition, it is specific as follows present invention also provides specific technological means:
Above-mentioned steps 201 can include:
According to the hierarchical relationship of the background task of application, the task of inferior grade is stored in first task queue, and will High-grade task is stored in the second task queue;
Then the default mission thread of triggering performs what is preserved in the task queue according to serial executive mode Task, it is specially:
Trigger a default mission thread and times preserved in the first task queue is performed according to serial executive mode Business;
Then on the basis of the method and step shown in Fig. 2, following steps can also be increased:
Multiple tasks thread is created, the multiple mission thread is triggered and performs what is preserved in second task queue parallel Task.
Above-mentioned first task queue refers to first kind task queue, and the first task queue in practice, can include one Individual queue, multiple queues can also be included;Second task queue refers to the second generic task queue, only for the first generic task team Row are mutually distinguished, and second task queue in practice, can include a queue, can also include multiple queues.
The high task low with grade of grade is stored in different task queues respectively using the technological means, created more Thread parallel performs the high task of grade, performs the low task of grade using single-threaded serial, so, can either meet application The execution demand of different task, and can enough avoid the influence of the foreground hot job to application as far as possible.
The high-grade task being outlined above refers to that task important level is more than or equal to the task of grade threshold;And inferior grade Task refer to task important level be less than grade threshold task.Wherein, the size of grade threshold can be according to being actually needed And set.In practical application scene, each background task of application has a corresponding grade point, by contrasting the grade The magnitude relationship of value and threshold value, it becomes possible to determine high-grade task or inferior grade task during task.
The method provided above the application is explained explanation.
Next a kind of Task Processing Unit of the application provided the application is explained.
Referring to Fig. 4, Fig. 4 is a kind of structural representation of the Task Processing Unit for application that the embodiment of the present application provides, such as Shown in Fig. 4, the device includes:Memory cell 401, monitoring unit 402 and trigger element 403;Below based on the work of the device The concrete structure and function of each unit are explained principle.
Memory cell 401, for the background task of application to be stored in task queue;
Monitoring unit 402, for monitoring whether application is in idle condition;
Trigger element 403, for when listening to using idle condition be in, the default mission thread of triggering according to Serial executive mode performs being preserved in the task queue for task.
When realizing, the monitoring unit 402, can include:
Subelement is monitored, the observer for the main thread operating loop by application monitors the operating loop of main thread State;When listening to operating loop and entering sleep state, then show using being in idle condition;Wherein, observer's bag Containing a call back function, for monitoring the state change situation of operating loop.
When realizing, described device can also include:
Priority setting unit, for setting the priority level of a default mission thread less than main thread Priority level, so that a default mission thread and the main thread be in the case where there is tasks carrying, according to Priority sequencing performs task.
When realizing, the memory cell 401, can include:
Deque's storing sub-units, for the hierarchical relationship of the background task according to application, the task of inferior grade is preserved It is stored in first task queue, and by high-grade task in the second task queue;
The then trigger element 403, can include:
First triggering subelement, described first is performed according to serial executive mode for triggering a default mission thread Being preserved in task queue for task;
Then described device also includes:
Multithreading creates and trigger element, for creating multiple tasks thread, triggers the multiple mission thread and holds parallel Being preserved in row second task queue for task.When realizing, the trigger element 403, can include:
Second triggering subelement, for when listening to using idle condition is in, triggering a default task Thread is read from the task queue using FIFO algorithm and performs task;When a tasks carrying finishes, enter Judgment sub-unit;
Judgment sub-unit, for when a tasks carrying finishes, judging whether using current state be idle condition;Such as Fruit is to enter back into the second triggering subelement to continue to read and perform task.
When realizing, described device can also include:
Suspend trigger element, for while a default mission thread is in the task of execution, listening to application In busy state, then the task that the default mission thread pause is currently executing is triggered.
The said apparatus provided using the embodiment of the present application, the background task that can be directed to application is managed, and is passed through Particular thread serial process these background tasks created, avoid creating multithreading and excessive expense is caused to system, from And occupying system resources can either be minimized, and can enough ensures the execution of background task.Analyzed from the operation angle of application, profit The background task of application is handled with single thread, the processing using foreground task can't be influenceed, application can be greatly enhanced Runnability, so as to lift Consumer's Experience.
It should be noted that each embodiment in this specification is described by the way of progressive, each embodiment weight Point explanation is all difference with other embodiment, between each embodiment identical similar part mutually referring to. For device class embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is joined See the part explanation of embodiment of the method.
Finally, it is to be noted that, herein, such as first and second or the like relational terms be used merely to by One entity or operation make a distinction with another entity or operation, and not necessarily require or imply these entities or operation Between any this actual relation or order be present.Moreover, term " comprising ", "comprising" or its any other variant meaning Covering including for nonexcludability, so that process, method, article or equipment including a series of elements not only include that A little key elements, but also the other element including being not expressly set out, or also include for this process, method, article or The intrinsic key element of equipment.In the absence of more restrictions, the key element limited by sentence "including a ...", is not arranged Except other identical element in the process including the key element, method, article or equipment being also present.
Task processing method, the apparatus and system of a kind of application provided herein are described in detail above, Specific case used herein is set forth to the principle and embodiment of the application, and the explanation of above example is simply used Understand the present processes and its core concept in help;Meanwhile for those of ordinary skill in the art, according to the application's Thought, there will be changes in specific embodiments and applications, in summary, this specification content should not be construed as Limitation to the application.

Claims (12)

1. a kind of task processing system of application, it is characterised in that the system includes:At least one processor and at least one Memory, store instruction at least one memory;At least one processor is used to perform described at least one deposit Stored in reservoir to give an order:
The background task of application is stored in task queue;
Monitor whether application is in idle condition;
When listening to using idle condition is in, a default mission thread is triggered according to described in the execution of serial executive mode Being preserved in task queue for task.
A kind of 2. task processing system of application according to claim 1, it is characterised in that at least one processor Perform it is described monitor application and whether be in the instruction of idle condition when, it is specific to perform to give an order:
The state of the operating loop of main thread is monitored by the observer of the main thread operating loop of application;
When listening to operating loop and entering sleep state, then show using being in idle condition;
Wherein, the observer includes a call back function, for monitoring the state change situation of operating loop.
A kind of 3. task processing system of application according to claim 1, it is characterised in that at least one processor It is additionally operable to perform to give an order:
The priority level of a default mission thread is set to be less than the priority level of main thread, so that described default A mission thread and the main thread in the case where there is tasks carrying, according to priority sequencing perform task.
A kind of 4. task processing system of application according to claim 1, it is characterised in that at least one processor It is specific to perform to give an order when performing the execution being stored in the background task of application in task queue:
According to the hierarchical relationship of the background task of application, the task of inferior grade is stored in first task queue, and will be high The task of level is stored in the second task queue;
Then the default mission thread of triggering performs being preserved in the task queue for task according to serial executive mode Instruction, be specially:
Trigger a default mission thread and being preserved in the first task queue for task is performed according to serial executive mode;
Then at least one processor is also performed to give an order:
Multiple tasks thread is created, the multiple mission thread is triggered and performs times preserved in second task queue parallel Business.
A kind of 5. task processing system of application according to claim 1, it is characterised in that at least one processor Performing when listening to using idle condition is in, triggering a default mission thread and perform institute according to serial executive mode It is specific to perform to give an order when stating the instruction of being preserved in task queue for task:
When listening to using idle condition is in, trigger a default mission thread and use FIFO algorithm from institute State and task is read and performed in task queue;
When a tasks carrying finishes, judge apply currently whether be in idle condition;If it is, triggering is described default One mission thread continues to read and perform task.
6. a kind of task processing method of application, it is characterised in that methods described includes:
The background task of application is stored in task queue;
Monitor whether application is in idle condition;
When listening to using idle condition is in, a default mission thread is triggered according to described in the execution of serial executive mode Being preserved in task queue for task.
7. the task processing method of a kind of application according to claim 6, it is characterised in that described to monitor whether application is located In idle condition, including:
The state of the operating loop of main thread is monitored by the observer of the main thread operating loop of application;
When listening to operating loop and entering sleep state, then show using being in idle condition;
Wherein, the observer includes a call back function, for monitoring the state change situation of operating loop.
8. the task processing method of a kind of application according to claim 6, it is characterised in that methods described also includes:
The priority level of a default mission thread is set to be less than the priority level of main thread, so that described default A mission thread and the main thread in the case where there is tasks carrying, according to priority sequencing perform task.
9. the task processing method of a kind of application according to claim 6, it is characterised in that appoint on the backstage by application Business is stored in task queue, including:
According to the hierarchical relationship of the background task of application, the task of inferior grade is stored in first task queue, and will be high The task of level is stored in the second task queue;
Then the default mission thread of triggering performs being preserved in the task queue for task according to serial executive mode, Specially:
Trigger a default mission thread and being preserved in the first task queue for task is performed according to serial executive mode;
Then methods described also includes:
Multiple tasks thread is created, the multiple mission thread is triggered and performs times preserved in second task queue parallel Business.
10. the task processing method of a kind of application according to claim 6, it is characterised in that described to listen to application During in idle condition, trigger a default mission thread and perform what is preserved in the task queue according to serial executive mode Task, including:
When listening to using idle condition is in, trigger a default mission thread and use FIFO algorithm from institute State and task is read and performed in task queue;
When a tasks carrying finishes, judge apply currently whether be in idle condition;If it is, triggering is described default One mission thread continues to read and perform task.
11. the task processing method of a kind of application according to claim 6, it is characterised in that methods described also includes:
While a default mission thread is in the task of execution, listens to using busy state is in, then trigger institute State the task that default mission thread pause is currently executing.
12. a kind of Task Processing Unit of application, it is characterised in that described device includes:
Memory cell, for the background task of application to be stored in task queue;
Monitoring unit, for monitoring whether application is in idle condition;
Trigger element, for when listening to using idle condition be in, the default mission thread of triggering is according to serially holding Line mode performs being preserved in the task queue for task.
CN201610407172.XA 2016-06-12 2016-06-12 Application task processing method, device and system Active CN107491346B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610407172.XA CN107491346B (en) 2016-06-12 2016-06-12 Application task processing method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610407172.XA CN107491346B (en) 2016-06-12 2016-06-12 Application task processing method, device and system

Publications (2)

Publication Number Publication Date
CN107491346A true CN107491346A (en) 2017-12-19
CN107491346B CN107491346B (en) 2021-03-12

Family

ID=60643047

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610407172.XA Active CN107491346B (en) 2016-06-12 2016-06-12 Application task processing method, device and system

Country Status (1)

Country Link
CN (1) CN107491346B (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109491780A (en) * 2018-11-23 2019-03-19 鲍金龙 Multi-task scheduling method and device
CN109697128A (en) * 2018-12-19 2019-04-30 北京爱奇艺科技有限公司 A kind of thread maintaining method, device and electronic equipment
CN110110306A (en) * 2019-04-12 2019-08-09 平安医疗健康管理股份有限公司 Method for exhibiting data, device, terminal and computer readable storage medium
CN110297741A (en) * 2019-06-24 2019-10-01 杭州迪普信息技术有限公司 A kind of background task monitoring method and device
CN110928696A (en) * 2020-02-13 2020-03-27 北京一流科技有限公司 User-level thread control system and method thereof
CN111061556A (en) * 2019-12-26 2020-04-24 深圳前海环融联易信息科技服务有限公司 Optimization method and device for executing priority task, computer equipment and medium
CN111831432A (en) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 Scheduling method and device of IO (input/output) request, storage medium and electronic equipment
WO2021013055A1 (en) * 2019-07-20 2021-01-28 华为技术有限公司 Data processing method and apparatus, and electronic device
CN113031870A (en) * 2021-03-26 2021-06-25 山东英信计算机技术有限公司 Dynamic management method, device, storage medium and equipment for cluster system
CN114968551A (en) * 2022-03-10 2022-08-30 中移互联网有限公司 Process management method and device, electronic equipment and storage medium
CN115114028A (en) * 2022-07-05 2022-09-27 南方电网科学研究院有限责任公司 Task allocation method and device for electric power simulation secondary control
CN110908724B (en) * 2019-12-03 2024-06-07 深圳市迅雷网络技术有限公司 Android App starting method and related components

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102012841A (en) * 2010-09-21 2011-04-13 上海大学 Restart scheduling method of failure look-ahead threads
CN102393822A (en) * 2011-11-30 2012-03-28 中国工商银行股份有限公司 Batch scheduling system and method
CN102662633A (en) * 2012-03-16 2012-09-12 深圳第七大道科技有限公司 Multithread processing method and system for Flash task
US20120303756A1 (en) * 2009-04-03 2012-11-29 Google Inc. System and method for reducing startup cost of a software application
US20140373020A1 (en) * 2013-06-13 2014-12-18 Wipro Limited Methods for managing threads within an application and devices thereof
CN104462420A (en) * 2014-12-12 2015-03-25 北京国双科技有限公司 Method and device for executing query tasks on database
CN104793996A (en) * 2015-04-29 2015-07-22 中芯睿智(北京)微电子科技有限公司 Task scheduling method and device of parallel computing equipment
CN105049240A (en) * 2015-06-26 2015-11-11 大唐移动通信设备有限公司 Message processing method and server
CN105389209A (en) * 2015-12-25 2016-03-09 中国建设银行股份有限公司 Asynchronous batch task processing method and system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120303756A1 (en) * 2009-04-03 2012-11-29 Google Inc. System and method for reducing startup cost of a software application
CN102012841A (en) * 2010-09-21 2011-04-13 上海大学 Restart scheduling method of failure look-ahead threads
CN102393822A (en) * 2011-11-30 2012-03-28 中国工商银行股份有限公司 Batch scheduling system and method
CN102662633A (en) * 2012-03-16 2012-09-12 深圳第七大道科技有限公司 Multithread processing method and system for Flash task
US20140373020A1 (en) * 2013-06-13 2014-12-18 Wipro Limited Methods for managing threads within an application and devices thereof
CN104462420A (en) * 2014-12-12 2015-03-25 北京国双科技有限公司 Method and device for executing query tasks on database
CN104793996A (en) * 2015-04-29 2015-07-22 中芯睿智(北京)微电子科技有限公司 Task scheduling method and device of parallel computing equipment
CN105049240A (en) * 2015-06-26 2015-11-11 大唐移动通信设备有限公司 Message processing method and server
CN105389209A (en) * 2015-12-25 2016-03-09 中国建设银行股份有限公司 Asynchronous batch task processing method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
霜在飞: "利用RUNLOOP空闲时间执行预缓存任务", 《HTTPS://BLOG.CSDN.NET/XSH841272293/ARTICLE/DETAILS/51559396》 *

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109491780B (en) * 2018-11-23 2022-04-12 鲍金龙 Multi-task scheduling method and device
CN109491780A (en) * 2018-11-23 2019-03-19 鲍金龙 Multi-task scheduling method and device
CN109697128A (en) * 2018-12-19 2019-04-30 北京爱奇艺科技有限公司 A kind of thread maintaining method, device and electronic equipment
CN110110306A (en) * 2019-04-12 2019-08-09 平安医疗健康管理股份有限公司 Method for exhibiting data, device, terminal and computer readable storage medium
CN110297741A (en) * 2019-06-24 2019-10-01 杭州迪普信息技术有限公司 A kind of background task monitoring method and device
CN110297741B (en) * 2019-06-24 2022-11-25 杭州迪普信息技术有限公司 Background task monitoring method and device
WO2021013055A1 (en) * 2019-07-20 2021-01-28 华为技术有限公司 Data processing method and apparatus, and electronic device
CN110908724B (en) * 2019-12-03 2024-06-07 深圳市迅雷网络技术有限公司 Android App starting method and related components
CN111061556A (en) * 2019-12-26 2020-04-24 深圳前海环融联易信息科技服务有限公司 Optimization method and device for executing priority task, computer equipment and medium
CN110928696A (en) * 2020-02-13 2020-03-27 北京一流科技有限公司 User-level thread control system and method thereof
WO2021159930A1 (en) * 2020-02-13 2021-08-19 北京一流科技有限公司 User-level thread control system and method
CN110928696B (en) * 2020-02-13 2020-10-09 北京一流科技有限公司 User-level thread control system and method thereof
CN111831432A (en) * 2020-07-01 2020-10-27 Oppo广东移动通信有限公司 Scheduling method and device of IO (input/output) request, storage medium and electronic equipment
CN111831432B (en) * 2020-07-01 2023-06-16 Oppo广东移动通信有限公司 IO request scheduling method and device, storage medium and electronic equipment
CN113031870A (en) * 2021-03-26 2021-06-25 山东英信计算机技术有限公司 Dynamic management method, device, storage medium and equipment for cluster system
CN114968551A (en) * 2022-03-10 2022-08-30 中移互联网有限公司 Process management method and device, electronic equipment and storage medium
CN114968551B (en) * 2022-03-10 2023-09-19 中移互联网有限公司 Process management method and device, electronic equipment and storage medium
CN115114028A (en) * 2022-07-05 2022-09-27 南方电网科学研究院有限责任公司 Task allocation method and device for electric power simulation secondary control
CN115114028B (en) * 2022-07-05 2023-04-28 南方电网科学研究院有限责任公司 Task allocation method and device for secondary control of electric power simulation

Also Published As

Publication number Publication date
CN107491346B (en) 2021-03-12

Similar Documents

Publication Publication Date Title
CN107491346A (en) A kind of task processing method of application, apparatus and system
US9501319B2 (en) Method and apparatus for scheduling blocking tasks
US11507430B2 (en) Accelerated resource allocation techniques
CN106980492B (en) For the device of calculating, system, method, machine readable storage medium and equipment
CN106293919B (en) A kind of the built-in tasks dispatching device and method of time trigger
US20130061220A1 (en) Method for on-demand inter-cloud load provisioning for transient bursts of computing needs
CN106557369A (en) A kind of management method and system of multithreading
CN104572290A (en) Method and device for controlling message processing threads
CN101452399B (en) Task secondary scheduling module and method
CN109660569B (en) Multitask concurrent execution method, storage medium, device and system
CN110795254A (en) Method for processing high-concurrency IO based on PHP
CN106528288A (en) Resource management method, device and system
US20120284720A1 (en) Hardware assisted scheduling in computer system
CN104714839B (en) A kind of method and apparatus of control process lifetime
Chao et al. F-mstorm: Feedback-based online distributed mobile stream processing
US20240202024A1 (en) Thread processing methods, scheduling component, monitoring component, server, and storage medium
US10122602B1 (en) Distributed system infrastructure testing
CN101770398A (en) Operating system kernel
US8977752B2 (en) Event-based dynamic resource provisioning
Sai et al. Producer-Consumer problem using Thread pool
CN109002286A (en) Data asynchronous processing method and device based on synchronous programming
CN103761106A (en) Process control method and process engine
CN113032139A (en) Request processing method and device, computer readable storage medium and electronic equipment
CN111767125A (en) Task execution method and device, electronic equipment and storage medium
CN111651279A (en) Method and system for processing business process

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