CN112181640A - Task processing method and device - Google Patents

Task processing method and device Download PDF

Info

Publication number
CN112181640A
CN112181640A CN202010960228.0A CN202010960228A CN112181640A CN 112181640 A CN112181640 A CN 112181640A CN 202010960228 A CN202010960228 A CN 202010960228A CN 112181640 A CN112181640 A CN 112181640A
Authority
CN
China
Prior art keywords
time
task
long
short
tasks
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.)
Pending
Application number
CN202010960228.0A
Other languages
Chinese (zh)
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.)
Beijing Fantasy Network Technology Co ltd
Original Assignee
Beijing Fantasy Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Fantasy Network Technology Co ltd filed Critical Beijing Fantasy Network Technology Co ltd
Priority to CN202010960228.0A priority Critical patent/CN112181640A/en
Publication of CN112181640A publication Critical patent/CN112181640A/en
Pending legal-status Critical Current

Links

Images

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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation

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 invention discloses a task processing method and a task processing device, wherein the task processing method comprises the following steps: determining a task to be processed as a long-time task or a short-time task according to the execution duration required by the task to be processed; processing the long-time task by utilizing at least one preset long-time thread; processing the short-time task by utilizing at least one short-time thread configured in advance; and submitting the processed task to be processed. According to the invention, the tasks to be processed are classified into the long-time tasks and the short-time tasks and are respectively executed, so that excessive waiting of the short-time tasks is avoided, the processing efficiency of the tasks to be processed is improved, the short-time tasks with higher requirements on timeliness are responded as soon as possible in the running process of the equipment, and the user experience is optimized.

Description

Task processing method and device
Technical Field
The invention relates to the technical field of computers, in particular to a task processing method and a task processing device.
Background
In the android system, how to reasonably call threads to process various tasks can directly influence the overall efficiency of the android device. In the prior art, a reasonable mechanism is not provided for creating and using threads, and situations of excessive thread creation, too frequent thread creation and irregular thread use often occur. Conventional thread management mechanisms have obvious limitations, tasks cannot be assigned with priorities generally, and a large number of tasks must be queued in a queue for execution, so that part of applications appear to be slow in response in the sense of the user.
The defects of the prior art are that performance resources cannot be fully utilized, so that the overall task execution efficiency of the equipment is low, and bad experiences such as jamming and even memory leakage occur.
Disclosure of Invention
The invention provides a task processing method and a task processing device, which are used for at least solving the technical problems in the prior art.
In a first aspect, the present invention provides a task processing method, including:
determining a task to be processed as a long-time task or a short-time task according to the execution duration required by the task to be processed;
processing the long-time task by utilizing at least one preset long-time thread;
processing the short-time task by utilizing at least one short-time thread configured in advance;
and submitting the processed task to be processed.
Preferably, the processing the long-time task by using at least one pre-configured long-time thread includes:
determining the long-time task as an order long-time task or a parallel long-time task according to the processing mode of the long-time task;
processing the sequence long-time task by utilizing one long-time thread;
and processing the parallel long-term task by utilizing at least two long-term threads.
Preferably, the processing the long-time task by using at least one pre-configured long-time thread includes:
arranging the long-time tasks into a long-time task queue according to the priorities of the long-time tasks;
and processing the long-time tasks according to the arrangement sequence of the long-time tasks in the long-time task queue by using the long-time threads.
Preferably, the processing the ephemeral task using the preconfigured at least one ephemeral thread includes:
determining the short-time tasks as sequence short-time tasks or parallel short-time tasks according to the processing mode of the short-time tasks;
processing the ordered short-time tasks using one of the short-time threads;
and processing the parallel short-time tasks by utilizing at least two short-time threads.
Preferably, the processing the ephemeral task using the preconfigured at least one ephemeral thread includes:
arranging the short-time tasks into a short-time task queue according to the priority of the short-time tasks;
and processing the short-time tasks according to the arrangement sequence of the short-time tasks in the short-time task queue by utilizing the short-time thread.
Preferably, the method further comprises the following steps:
a long-time thread pool and a short-time thread pool are established in advance;
the long-time thread pool comprises a plurality of long-time threads;
the short-time thread pool comprises a plurality of short-time threads.
Preferably, the submitting the processed task to be processed includes:
arranging the processed tasks to be processed into a submission queue;
and submitting the tasks to be processed according to the arrangement sequence of the tasks to be processed in the submission queue.
In a second aspect, the present invention provides a task processing apparatus, including:
the task classification module is used for determining the task to be processed as a long-time task or a short-time task according to the execution duration required by the task to be processed;
the long-time task processing module is used for processing the long-time task by utilizing at least one preset long-time thread;
the short-time task processing module is used for processing the short-time task by utilizing at least one pre-configured short-time thread;
and the submitting module is used for submitting the processed task to be processed.
In a third aspect, the present invention provides a computer-readable storage medium storing a computer program for executing the task processing method according to the present invention.
In a fourth aspect, the present invention provides an electronic device comprising:
a processor;
a memory for storing the processor-executable instructions;
the processor is used for reading the executable instruction from the memory and executing the instruction to realize the task processing method.
Compared with the prior art, the task processing method and the task processing device provided by the invention have the advantages that the tasks to be processed are classified into the long-time tasks and the short-time tasks and are respectively executed, so that excessive waiting of the short-time tasks is avoided, the processing efficiency of the tasks to be processed is improved, the short-time tasks with higher requirements on timeliness are responded as soon as possible in the running process of equipment, and the user experience is optimized.
Drawings
Fig. 1 is a schematic flowchart of a task processing method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating another task processing method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a task processing device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, 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 invention.
Summary of the application
In the android system, how to reasonably call threads to process various tasks can directly influence the overall efficiency of the android device. The use of threads is often irregular in the prior art. And the conventional thread management mechanism has obvious limitation, the priority cannot be generally distributed to the tasks, a large number of tasks must be queued and executed in a queue, and the response speed of part of applications on the user sense is slow. The defects of the prior art are that performance resources cannot be fully utilized, so that the overall task execution efficiency of the equipment is low, and bad experiences such as jamming and even memory leakage occur.
Exemplary method
Therefore, the embodiment of the invention provides a task processing method to realize more efficient task processing. As shown in fig. 1, the method in this embodiment includes the following steps:
step 101, determining a task to be processed as a long-time task or a short-time task according to the execution duration required by the task to be processed.
The tasks to be processed, namely the generic names of various tasks needing to be processed in the android device due to user operation or application program running. After the task to be processed is generated, the processor of the android device calls the thread to execute the task. The overall operation efficiency and user experience of the device are directly influenced by the calling mechanism of the thread and the processing mode and sequence of the tasks to be processed.
In this step, the task to be processed may be determined as a long-time task or a short-time task according to the execution duration of each task to be executed. It will be appreciated that different types of tasks to be processed, which are time consuming to perform the processing, may also be different. For example, background log reporting, large file downloading, and other types of tasks to be processed usually take a long time (several fractions or even several hours) to complete; such pending tasks may be determined to be long-time tasks. For example, the small file downloading and caching can be completed in a very short time (several seconds); such a pending task may be determined to be a short-time task.
Obviously, if a long-time task and a short-time task are queued in the same queue for processing, the short-time task may face a longer waiting time, which affects its processing efficiency and user experience. So in this embodiment, the two are selected to be classified and the subsequent processes are performed separately.
And 102, processing the long-time task by utilizing at least one preset long-time thread.
And 103, processing the short-time task by utilizing at least one pre-configured short-time thread.
In this embodiment, a first thread pool is constructed. A plurality of threads may be configured in the first thread pool. The number of threads in the first thread pool is not less than the number of core threads (usually, the number of core threads is equal to the number of cores of the android device processor), and is not more than a preset upper limit of the number of threads. For example, if the number of processor cores is 4, 4 threads may be preset in the thread pool as core threads. When the number of pending tasks is greater than 4, the thread pool may continue to create threads for processing more pending tasks. Until the number of threads reaches an upper thread limit, which may be 20, for example. The upper limit of the thread quantity is set, so that the memory overflow caused by excessive thread quantity can be avoided, and the overall performance of the equipment is exhausted.
The thread survival time may be further set, for example, the thread survival time may be set to 1 second in this embodiment. That is, when the idle time exceeds 1 second after a certain thread completes the task to be processed (no new task to be processed is allocated), the thread is destroyed. Under the condition that the number of the tasks to be processed is small, the number of the threads in the first thread pool is as small as possible, and excessive occupation of performance resources is avoided. The number of threads always reserved in the first thread pool is not lower than the number of core threads.
In steps 102-103, a long-time thread dedicated to processing long-time tasks and a short-time thread dedicated to processing short-time tasks are configured in advance. The long-time task and the short-time task are processed respectively. Processing long-time tasks by using long-time threads; and processing the short-time task by using the short-time thread. Therefore, excessive waiting of the short-time tasks is avoided, the processing efficiency of the tasks to be processed is improved, the short-time tasks with higher requirements on timeliness are responded as soon as possible in the running process of the equipment, and the user experience is optimized.
And 104, submitting the processed task to be processed.
The task to be processed can be submitted after being processed. In this embodiment, the plurality of threads in the first thread pool can process the plurality of to-be-processed tasks in parallel, so that the plurality of to-be-processed tasks may be completed and need to be submitted at the same time. And the simultaneous submission of multiple threads can cause a contention problem and a stuck effect. Therefore, in this embodiment, the processed tasks to be processed may be arranged in a submission queue; and submitting the tasks to be processed according to the arrangement sequence of the tasks to be processed in the submission queue. Thereby avoiding the problems of commit contention and seizure.
According to the technical scheme, the beneficial effects of the embodiment are as follows: the tasks to be processed are classified into long-time tasks and short-time tasks and are executed respectively, so that excessive waiting of the short-time tasks is avoided, the processing efficiency of the tasks to be processed is improved, the short-time tasks with high requirements on timeliness are responded as soon as possible in the running process of the equipment, and the user experience is optimized.
Fig. 1 shows only a basic embodiment of the method of the present invention, and based on this, certain optimization and expansion can be performed, and other preferred embodiments of the method can also be obtained.
Fig. 2 shows another embodiment of the task processing method according to the present invention. The present embodiment is further developed on the basis of the foregoing embodiments. The method specifically comprises the following steps:
step 201, according to the execution duration required by the task to be processed, determining the task to be processed as a long-term task or a short-term task.
The contents of this step are the same as those of the previous embodiment, and the description is not repeated again.
Step 202, determining the long-term task as an order long-term task or a parallel long-term task according to the processing mode of the long-term task.
In this embodiment, besides classifying the tasks to be processed according to the execution duration, the tasks to be processed are further divided according to other dimensions, so as to improve the task processing efficiency to a greater extent. For example, the execution processing of some tasks to be processed needs to depend on the processing results of other tasks; the processing of such tasks must be in a particular order and cannot be processed in parallel. The task having this characteristic in the long-term task is further determined as the sequential long-term task in this embodiment. Other tasks to be processed can be processed in parallel without depending on processing results of other tasks; the task having this characteristic in the long-term task is further determined as the parallel long-term task in this embodiment.
In addition, preferably, priorities can be assigned to different long-time tasks according to timeliness requirements of the long-time tasks. For example, the priority level in this embodiment may include three levels of "high priority level", "medium priority level", and "low priority level". And arranging the long-time tasks into a long-time task queue according to the priority of the long-time tasks. Specifically, queues may be respectively established for the sequential long-term tasks and the parallel long-term tasks, and the queues may be arranged in respective queues according to the priority order to wait for processing.
Step 203, processing the order long-term task by using one long-term thread; and processing the parallel long-term task by utilizing at least two long-term threads.
And because the order long-time tasks cannot be processed in parallel, only one long-time thread is required to be allocated and is specially used for processing the order long-time tasks. Specifically, the tasks may be sequentially processed in the queue according to the order of the priorities in the long-order task. I.e. processing one order long task in the queue at a time.
The parallel long-time tasks can be processed in parallel. Multiple long-term threads may be allocated dedicated to processing the parallel long-term tasks for efficiency. Specifically, the parallel long-time tasks may be sequentially processed in the queue according to the order of priority. Multiple parallel long-time tasks in the queue are processed in parallel at a time. The amount of parallel processing depends on the number of threads allocated.
And 204, determining the short-time tasks as sequence short-time tasks or parallel short-time tasks according to the processing mode of the short-time tasks.
Similarly, the short-time tasks can be further divided according to other dimensions, so that the task processing efficiency is improved to a greater extent. Namely, according to the processing mode of the short-time tasks, the short-time tasks are determined as sequential short-time tasks or parallel short-time tasks. The principle is the same as in step 202, and the description is not repeated.
In addition, preferably, priorities can be assigned to different short-time tasks according to timeliness requirements of the short-time tasks. For example, the priority level in this embodiment may include three levels of "high priority level", "medium priority level", and "low priority level". And arranging the short-time tasks into a short-time task queue according to the priority of the short-time tasks. Specifically, queues may be respectively established for the order short-time tasks and the parallel short-time tasks, and the order short-time tasks and the parallel short-time tasks are arranged in respective queues according to the priority order to wait for processing.
Step 205, processing the sequence short-time tasks by using one short-time thread; and processing the parallel short-time tasks by utilizing at least two short-time threads.
Since the order short-time tasks cannot be processed in parallel, only one short-time thread needs to be allocated and is specially used for processing the order short-time tasks. Specifically, the tasks may be sequentially processed in the queue according to the order of the priorities in the order of short-time tasks. I.e. processing one sequential short-time task in the queue at a time.
The parallel short-time tasks can be processed in parallel. Multiple ephemeral threads may be allocated dedicated to processing the parallel ephemeral tasks for efficiency. Specifically, the parallel short-time tasks may be sequentially processed in the queue according to the order of priority. Multiple parallel short-time tasks in the queue are processed in parallel at a time. The amount of parallel processing depends on the number of threads allocated.
And step 206, submitting the processed task to be processed.
The contents of this step are the same as those of the previous embodiment, and the description is not repeated again.
It should be noted that, in this embodiment, the configuration of the long-time thread and the short-time thread may be implemented by the first thread pool in the same manner as the embodiment shown in fig. 1. A long-time thread pool and a short-time thread pool can also be respectively established in advance; the long-time thread pool comprises a plurality of long-time threads; the short-time thread pool comprises a plurality of short-time threads. And respectively constructing special thread pools for the long-time tasks and the short-time tasks. The number of the core threads, the upper limit of the number of the threads and the survival time of the threads in the long-time thread pool and the short-time thread pool can be respectively set according to requirements. Both of the above two thread configurations are included in the overall technical solution of the present invention. In specific application, the method can be selected and implemented according to actual conditions and requirements.
It should be further noted that, preferably, in this embodiment, on the basis of the above technical solution, the task to be processed is further divided into a foreground task and a background task. And allocates unit time of the processor to the foreground task preferentially in the processing process. In practice, a processor consumes a number of units of time while processing a task. And the processor does not have to start processing the next task after processing the last task. The processor may also choose to allocate several units of time to process the last task and to reallocate several units of time to process the next task if the last task has not yet been completed, thereby maximizing overall efficiency. The unit time of the processor can be preferentially allocated to the foreground task in the embodiment, so that the faster response speed of the foreground task is ensured, the user can experience more smoothly, and the pause feeling of the card is reduced.
According to the technical scheme, on the basis of the foregoing embodiment, the present embodiment further has the following beneficial effects: the tasks to be processed are classified through three dimensions of execution duration, processing mode and priority, so that the task processing efficiency is improved to a greater extent, the utilization rate of performance resources is improved, and the user experience is also improved; the unit time of the processor is preferentially allocated to the foreground task, so that the faster response speed of the foreground task is ensured, the user experience is smoother, and the card pause feeling is reduced.
Exemplary devices
Fig. 3 shows a specific embodiment of the task processing device according to the present invention. The apparatus of this embodiment is a physical apparatus for performing the method described in fig. 1-2. The technical solution is essentially the same as that in the above embodiment, and the corresponding description in the above embodiment is also applicable to this embodiment. The device in this embodiment includes:
the task classification module 301 is configured to determine, according to an execution duration required by a task to be processed, the task to be processed as a long-term task or a short-term task.
And a long-time task processing module 302, configured to process the long-time task by using at least one pre-configured long-time thread.
A short-time task processing module 303, configured to process the short-time task by using at least one pre-configured short-time thread.
A submitting module 304, configured to submit the processed task to be processed.
In addition, on the basis of the embodiment shown in fig. 3, it is preferable that:
the long-time task processing module 302 includes:
and the first classification unit is used for determining the long-time task as an order long-time task or a parallel long-time task according to the processing mode of the long-time task.
And the first order processing unit is used for processing the order long-time task by utilizing one long-time thread.
And the first parallel processing unit is used for processing the parallel long-term task by utilizing at least two long-term threads.
And the first priority unit is used for arranging the long-time tasks into a long-time task queue according to the priority of the long-time tasks.
The first order processing unit and the first parallel processing unit process the long-term tasks according to the arrangement order of the long-term tasks in the long-term task queue by using the long-term threads.
The short-time task processing module 303 includes:
and the second classification unit is used for determining the short-time tasks as sequence short-time tasks or parallel short-time tasks according to the processing mode of the short-time tasks.
And the second order processing unit is used for processing the order short-time tasks by utilizing one short-time thread.
And the second parallel processing unit is used for processing the parallel short-time tasks by utilizing at least two short-time threads.
And the second priority unit is used for arranging the short-time tasks into a short-time task queue according to the priority of the short-time tasks.
The second secondary processing unit and the second parallel processing unit process the short-time tasks according to the arrangement sequence of the short-time tasks in the short-time task queue by using the short-time threads.
The device further comprises:
the thread pool module is used for establishing a long-time thread pool and a short-time thread pool in advance; the long-time thread pool comprises a plurality of long-time threads; the short-time thread pool comprises a plurality of short-time threads.
The commit module 304 includes:
and the queue unit is used for arranging the processed tasks to be processed into a submission queue.
And the submitting unit is used for submitting the tasks to be processed according to the arrangement sequence of the tasks to be processed in the submitting queue.
Exemplary computer program product and computer-readable storage Medium
In addition to the above-described methods and apparatus, embodiments of the present application may also be a computer program product comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps in the methods according to the various embodiments of the present application described in the "exemplary methods" section of this specification, above.
The computer program product may be written with program code for performing the operations of embodiments of the present application in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present application may also be a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, cause the processor to perform steps in a method according to various embodiments of the present application described in the "exemplary methods" section above of this specification.
The computer-readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing describes the general principles of the present application in conjunction with specific embodiments, however, it is noted that the advantages, effects, etc. mentioned in the present application are merely examples and are not limiting, and they should not be considered essential to the various embodiments of the present application. Furthermore, the foregoing disclosure of specific details is for the purpose of illustration and description and is not intended to be limiting, since the foregoing disclosure is not intended to be exhaustive or to limit the disclosure to the precise details disclosed.
The block diagrams of devices, apparatuses, systems referred to in this application are only given as illustrative examples and are not intended to require or imply that the connections, arrangements, configurations, etc. must be made in the manner shown in the block diagrams. These devices, apparatuses, devices, systems may be connected, arranged, configured in any manner, as will be appreciated by those skilled in the art. Words such as "including," "comprising," "having," and the like are open-ended words that mean "including, but not limited to," and are used interchangeably therewith. The words "or" and "as used herein mean, and are used interchangeably with, the word" and/or, "unless the context clearly dictates otherwise. The word "such as" is used herein to mean, and is used interchangeably with, the phrase "such as but not limited to".
It should also be noted that in the devices, apparatuses, and methods of the present application, the components or steps may be decomposed and/or recombined. These decompositions and/or recombinations are to be considered as equivalents of the present application.
The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the application. Thus, the present application is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, the description is not intended to limit embodiments of the application to the form disclosed herein. While a number of example aspects and embodiments have been discussed above, those of skill in the art will recognize certain variations, modifications, alterations, additions and sub-combinations thereof.

Claims (10)

1. A task processing method, comprising:
determining a task to be processed as a long-time task or a short-time task according to the execution duration required by the task to be processed;
processing the long-time task by utilizing at least one preset long-time thread;
processing the short-time task by utilizing at least one short-time thread configured in advance;
and submitting the processed task to be processed.
2. The method of claim 1, wherein processing the long-time task using the at least one pre-configured long-time thread comprises:
determining the long-time task as an order long-time task or a parallel long-time task according to the processing mode of the long-time task;
processing the sequence long-time task by utilizing one long-time thread;
and processing the parallel long-term task by utilizing at least two long-term threads.
3. The method of claim 1, wherein processing the long-time task using the at least one pre-configured long-time thread comprises:
arranging the long-time tasks into a long-time task queue according to the priorities of the long-time tasks;
and processing the long-time tasks according to the arrangement sequence of the long-time tasks in the long-time task queue by using the long-time threads.
4. The method of claim 1, wherein processing the ephemeral task using the preconfigured at least one ephemeral thread comprises:
determining the short-time tasks as sequence short-time tasks or parallel short-time tasks according to the processing mode of the short-time tasks;
processing the ordered short-time tasks using one of the short-time threads;
and processing the parallel short-time tasks by utilizing at least two short-time threads.
5. The method of claim 1, wherein processing the ephemeral task using the preconfigured at least one ephemeral thread comprises:
arranging the short-time tasks into a short-time task queue according to the priority of the short-time tasks;
and processing the short-time tasks according to the arrangement sequence of the short-time tasks in the short-time task queue by utilizing the short-time thread.
6. The method according to any one of claims 1 to 5, further comprising:
a long-time thread pool and a short-time thread pool are established in advance;
the long-time thread pool comprises a plurality of long-time threads;
the short-time thread pool comprises a plurality of short-time threads.
7. The method according to any one of claims 1 to 5, wherein the submitting the processed task to be processed comprises:
arranging the processed tasks to be processed into a submission queue;
and submitting the tasks to be processed according to the arrangement sequence of the tasks to be processed in the submission queue.
8. A task processing apparatus, comprising:
the task classification module is used for determining the task to be processed as a long-time task or a short-time task according to the execution duration required by the task to be processed;
the long-time task processing module is used for processing the long-time task by utilizing at least one preset long-time thread;
the short-time task processing module is used for processing the short-time task by utilizing at least one pre-configured short-time thread;
and the submitting module is used for submitting the processed task to be processed.
9. A computer-readable storage medium storing a computer program for executing the task processing method according to any one of claims 1 to 7.
10. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
the processor is used for reading the executable instructions from the memory and executing the instructions to realize the task processing method of any one of the claims 1 to 7.
CN202010960228.0A 2020-09-14 2020-09-14 Task processing method and device Pending CN112181640A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010960228.0A CN112181640A (en) 2020-09-14 2020-09-14 Task processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010960228.0A CN112181640A (en) 2020-09-14 2020-09-14 Task processing method and device

Publications (1)

Publication Number Publication Date
CN112181640A true CN112181640A (en) 2021-01-05

Family

ID=73920870

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010960228.0A Pending CN112181640A (en) 2020-09-14 2020-09-14 Task processing method and device

Country Status (1)

Country Link
CN (1) CN112181640A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112959926A (en) * 2021-03-05 2021-06-15 广西双英集团股份有限公司 Time division control method for dynamic multi-task car cabin platform

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140380320A1 (en) * 2013-06-20 2014-12-25 International Business Machines Corporation Joint optimization of multiple phases in large data processing
US20150058858A1 (en) * 2013-08-21 2015-02-26 Hasso-Platt ner-Institut fur Softwaresystemtechnik GmbH Dynamic task prioritization for in-memory databases
CN106844043A (en) * 2016-12-29 2017-06-13 北京五八信息技术有限公司 The treating method and apparatus of cluster task
CN108920261A (en) * 2018-05-23 2018-11-30 中国航天系统科学与工程研究院 A kind of two-stage self-adapting dispatching method suitable for large-scale parallel data processing task
CN109992414A (en) * 2019-03-12 2019-07-09 平安普惠企业管理有限公司 A kind of task processing method and device based on thread pool
CN111026519A (en) * 2018-10-10 2020-04-17 上海宝信软件股份有限公司 Distributed task priority scheduling method and system and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140380320A1 (en) * 2013-06-20 2014-12-25 International Business Machines Corporation Joint optimization of multiple phases in large data processing
US20150058858A1 (en) * 2013-08-21 2015-02-26 Hasso-Platt ner-Institut fur Softwaresystemtechnik GmbH Dynamic task prioritization for in-memory databases
CN106844043A (en) * 2016-12-29 2017-06-13 北京五八信息技术有限公司 The treating method and apparatus of cluster task
CN108920261A (en) * 2018-05-23 2018-11-30 中国航天系统科学与工程研究院 A kind of two-stage self-adapting dispatching method suitable for large-scale parallel data processing task
CN111026519A (en) * 2018-10-10 2020-04-17 上海宝信软件股份有限公司 Distributed task priority scheduling method and system and storage medium
CN109992414A (en) * 2019-03-12 2019-07-09 平安普惠企业管理有限公司 A kind of task processing method and device based on thread pool

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112959926A (en) * 2021-03-05 2021-06-15 广西双英集团股份有限公司 Time division control method for dynamic multi-task car cabin platform

Similar Documents

Publication Publication Date Title
RU2538920C2 (en) Method for task distribution by computer system server, computer-readable data medium and system for implementing said method
CN107832143B (en) Method and device for processing physical machine resources
US20150121388A1 (en) Task scheduling method for dispatching tasks based on computing power of different processor cores in heterogeneous multi-core processor system and related non-transitory computer readable medium
US8627325B2 (en) Scheduling memory usage of a workload
CN107577523B (en) Task execution method and device
CN110737534A (en) Task processing method and device and server
CN111459754B (en) Abnormal task processing method, device, medium and electronic equipment
CN112905342B (en) Resource scheduling method, device, equipment and computer readable storage medium
CN112783659B (en) Resource allocation method and device, computer equipment and storage medium
CN109840149B (en) Task scheduling method, device, equipment and storage medium
CN107818012B (en) Data processing method and device and electronic equipment
CN110851276A (en) Service request processing method, device, server and storage medium
CN110780991B (en) Deep learning task scheduling method and device based on priority
CN114461365A (en) Process scheduling processing method, device, equipment and storage medium
CN106775975B (en) Process scheduling method and device
CN114968567A (en) Method, apparatus and medium for allocating computing resources of a compute node
CN111625339A (en) Cluster resource scheduling method, device, medium and computing equipment
CN112181640A (en) Task processing method and device
CN114327894A (en) Resource allocation method, device, electronic equipment and storage medium
CN109002286A (en) Data asynchronous processing method and device based on synchronous programming
CN109491785B (en) Memory access scheduling method, device and equipment
CN117519930A (en) Method and device for executing batch tasks and electronic equipment
CN112685158B (en) Task scheduling method and device, electronic equipment and storage medium
CN116069500A (en) Model training task processing method and device, electronic equipment and readable medium
CN112130977B (en) Task scheduling method, device, equipment and 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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210105

RJ01 Rejection of invention patent application after publication