CN107491346B - Application task processing method, device and system - Google Patents
Application task processing method, device and system Download PDFInfo
- Publication number
- CN107491346B CN107491346B CN201610407172.XA CN201610407172A CN107491346B CN 107491346 B CN107491346 B CN 107491346B CN 201610407172 A CN201610407172 A CN 201610407172A CN 107491346 B CN107491346 B CN 107491346B
- Authority
- CN
- China
- Prior art keywords
- task
- application
- thread
- tasks
- execute
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling 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
The application provides a task processing method, a device and a system of an application, wherein the method comprises the following steps: storing background tasks of the application in a task queue; monitoring whether the application is in an idle state; and when monitoring that the application is in an idle state, triggering a preset task thread to execute the tasks stored in the task queue according to a serial execution mode. According to the technical scheme, in the face of the problem that multiple tasks cause application blocking, a task processing mechanism in idle time of the application is provided, and the application starting performance and the processing performance can be effectively improved. Aiming at the characteristic of limited resources of a terminal system, a mode of serially executing a background task by using a single thread is provided, so that the normal execution of the background task is ensured, the resources of the terminal system can be reasonably utilized, and the influence on an application foreground task is reduced as far as possible when the background task is executed.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, and a system for processing a task of an application.
Background
An Application, also called Application (APP), refers to a third party Application of the smart terminal. And the user realizes various software functions through the APP on the intelligent terminal.
At present, during the starting process or the using process of APP, the situation that many tasks are executed at the same time in a main thread or other threads often occurs. And because the restriction of intelligent terminal's treater performance, memory size, too much task parallel processing can lead to the system can not in time handle the completion, can cause the APP card problem of pause when serious, leads to APP operation performance poor, and user experience is not good.
Disclosure of Invention
The technical problem to be solved by the application is to provide an application task processing method for improving the APP operation performance.
The application also provides a task processing device and a task processing system for application, which are used for ensuring the realization and the application of the method in practice.
In order to solve the above technical problem, a first aspect of the present application provides a task processing system for an application, the system including:
at least one processor and at least one memory having instructions for at least one application stored therein; the at least one processor is configured to execute the following instructions stored in the at least one memory:
storing background tasks of the application in a task queue;
monitoring whether the application is in an idle state;
and when monitoring that the application is in an idle state, triggering a preset task thread to execute the tasks stored in the task queue according to a serial execution mode.
A second aspect of the present application provides a method for processing a task of an application, where the method includes:
storing background tasks of the application in a task queue;
monitoring whether the application is in an idle state;
and when monitoring that the application is in an idle state, triggering a preset task thread to execute the tasks stored in the task queue according to a serial execution mode.
A third aspect of the present application provides a task processing apparatus for an application, the apparatus including:
the storage unit is used for storing the background task of the application in the task queue;
the monitoring unit is used for monitoring whether the application is in an idle state;
and the triggering unit is used for triggering a preset task thread to execute the tasks stored in the task queue according to a serial execution mode when the application is monitored to be in an idle state.
Compared with the prior art, the method has the following advantages:
according to the technical scheme, aiming at the problem that multi-task parallel processing is easy to cause application running blockage, a mechanism for processing background tasks in idle time and a mechanism for serially processing the background tasks by a single thread are provided, and the background tasks of the application are stored in a task queue under the two mechanisms; monitoring whether the application is in an idle state; and when monitoring that the application is in an idle state, triggering a preset task thread to execute the tasks stored in the task queue according to a serial execution mode. According to the technical scheme, normal execution of the background task can be guaranteed, terminal system resources can be reasonably utilized, and influence on the application foreground task is reduced when the background task is executed as far as possible, so that the APP operation performance is improved, and the user experience is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
FIG. 1 is a schematic structural diagram of a task processing system of an application provided in an embodiment of the present application;
FIG. 2 is a flowchart of a task processing method of an application according to an embodiment of the present application;
FIG. 3 is a flowchart of a task execution process for an application background task according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a task processing device of an application according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The system provided by the present application is first exemplified.
The task processing system of an application provided by the application can include: the system comprises at least one processor and at least one memory, wherein the at least one memory stores an application, a task queue corresponding to the application, a thread created by the processor and an instruction; the at least one processor is configured to execute instructions stored in the at least one memory.
In order to explain the structure and operation of the system more clearly, the system is exemplified by the system structure diagram shown in fig. 1.
Referring to fig. 1, a task processing system architecture diagram of an application is shown, the system 100 including:
a processor 101 and a memory 102; the processor 101 reads instructions from the memory 102 and executes the read instructions.
The memory 102 stores therein instructions operable to:
storing background tasks of the application in a task queue;
monitoring whether the application is in an idle state;
and when monitoring that the application is in an idle state, triggering a preset task thread to execute the tasks stored in the task queue according to a serial execution mode.
When executing these instructions, the processor 101 first stores a background task related to an application in a task queue corresponding to the application, and the task queue is stored in the memory 102.
As shown in fig. 1, an application 1 and a corresponding task queue 1 are stored in the memory; of course, there are also multiple applications and task queues corresponding to each application in the memory; an application 2 and a task queue 2 corresponding to the application 2 as partially shown in dotted lines in fig. 1; an application 3 and a task queue 3 corresponding to the application 3. Of course, in implementation, one application may correspond to one task queue, or may correspond to a plurality of task queues. The application is not limited in any way as to how much memory can be used to store applications and corresponding task queues, depending on the size of the memory.
In the implementation of the present system, memory may refer to memory that a processor can directly access through addresses in instructions, which are commonly used to store programs and data in an active state.
In the implementation of the present system, the memory may also refer to an auxiliary memory, or an external memory, such as: hard disks, magnetic disks, optical disks, etc.; the memory may also be a cache, etc. memory.
After storing the tasks of the application in the task queue, the processor 101 monitors the busy-idle state of the application, and when it is monitored that the application is in the idle state, the processor 101 triggers a thread, which is stored in the memory 102 in advance and is used for processing the background task, to execute the tasks in the task queue.
By utilizing the system, background tasks of applications can be managed, and the background tasks are serially processed through the created specific thread, so that excessive expenses caused by creating excessive threads on the system are avoided, and the occupation of system resources can be minimized, and the execution of the background tasks can be ensured. From the analysis of the application operation angle, the single thread is utilized to process the background task of the application, the processing of the application foreground task is not influenced, the application operation performance can be greatly improved, and the user experience is improved.
The processor 101 is not limited to which specific application background task is processed when executing these instructions, but can be adapted to any application that needs background task processing. The processor 101 may process only the background task of one application, or may process the background tasks of multiple applications at the same time.
The task processing system of one application shown in fig. 1 comprises only one processor and one memory. The system provided by the application can also have the following structural forms:
first, the system comprises: a plurality of processors (a plurality includes: at least two) and a memory; in the system with the structure, a plurality of processors are in data interaction with the memory, different processors are used for processing background tasks of different applications, and specific execution instructions are as described above.
Second, the system comprises: a processor and a plurality of memories; different memories may be used to store different applications and their task queues for background tasks; the processor is configured to process background tasks of all applications, and the processor reads the task trigger thread from the corresponding memory according to the identifier of the application to execute the background task of the application.
Thirdly, the system comprises: a plurality of processors and a plurality of memories; different memories may be used to store different applications and their task queues for background tasks; the different processors are used to process background tasks for different applications; a processor may interact with a memory or memories; specifically, the processor reads the task trigger thread from the corresponding memory according to the identifier of the application to execute the background task of the application.
The above description describes a task processing system of an application provided in the present application.
Next, a task processing method of an application provided in the present application will be explained.
Referring to fig. 2, fig. 2 is a flowchart of a method provided by the present application, which includes the following steps 201 to 203;
step 201: and saving the background task of the application in the task queue.
An application is a computer program that is designed to perform one or more specific tasks, and that operates in a user mode, and that can interact with a user to provide the user with a variety of different application experiences. The user equipment can be provided with one application or a plurality of applications; typically, a user will install multiple applications on a device to perform different functions.
The application needs to execute some background tasks in the starting stage to support the normal running of the application. Of course, besides the start-up phase, the application may also have some background tasks to be executed in the use phase after start-up, such as a task of periodically updating the application function attribute parameters, a task of periodically optimizing the application-specific function, and so on. The background tasks associated with different applications may or may not be the same.
For example: in the starting stage of the mobile phone panning application, a network initialization task, a login information initialization task, an abnormal acquisition SDK initialization task, an abnormal modification module initialization task and the like need to be executed.
And aiming at the application scene of installing multiple applications on the equipment, establishing a corresponding task queue for each application, and storing the background task of the application in the task queue corresponding to the application.
During implementation, corresponding task queues are established for applications started on equipment, and one-to-one correspondence between the applications and the task queues is stored. For example: the one-to-one correspondence between the unique identifier of the application and the unique identifier of the task queue can be stored; one-to-one correspondence between the name of the application and the address of the task queue may also be maintained.
Based on the saved corresponding relation, the background task related to a certain application can be quickly and accurately stored in the task queue corresponding to the application.
Then, the saving the background task of the application in the task queue includes:
according to the level relation of background tasks of the application, storing the tasks of low level in a first task queue and storing the tasks of high level in a second task queue;
the triggering a preset task thread to execute the task stored in the task queue according to a serial execution mode specifically includes:
triggering a preset task thread to execute the tasks stored in the first task queue according to a serial execution mode;
the method further comprises:
and creating a plurality of task threads, and triggering the plurality of task threads to execute the tasks stored in the second task queue in parallel.
Step 102: and monitoring whether the application is in an idle state.
Considering that under Unix-like systems (such as iOS of apple inc), how to determine whether an application is idle remains a difficult problem. In order to better adapt to the system, the application provides specific technical means, which are as follows:
monitoring the state of a running loop (run loop) of a main thread through an observer (observer) of the running loop of the main thread of an application;
when the operation loop is monitored to enter the sleep state, the application is indicated to be in an idle state;
wherein, the observer comprises a callback function for monitoring the state change condition of the operation loop.
In order to facilitate those skilled in the art to understand the above technical means, the main thread, run loop of the main thread, and run loop server will be explained next.
The main thread, when an application is started, has a process created by the operating system, while a thread is running immediately, which is usually called the main thread of the application.
Run loop is actually an object that manages the events and messages it needs to handle and provides an entry function to execute event loop logic. After the thread executes the function, it is in a "receive message-wait-process" loop inside the function until the loop ends, for example, a quick message is sent, and the function returns.
Run loop processing from input source and timing source
The input source delivers asynchronous messages, typically from other threads or programs. The timing source then communicates synchronization messages, occurring at specific times or at certain time intervals.
In addition to processing the input source, run loops also generate notifications (notifications) about run loop behavior. The run loop observer can receive these notifications and do the corresponding processing and the mode of operation.
Run loop must specify in which mode it runs each time it runs, a Run loop mode being the set of all input and timing sources to monitor and registered watchers to notify. Typically, the schemas are determined by specifying names, i.e., each schema has a corresponding name, such as a string identification.
The system processes active states such as user click, network request return and the like, and the main thread Run loop is required to be executed in an awakening state, and when the application enters an idle state, the main thread Run loop correspondingly enters a sleep state. Therefore, whether the application is idle or not can be judged by adding the state that the observer receives the Run loop to enter the sleep and wake states, the idle state of the application is indicated when the Run loop enters the sleep state, and the busy state of the application is indicated when the Run loop enters the wake state.
The monitoring mode provided by the embodiment of the application just utilizes the Run loop observer to receive the notification of various behaviors, so as to monitor whether the application is in an idle state.
Step 103: and when monitoring that the application is in an idle state, triggering a preset task thread to execute the tasks stored in the task queue according to a serial execution mode.
When implemented, step 103 may be implemented by a method comprising:
when monitoring that the application is in an idle state, triggering the preset task thread to read and execute the task from the task queue by adopting a first-in first-out algorithm;
when one task is executed, judging whether the application is in an idle state at present; and if so, triggering the preset task thread to continue reading and executing the task.
Of course, In addition to reading and executing tasks according to the above First-In First-Out (FIFO) algorithm, tasks may also be read and executed sequentially according to the order of importance levels of the tasks.
The above-described implementation is described in more detail next.
Referring to fig. 3, as shown in fig. 3, a preset task thread executes corresponding operations according to the processing logic sequence of steps (1), (2), (3), and (4).
A preset task thread executes the step (1) to obtain a first task from a task queue corresponding to an application according to a first-in first-out principle; and (3) executing the step (2), namely executing the task, executing the step (3) when the task is executed, checking whether the current state of the application is in an idle state, if so, returning to the step (1), namely, continuously acquiring the next task from the task queue, continuously executing the step (2), checking whether the current state of the application is in the idle state again when the task is executed, and circularly executing in a sequential mode.
However, when the execution of one task is finished, and the current state of the application is checked to be the busy state, the preset task thread is finished.
From the above, it can be seen that the task processing method for the application, provided by the application, provides an application idle time processing mechanism in the face of the application deadlock problem caused by multitask, and effectively improves application starting performance and use experience.
In addition, aiming at the problem of how to judge the idle state of the application, the method for judging whether the application is in the idle state or not by monitoring the Run loop state of the main thread is provided. Finally, aiming at the characteristic of limited system resources, a technical means of creating single threads for all background tasks of the application and serially processing the background tasks by using the single threads is provided, so that the problems that the overhead is too high for the system and the processing of the foreground tasks of the application is influenced due to the creation of too many threads are solved.
After the APP starts, the user may initiate corresponding operation at any time, in order to ensure that the APP can respond to the operation of the user in time, another technical means is provided in the application, and the technical means is as follows:
and setting the priority level of the preset task thread to be lower than that of the main thread so as to execute the tasks according to the priority order under the condition that the preset task thread and the main thread both have the tasks to execute.
The main thread is required to respond to an operation request initiated by a user at the first time, so that the operation of the main thread is not influenced by a preset task thread by utilizing the technical means, the main thread is ensured to preferentially utilize system resources, foreground tasks are preferentially processed, and the user experience is effectively improved.
In addition, when the monitoring application is in a busy state, the preset task thread can be triggered to suspend the currently executed task. Therefore, system resources can be provided for the foreground task in time, and the main thread can process the foreground task in time.
Generally, in a starting stage or a using stage, the background tasks to be executed have almost the same degree of importance, but in some special cases, the background tasks of some applications have strict grade distinction, and the high-grade tasks directly affect the normal operation of the applications. The task of the higher level must be executed preferentially and quickly. And the task with a low level has little influence on the normal operation of the application in a period of time, and the task with a low level can be executed in a delayed way. For the situation, the application also provides a specific technical means, which is as follows:
the step 201 may include:
according to the level relation of background tasks of the application, storing the tasks of low level in a first task queue and storing the tasks of high level in a second task queue;
the triggering a preset task thread to execute the task stored in the task queue according to a serial execution mode specifically includes:
triggering a preset task thread to execute the tasks stored in the first task queue according to a serial execution mode;
then on the basis of the method steps shown in fig. 2, the following steps can be added:
and creating a plurality of task threads, and triggering the plurality of task threads to execute the tasks stored in the second task queue in parallel.
The first task queue refers to a first type of task queue, and in practice, the first task queue may include one queue or a plurality of queues; the second task queue is referred to as a second type task queue, and may actually include one queue or a plurality of queues only for distinguishing from the first type task queue.
By the technical means, the tasks with high and low levels are respectively stored in different task queues, the tasks with high multi-thread parallel execution level are created, and the tasks with low level are executed in series by the single thread, so that the execution requirements of different tasks of the application can be met, and the influence on the foreground emergency task of the application can be avoided as much as possible.
The high-level tasks described above refer to tasks having a task importance level greater than or equal to a level threshold; and a low ranked task refers to a task having a task importance level less than a ranking threshold. The size of the level threshold may be set according to actual needs. In an actual application scene, each background task of the application has a corresponding grade value, and the relation between the grade value and a threshold value is compared, so that whether a high-grade task or a low-grade task is performed in the process of the task can be determined.
The methods provided herein are explained above.
Next, a task processing device of an application provided in the present application will be explained.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a task processing device for an application according to an embodiment of the present application, and as shown in fig. 4, the device includes: a storage unit 401, a listening unit 402 and a triggering unit 403; the specific structure and function of each unit will be explained based on the operating principle of the device.
A storage unit 401, configured to store a background task of an application in a task queue;
a monitoring unit 402, configured to monitor whether an application is in an idle state;
and a triggering unit 403, configured to trigger a preset task thread to execute the task stored in the task queue according to a serial execution mode when it is monitored that the application is in an idle state.
When implemented, the listening unit 402 may include:
the monitoring subunit is used for monitoring the state of the running loop of the main thread through an observer of the running loop of the main thread of the application; when the operation loop is monitored to enter the sleep state, the application is indicated to be in an idle state; wherein, the observer comprises a callback function for monitoring the state change condition of the operation loop.
In implementations, the apparatus may further include:
and the priority setting unit is used for setting the priority level of the preset task thread to be lower than that of the main thread so as to execute the tasks according to the priority order under the condition that the preset task thread and the main thread both have the tasks to execute.
When implemented, the storage unit 401 may include:
the double-queue storage subunit is used for storing the tasks with low grades in the first task queue and storing the tasks with high grades in the second task queue according to the grade relation of the background tasks of the application;
the triggering unit 403 may include:
the first trigger subunit is used for triggering a preset task thread to execute the tasks stored in the first task queue according to a serial execution mode;
the apparatus further comprises:
and the multithreading creating and triggering unit is used for creating a plurality of task threads and triggering the task threads to execute the tasks stored in the second task queue in parallel. When implemented, the triggering unit 403 may include:
the second triggering subunit is used for triggering the preset task thread to read from the task queue and execute the task by adopting a first-in first-out algorithm when the application is monitored to be in an idle state; when one task is executed, entering a judging subunit;
the judging subunit is used for judging whether the current application state is an idle state or not when one task is executed; and if so, re-entering the second trigger subunit to continue reading and executing the task.
In implementations, the apparatus may further include:
and the pause triggering unit is used for triggering the preset task thread to pause the currently executed task when the preset task thread executes the task and simultaneously monitors that the application is in a busy state.
By utilizing the device provided by the embodiment of the application, background tasks of applications can be managed, and the background tasks are serially processed through the created specific thread, so that excessive expenses caused by creating excessive threads on a system are avoided, system resources can be occupied to the minimum, and execution of the background tasks can be guaranteed. From the analysis of the application operation angle, the single thread is utilized to process the background task of the application, the processing of the application foreground task is not influenced, the application operation performance can be greatly improved, and the user experience is improved.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above detailed description is given to a task processing method, a device and a system for an application provided by the present application, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the above embodiment is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.
Claims (12)
1. A task processing system for an application, the system comprising: at least one processor and at least one memory, the at least one memory storing instructions therein; the at least one processor is configured to execute the following instructions stored in the at least one memory:
storing background tasks of the application in a task queue;
monitoring whether the application is in an idle state;
and when monitoring that the application is in an idle state, triggering a preset task thread to execute the tasks stored in the task queue according to a serial execution mode.
2. The task processing system of an application according to claim 1, wherein the at least one processor, when executing the instruction of whether the monitoring application is in an idle state, specifically executes the following instruction:
monitoring the state of a running loop of a main thread through an observer of the running loop of the main thread of the application;
when the operation loop is monitored to enter the sleep state, the application is indicated to be in an idle state;
wherein, the observer comprises a callback function for monitoring the state change condition of the operation loop.
3. A task processing system for an application according to claim 1, wherein said at least one processor is further configured to execute the following instructions:
and setting the priority level of the preset task thread to be lower than that of the main thread so as to execute the tasks according to the priority order under the condition that the preset task thread and the main thread both have the tasks to execute.
4. A task processing system for an application according to claim 1, wherein the at least one processor, when executing the execution of saving the background task of the application in the task queue, executes the following instructions:
according to the level relation of background tasks of the application, storing the tasks of low level in a first task queue and storing the tasks of high level in a second task queue;
the instruction for triggering a preset task thread to execute the task stored in the task queue according to the serial execution mode is as follows:
triggering a preset task thread to execute the tasks stored in the first task queue according to a serial execution mode;
the at least one processor further executes the following instructions:
and creating a plurality of task threads, and triggering the plurality of task threads to execute the tasks stored in the second task queue in parallel.
5. The task processing system of claim 1, wherein the at least one processor executes the following instructions when executing the instructions that trigger a predetermined task thread to execute the tasks stored in the task queue in a serial execution manner when monitoring that the application is in an idle state:
when monitoring that the application is in an idle state, triggering the preset task thread to read and execute the task from the task queue by adopting a first-in first-out algorithm;
when one task is executed, judging whether the application is in an idle state at present; and if so, triggering the preset task thread to continue reading and executing the task.
6. A method for processing a task of an application, the method comprising:
storing background tasks of the application in a task queue;
monitoring whether the application is in an idle state;
and when monitoring that the application is in an idle state, triggering a preset task thread to execute the tasks stored in the task queue according to a serial execution mode.
7. The method for processing the task of the application according to claim 6, wherein the monitoring whether the application is in an idle state comprises:
monitoring the state of a running loop of a main thread through an observer of the running loop of the main thread of the application;
when the operation loop is monitored to enter the sleep state, the application is indicated to be in an idle state;
wherein, the observer comprises a callback function for monitoring the state change condition of the operation loop.
8. The method for processing the task of the application according to claim 6, wherein the method further comprises:
and setting the priority level of the preset task thread to be lower than that of the main thread so as to execute the tasks according to the priority order under the condition that the preset task thread and the main thread both have the tasks to execute.
9. The method for processing the task of the application according to claim 6, wherein the saving the background task of the application in the task queue comprises:
according to the level relation of background tasks of the application, storing the tasks of low level in a first task queue and storing the tasks of high level in a second task queue;
the triggering a preset task thread to execute the tasks stored in the task queue according to the serial execution mode is as follows:
triggering a preset task thread to execute the tasks stored in the first task queue according to a serial execution mode;
the method further comprises:
and creating a plurality of task threads, and triggering the plurality of task threads to execute the tasks stored in the second task queue in parallel.
10. The method for processing the task of the application according to claim 6, wherein the triggering a preset task thread to execute the task stored in the task queue according to a serial execution mode when it is monitored that the application is in an idle state includes:
when monitoring that the application is in an idle state, triggering the preset task thread to read and execute the task from the task queue by adopting a first-in first-out algorithm;
when one task is executed, judging whether the application is in an idle state at present; and if so, triggering the preset task thread to continue reading and executing the task.
11. The method for processing the task of the application according to claim 6, wherein the method further comprises:
when the preset task thread executes the task and simultaneously monitors that the application is in a busy state, triggering the preset task thread to suspend the currently executed task.
12. A task processing apparatus of an application, the apparatus comprising:
the storage unit is used for storing the background task of the application in the task queue;
the monitoring unit is used for monitoring whether the application is in an idle state;
and the triggering unit is used for triggering a preset task thread to execute the tasks stored in the task queue according to a serial execution mode when the application is monitored to be in an idle state.
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 CN107491346A (en) | 2017-12-19 |
CN107491346B true 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) |
Families Citing this family (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109491780B (en) * | 2018-11-23 | 2022-04-12 | 鲍金龙 | Multi-task scheduling method and device |
CN109697128A (en) * | 2018-12-19 | 2019-04-30 | 北京爱奇艺科技有限公司 | A kind of thread maintaining method, device and electronic equipment |
CN110110306B (en) * | 2019-04-12 | 2023-02-14 | 深圳平安医疗健康科技服务有限公司 | Data display method and device, terminal and computer readable storage medium |
CN110297741B (en) * | 2019-06-24 | 2022-11-25 | 杭州迪普信息技术有限公司 | Background task monitoring method and device |
CN110502294B (en) * | 2019-07-20 | 2021-08-20 | 华为技术有限公司 | Data processing method and device and electronic equipment |
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 |
CN110928696B (en) * | 2020-02-13 | 2020-10-09 | 北京一流科技有限公司 | User-level thread control system and method thereof |
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 |
CN114968551B (en) * | 2022-03-10 | 2023-09-19 | 中移互联网有限公司 | Process management method and device, electronic equipment and storage medium |
CN115114028B (en) * | 2022-07-05 | 2023-04-28 | 南方电网科学研究院有限责任公司 | Task allocation method and device for secondary control of electric power simulation |
Citations (3)
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 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8260876B2 (en) * | 2009-04-03 | 2012-09-04 | Google Inc. | System and method for reducing startup cost of a software application |
US9563474B2 (en) * | 2013-06-13 | 2017-02-07 | Wipro Limited | Methods for managing threads within an application and devices thereof |
CN104462420B (en) * | 2014-12-12 | 2018-09-18 | 北京国双科技有限公司 | The execution method and apparatus of the query task of database |
CN104793996A (en) * | 2015-04-29 | 2015-07-22 | 中芯睿智(北京)微电子科技有限公司 | Task scheduling method and device of parallel computing equipment |
CN105049240B (en) * | 2015-06-26 | 2018-08-21 | 大唐移动通信设备有限公司 | A kind of message treatment method and server |
CN105389209B (en) * | 2015-12-25 | 2019-04-26 | 中国建设银行股份有限公司 | A kind of asynchronous batch tasks processing method and system |
-
2016
- 2016-06-12 CN CN201610407172.XA patent/CN107491346B/en active Active
Patent Citations (3)
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 |
Non-Patent Citations (1)
Title |
---|
利用RUNLOOP空闲时间执行预缓存任务;霜在飞;《https://blog.csdn.net/xsh841272293/article/details/51559396》;20160601;第1-4页 * |
Also Published As
Publication number | Publication date |
---|---|
CN107491346A (en) | 2017-12-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107491346B (en) | Application task processing method, device and system | |
US11907762B2 (en) | Resource conservation for containerized systems | |
EP2972852B1 (en) | System management interrupt handling for multi-core processors | |
CN106940671B (en) | Method, device and system for monitoring running of task threads in cluster | |
CN111782295B (en) | Application program running method and device, electronic equipment and storage medium | |
CN110990132A (en) | Asynchronous task processing method and device, computer equipment and storage medium | |
CN110618869A (en) | Resource management method, device and equipment | |
CN111897637A (en) | Job scheduling method, device, host and storage medium | |
WO2022095862A1 (en) | Thread priority adjusting method, terminal, and computer readable storage medium | |
CN104714839A (en) | Method and device for controlling life cycle of processes | |
CN113190427B (en) | Method and device for monitoring blocking, electronic equipment and storage medium | |
CN113778650A (en) | Task scheduling method and device, electronic equipment and storage medium | |
CN113032119A (en) | Task scheduling method and device, storage medium and electronic equipment | |
CN101976206B (en) | A kind of interruption processing method and device | |
CN109491771B (en) | Task processing method based on system performance optimization and related equipment | |
CN114461323A (en) | Card pause processing method and device, electronic equipment and storage medium | |
CN107967181B (en) | Method and device for controlling critical section | |
CN110908792B (en) | Data processing method and device | |
CN113759790A (en) | System optimization method and device for unmanned equipment | |
CN113032110A (en) | High-availability task scheduling method based on distributed peer-to-peer architecture design | |
CN113220442B (en) | Data scheduling method and device and electronic equipment | |
CN112905256B (en) | Data processing method, device, electronic equipment and storage medium | |
CN112988365B (en) | Thread management method, device, equipment and medium | |
CN110308943B (en) | Program running method and device, computing equipment and storage medium | |
CN117527949A (en) | Cloud mobile phone operation monitoring method, system 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 |