CN116700974A - Multi-process task processing method and device, electronic equipment and storage medium - Google Patents

Multi-process task processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116700974A
CN116700974A CN202310694769.7A CN202310694769A CN116700974A CN 116700974 A CN116700974 A CN 116700974A CN 202310694769 A CN202310694769 A CN 202310694769A CN 116700974 A CN116700974 A CN 116700974A
Authority
CN
China
Prior art keywords
task
memory
time
determining
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
CN202310694769.7A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310694769.7A priority Critical patent/CN116700974A/en
Publication of CN116700974A publication Critical patent/CN116700974A/en
Pending legal-status Critical Current

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/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
    • 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/4812Task transfer initiation or dispatching by interrupt, e.g. masked
    • G06F9/4831Task transfer initiation or dispatching by interrupt, e.g. masked with variable priority
    • G06F9/4837Task transfer initiation or dispatching by interrupt, e.g. masked with variable priority time dependent
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/484Precedence
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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 multi-process task processing method, a device, electronic equipment and a storage medium, which can be used in the financial field. The method is applied to a terminal, and at least two task processes are configured in the terminal; comprising the following steps: acquiring a task to be processed, and writing the task to be processed into a memory; determining the starting execution time of each task in the memory, and sequencing the tasks in the memory according to the starting execution time of each task in the memory; determining a target task from the memory according to the sequencing result; if the current time is determined to be the starting execution time of the target task, executing the target task by adopting a preset first task process, and determining a second task process from all task processes; wherein the second task process is for executing the next target task. The application places the tasks in the memory for ordering, and determines the progress of the task to be executed before the task is executed, thereby ensuring the task to be directly processed when the execution starting time is reached and improving the task processing efficiency.

Description

Multi-process task processing method and device, electronic equipment and storage medium
Technical Field
The present application relates to data processing technologies in the financial field, and in particular, to a multi-process task processing method, apparatus, electronic device, and storage medium.
Background
The system needs to execute a large number of tasks when working, and the release time and the execution time of each task can be different. When processing tasks, a large number of tasks need to be scheduled, and the tasks to be executed are determined.
In the current task execution process, compared with larger resources and task numbers, when determining the task to be executed, not only can a great amount of running time be consumed, but also the wrong task can be executed, or different processes execute the same task, so that the execution efficiency and the accuracy of the task are greatly influenced.
Disclosure of Invention
The application provides a multi-process task processing method, a multi-process task processing device, electronic equipment and a storage medium, which are used for improving the efficiency and the precision of task processing.
In a first aspect, the present application provides a multi-process task processing method, where the method is applied to a terminal, where at least two task processes are configured in the terminal; the method comprises the following steps:
acquiring a task to be processed, and writing the task to be processed into a memory;
Determining the starting execution time of each task in a memory, and sequencing the tasks in the memory according to the starting execution time of each task in the memory;
determining a target task from the memory according to the sequencing result;
if the current time is determined to be the starting execution time of the target task, executing the target task by adopting a preset first task process, and determining a second task process from all task processes; the second task process is used for executing the next target task.
In a second aspect, the present application provides a multi-process task processing device, where the device is applied to a terminal, and at least two task processes are configured in the terminal; the device comprises:
the task writing module is used for acquiring a task to be processed and writing the task to be processed into the memory;
the task ordering module is used for determining the starting execution time of each task in the memory and ordering the tasks in the memory according to the starting execution time of each task in the memory;
the task determining module is used for determining a target task from the memory according to the sequencing result;
the task execution module is used for executing the target task by adopting a preset first task process if the current time is determined to be the starting execution time of the target task, and determining a second task process from all task processes; the second task process is used for executing the next target task.
In a third aspect, the present application provides an electronic device comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions stored in the memory to implement the multi-process task processing method according to the first aspect of the present application.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, are adapted to carry out the multi-process task processing method according to the first aspect of the present application.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the multi-process task processing method according to the first aspect of the present application.
The application provides a multi-process task processing method, a device, electronic equipment and a storage medium, which can write tasks to be processed into a memory, order all tasks existing in the memory according to the starting execution time of the tasks, and determine the execution sequence of the tasks in the memory. Each time a task is written to the memory, the ordering of the tasks in the memory may change. The target task, i.e. the task to be executed next, is determined from the current ordering result. After the sequencing result is changed each time, the target task may be changed, so that the flexibility of task processing is improved, and the task with urgent priority is ensured to be processed. And if the current time is the starting execution time of the target task, proving that the target task needs to be executed. A first task process is preset, and the target task is executed by the first task process. And determining a second task process from other task processes so as to facilitate the execution of the next target task. By sequencing the tasks, the tasks to be executed can be quickly determined, and the task scheduling efficiency and the task processing precision are improved. By presetting the task process for executing the task, the task can be rapidly processed when the task starts to execute, the task process is not required to be determined, and the task processing efficiency is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a schematic flow chart of a multi-process task processing method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a minimum heap binary tree provided in an embodiment of the present application;
FIG. 3 is a schematic diagram of node ordering of a minimum heap binary tree provided by an embodiment of the present application;
FIG. 4 is a schematic flow chart of a multi-process task processing method according to an embodiment of the present application;
FIG. 5 is a block diagram of a multi-process task processing device according to an embodiment of the present application;
FIG. 6 is a block diagram of a multi-process task processing device according to an embodiment of the present application;
fig. 7 is a block diagram of an electronic device according to an embodiment of the present application;
fig. 8 is a block diagram of an electronic device according to an embodiment of the present application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the following detailed description of the embodiments of the present application will be given with reference to the accompanying drawings.
It should be understood that the described embodiments are merely some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application as detailed in the accompanying claims.
In the description of the present application, it should be understood that the terms "first," "second," "third," and the like are used merely to distinguish between similar objects and are not necessarily used to describe a particular order or sequence, nor should they be construed to indicate or imply relative importance. The specific meaning of the above terms in the present application can be understood by those of ordinary skill in the art according to the specific circumstances. Furthermore, in the description of the present application, unless otherwise indicated, "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
It should be noted that the method, the device, the electronic device and the storage medium for processing multi-process tasks of the present application can be used in the financial field, and can also be used in any field other than the financial field. The application fields of the multi-process task processing method, the device, the electronic equipment and the storage medium are not limited.
It should be noted that the present disclosure is not limited to all the alternative embodiments, and those skilled in the art who review this disclosure will recognize that any combination of the features may be used to construct the alternative embodiments as long as the features are not mutually inconsistent. The following describes each embodiment in detail.
For a large resource and task number, the searching method and the returning method of the task in the task scheduling process are very time-consuming, so that the processing efficiency of the task is too low to be applied to actual engineering. In addition, a plurality of task consumers, which are processes for processing tasks, may exist in the terminal. If there are multiple task consumers to process the task, there may be a case where the same task is repeatedly processed by different task consumers, which affects the processing efficiency and accuracy of the task.
The application provides a multi-process task processing method, a device, electronic equipment and a storage medium, and aims to solve the technical problems in the prior art.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 1 is a flow chart of a multi-process task processing method according to an embodiment of the present application, where the method is applied to a terminal, and at least two task processes are configured in the terminal, and the method may be executed by a multi-process task processing device. As shown in fig. 1, the method comprises the steps of:
s101, acquiring a task to be processed, and writing the task to be processed into a memory.
By way of example, different tasks may be pre-designed, which may be things that need to be performed during system operation, and different tasks may be performed at different times. For example, two tasks may be issued, each of settling the transaction amount within 24 hours at a first time, and sending a prompt for preset content to the user at a second time. Tasks submitted by the staff can be acquired in real time or in a timed manner and used as tasks waiting to be processed, namely, tasks waiting to be processed.
One task to be processed or a plurality of tasks to be processed can be acquired each time, and in this embodiment, when a worker submits one task to be processed, the task to be processed can be acquired. The task to be processed can be in the form of a data packet, and after the task to be processed is acquired, the data packet can be analyzed to determine task information such as the starting execution time of the task, the task type and the like. The task to be processed and the corresponding task information can be recorded in a preset database for persistent storage. And writing the task to be processed and the corresponding task information into a preset memory, wherein a plurality of tasks can be stored in the memory, and after the task is processed, the processed task is not stored in the memory any more. The tasks to be processed can be written into the memory one at a time, and the tasks in the memory can be accumulated.
The task capacity of the memory may be preset, and the task capacity may be the maximum value of the number of tasks that the memory can store. After the task to be processed is acquired, the current task number in the memory can be determined, and if the current task number reaches the preset task capacity, the subsequent task to be processed can not be stored in the memory. For example, the task to be processed may be placed in the database first, and then written into the memory when the task in the memory is reduced.
S102, determining the starting execution time of each task in the memory, and sequencing the tasks in the memory according to the starting execution time of each task in the memory.
Illustratively, each task corresponds to its own start execution time, which refers to the time at which the task is to be processed. For example, a task may be preset to start execution at 15 points, and when the task is submitted, the 15 points may be written into the data packet of the task. The memory may have a plurality of tasks, and after one or more tasks to be processed are written into the memory, the starting execution time of all the tasks currently stored in the memory is determined. That is, the start execution time of the currently written task to be processed and the start execution time of the task already stored in the memory are determined.
And sequencing the tasks in the memory according to the starting execution time of each task in the memory. For example, the start execution time may be ordered in order of decreasing start execution time, with decreasing start execution time as the start execution time is closer to the current time. For example, the time difference between the current time and each start execution time may be determined, and the time differences may be sorted to obtain the order of the tasks corresponding to the time differences. The time differences may be ordered from small to large, i.e. in the ordering result, the task ordered first may be the task whose start execution time is closest to the current time.
In this embodiment, sorting tasks in the memory according to the starting execution time of each task in the memory includes: sequencing the starting execution time of each task in the memory according to the time size to obtain the time sequence of each task in the memory; writing the tasks in the memory into a pre-built minimum heap binary tree based on a preset minimum heap ordering rule according to the time sequence of each task in the memory; wherein one node in the minimum heap binary tree represents one task, and the connection sequence between the nodes is used for representing the ordering of the tasks.
Specifically, the ordering result of the tasks may be represented in the form of a minimum heap binary tree. The minimum heap binary tree is a complete binary tree that is ordered, wherein the data value of any non-leaf node is no greater than the data values of its left and right child nodes. In this embodiment, the data value of the node may be a time difference between the start execution time of the task corresponding to the node and the current time. And sequencing the starting execution time according to the time of the starting execution time of each task to obtain the time sequence of the starting execution time corresponding to the task. For example, the start execution times may be ordered from early to late, with earlier start execution times ordered earlier.
A minimum heap sort rule is preset, which may be used to determine on which node of the minimum heap binary tree each task is placed. For example, the task closest to the current time may be determined as the root node of the minimum heap binary tree. Traversing each task from the root node to the bottom according to the determined time sequence, placing each task at one node, and constructing a complete minimum heap binary tree. The connection sequence among the nodes is the sequence of the tasks. Fig. 2 is a schematic diagram of a minimum heap binary tree, and the connection sequence of the nodes in fig. 2 is node one, node two, node three, node four, node five and node six.
The method has the advantages that the tasks can be ordered by setting the minimum heap binary tree, so that the tasks can be added or deleted, new task data can be received and scheduled at any time, the robustness of task scheduling is improved, and the task processing efficiency is further improved.
In this embodiment, the minimum heap sort rule is used to represent that, in the time sequence, the task corresponding to the minimum start execution time is determined as the root node of the minimum heap binary tree; and in the minimum heap binary tree, the start execution time corresponding to the non-leaf node is not more than the start execution time corresponding to the left child node and the right child node of the minimum heap binary tree.
Specifically, a minimum heap sort rule is preset, where the minimum heap sort rule may include determining, as a root node of the minimum heap binary tree, a task corresponding to a minimum start execution time in the time sequence. That is, after obtaining the start execution time of each task in the memory, selecting the task with the earliest start execution time, and corresponding the task to the root node in the minimum heap binary tree. In the minimum binary tree, the data value of each node may be the time difference between the start execution time and the current time of the corresponding task, i.e., the data value of the root node is the earliest time difference between the start execution time and the current time. And each task is sequentially corresponding to the nodes of the minimum heap binary tree from top to bottom according to the time sequence.
The minimum heap sort rule may further include that, in the minimum heap binary tree, start execution times corresponding to the non-leaf nodes are not greater than start execution times corresponding to the left child node and the right child node of the minimum heap binary tree. That is, for the root node and the intermediate node, one left child node and one right child node may be respectively corresponding. And the data values of the root node and the intermediate node are smaller than or equal to the data value of the left child node of the root node and smaller than or equal to the data value of the right child node of the root node. FIG. 3 is a schematic diagram of node ordering for a minimum heap binary tree. The data value marked at the node in fig. 3 is the time difference between the start execution time of the task corresponding to the node and the current time, and the task of the root node occurs earliest, and the time difference from the current time is 10 minutes. The time difference corresponding to the two intermediate nodes is smaller than the time difference corresponding to the child nodes of the intermediate nodes.
The method has the advantages that the tasks can be orderly arranged, the earlier tasks are guaranteed to be executed preferentially, and after new tasks are written in the memory through the minimum heap ordering rule, the node sequence of the minimum heap binary tree can be flexibly changed, so that the tasks are inserted. For example, when a new task is written to memory, the new task may be added as a leaf node. And comparing the data value between the leaf node and the parent node of the leaf node, and if the data value of the leaf node is larger than that of the parent node, moving the leaf node upwards so as to update the minimum heap binary tree.
If a task is processed, the task is deleted from the minimum heap binary tree. The data of the root node is deleted every time, and the adjustment from top to bottom is performed once from the root node. During adjustment, the minimum value is found in the left child node and the right child node of the original root node and is used as a new root node, so that the minimum heap binary tree is updated, and the flexibility of task scheduling is improved.
S103, determining a target task from the memory according to the sorting result.
Illustratively, after the sorting result of the tasks is obtained, one of the tasks is determined from the memory as the target task. For example, the task ranked first may be determined as the target task. After processing a task, a new target task can be determined; every time a task is written into the memory, a new target task can be determined. And determining the current target task in real time, so that when the starting execution time of the target task arrives, the current target task is processed in time.
In this embodiment, determining the target task from the memory according to the sorting result includes: and determining the task corresponding to the root node in the minimum heap binary tree as a target task.
Specifically, the task is written into the minimum heap binary tree of the memory, and the starting execution time of the root node task is closest to the current time, i.e. the root node task needs to be processed earliest. And determining a root node from the minimum heap binary tree, and determining a task corresponding to the root node as a target task. The target task may change from time to time, for example, when a new task is inserted or a task is completed, the target task is updated. The root node of the minimum heap binary tree can be determined in real time, and the current latest target task is obtained.
The method has the advantages that the target task can be rapidly determined through the minimum heap binary tree, whether the task in the memory changes or not is determined, the task corresponding to the root node is determined, searching and determining from a large number of tasks are not needed, task scheduling efficiency is improved, and task processing efficiency is further improved.
S104, if the current time is determined to be the starting execution time of the target task, executing the target task by adopting a preset first task process, and determining a second task process from all task processes; wherein the second task process is for executing the next target task.
Illustratively, a start execution time of the target task is determined as the target execution time. The current time is determined in real time, and whether the current time reaches the target execution time is determined, for example, a time difference between the current time and the target execution time may be determined, and if the time difference is 0, the current time reaches the target execution time. If the current time does not reach the target execution time, continuing to determine the current time, and judging; if the current time reaches the target execution time, the target task needs to be processed.
The terminal is preset with a plurality of task consumers, namely task processes, and the task consumers are used for representing the processes for processing the tasks. One of the plurality of task consumers is selected in advance as a first task consumer, that is, a first task process. The states of the task consumers may include an idle state and an active state, the first task consumer being in the idle state. And when determining that the target task needs to be executed, enabling the first task consumer to process the target task, and updating the current state of the first task consumer from the idle state to the working state. A task consumer in an idle state is determined from the other task consumers except the first task consumer as a second task consumer, namely a second process. When the first task consumer processes the target task, the minimum heap binary tree has updated the new target task. Therefore, when the original target task is processed, the terminal also monitors whether the current time reaches the starting execution time of the new target task, and if so, the second task consumer is directly adopted to process the new target task. The method and the device realize rapid processing of the task, save the time of task processing and improve the task processing efficiency. In this embodiment, each time a target task is executed, a task consumer may be determined from a plurality of task consumers to wait for processing a next target task.
The embodiment of the application provides a multi-process task processing method, which can write tasks to be processed into a memory, sort all tasks existing in the memory according to the starting execution time of the tasks, and determine the execution sequence of the tasks in the memory. Each time a task is written to the memory, the ordering result of the task in the memory may change. The target task, i.e. the task to be executed next, is determined from the current ordering result. After the sequencing result is changed each time, the target task may be changed, so that the flexibility of task processing is improved, and the task with the earliest execution time is ensured to be preferentially processed. And if the current time is the starting execution time of the target task, proving that the target task needs to be executed. A first task process is preset, and the target task is executed by the first task process. And determining a second task process from other task processes so as to facilitate the execution of the next target task. By sequencing the tasks, the tasks to be executed can be quickly determined, and the task scheduling efficiency and the task processing precision are improved. By presetting the task process for executing the task, the task can be rapidly processed when the task starts to execute, the task process is not required to be determined, and the task processing efficiency is improved.
Fig. 4 is a flow chart of a multi-process task processing method according to an embodiment of the present application, where the embodiment is an alternative embodiment based on the foregoing embodiment.
In this embodiment, the task to be processed is acquired, which may be thinned as: if at least two tasks which are not written into the memory exist in the preset task database, determining the starting execution time of the tasks which are not written into the memory in the task database; the task database is used for carrying out persistent storage on the task; and determining the task to be processed according to the starting execution time of the task which is not written into the memory in the task database.
As shown in fig. 4, the method comprises the steps of:
s401, if at least two tasks which are not written into the memory exist in a preset task database, determining the starting execution time of the tasks which are not written into the memory in the task database; the task database is used for carrying out persistent storage on the tasks.
For example, after submitting a task, a worker may first store the task in a preset task database. All tasks are stored in the task database, and whether the tasks are executed or not, all tasks are recorded in the task database. The task database may store a processing progress of each task, where the processing progress may indicate whether the task is written into the memory, whether the task is processed, and the like. For example, a first identifier may be preset, where the first identifier may be used to indicate that the task is written to the memory. If the task has the first identifier, indicating that the task is written into the memory; if the task does not have the first identifier, the task is indicated to not be written into the memory.
The task database may send its own stored unprocessed tasks to the memory in real time or periodically, e.g., once the task database receives a task to be processed, it sends the task to the memory. The task database may continually send tasks to memory, one at a time. When a task is sent, a task which does not contain a first identifier in a task database, namely a task which is not written into a memory, can be determined first, and the task is written into the memory. If there are a plurality of tasks that are not written into the memory, the start execution time of the tasks that are not written into the memory is determined. Each task corresponds to own start execution time, and the data packet of the task can be analyzed to obtain the start execution time. If the task database does not have tasks which are not written into the memory, the tasks do not need to be written into the memory.
S402, determining a task to be processed according to the starting execution time of the task which is not written into the memory in the task database, and writing the task to be processed into the memory.
For example, after obtaining the starting execution time of the tasks in the plurality of unwritten memories, a task to be processed may be determined from the tasks in the unwritten memories, and the task to be processed is written into the memories. For example, the task whose start execution time is earliest may be determined as the task to be processed. The tasks submitted by the staff are written into the minimum binary tree of the memory according to the time sequence, so that the minimum binary tree is continuously expanded downwards, and the tasks corresponding to the root node are prevented from being changed frequently.
In this embodiment, determining the task to be processed according to the start execution time of the task in the task database, which is not written into the memory, includes: determining a time difference between the start execution time of each task which is not written into the memory and the current time; and comparing the time differences, and determining the task corresponding to the time difference with the minimum value as the task to be processed.
Specifically, the current time is determined, and the starting execution time of each task written into the memory is compared with the current time respectively to obtain the time difference between the starting execution time of the task not written into the memory and the current time. The individual time differences are ordered by size, e.g. from small to large. And determining the minimum time difference from the sequencing, and determining the task corresponding to the time difference as the task to be processed. That is, the task corresponding to the start execution time closest to the current time is determined as the task to be processed.
The method has the advantages that the task to be executed earliest is determined to be the task to be processed and is written into the memory, so that the memory can be used for preferentially processing the task with earliest execution time, delay of task processing is avoided, and the task processing efficiency is improved.
S403, determining the starting execution time of each task in the memory, and sequencing the tasks in the memory according to the starting execution time of each task in the memory.
Illustratively, this step may be referred to the above step S102, and will not be described herein.
S404, determining a target task from the memory according to the sorting result.
For example, this step may refer to step S103, and will not be described in detail.
S405, if the current time is determined to be the starting execution time of the target task, executing the target task by adopting a preset first task process, and determining a second task process from all task processes; wherein the second task process is for executing the next target task.
In an exemplary embodiment, a first task process is determined from a plurality of task processes in advance, and after determining that the current time is the start execution time of the target task, the first task process is adopted to process the target task, and a second task process is determined from the plurality of task processes, so that the next target task can be processed in time.
In this embodiment, the first task process is a task process determined in advance from task processes in multiple idle states; determining a second task process from all task processes, including: determining the task process in an idle state from all task processes as a candidate process; and randomly selecting one task process from the candidate processes to be a second task process.
Specifically, the terminal is configured with a plurality of task processes, and the states of the task processes may include an idle state and a working state. When determining the first task process from the plurality of task processes, the determination is necessarily performed from task processes in an idle state, and one idle task process can be randomly selected as the first task process.
The first task process waits for executing the target task at any time, when the first task process starts to process the target task, the state of the first task process is updated to be a working state, and another task process needs to be determined as a second task process. The task process in the idle state may be first determined as a candidate process from all task processes except the first task process. And determining a second task process from the candidate processes, for example, a second task process can be randomly selected. The second task process waits for a new target task to be executed at any time. If the current time is the starting execution time of the new target task, executing the new target task by adopting the second task process, and determining a third task process from all task processes to execute the next target task. That is, each time a target task is executed, a task process is determined, and the next target task is waited for execution at any time.
The method has the advantages that when the time reaches the starting execution time of the target task, the preset task process can be directly adopted to execute, the task process does not need to be determined at present, and the time delay of task processing is reduced. And wake up another task process at random and wait, carry out the next goal task, guarantee each goal task can be processed in time, raise the efficiency that the task processes.
In this embodiment, if it is determined that the current time is the start execution time of the target task, executing the target task by using a preset first task process includes: if the current time is determined to be the starting execution time of the target task, searching the target task from a task database; if the target task in the task database is not marked with a preset identification, executing the target task by adopting a preset first task process; wherein the identification is used to indicate that the task was performed.
Specifically, the task database records the processing progress of each task, and when the memory processes one task, the task database can be notified, and a preset identifier is added for the processed task. For example, a second identifier may be added as a preset identifier, where the second identifier may indicate that the task was performed.
After determining that the current time is the starting execution time of the target task, the target task can be searched from the task database, and whether the target task is provided with a preset second identifier is determined. If not, determining that the target task is not processed, and executing the target task by adopting a first task process; if yes, determining that the target task is processed, removing the target task from the memory, determining a new target task, and carrying out time judgment of the new target task again.
The method has the advantages that when the time reaches the execution starting time, the target task is taken out from the root node of the minimum heap binary tree, records in the task database are checked again, whether the task needs to be processed or not is determined, the task is prevented from running again, and the accuracy and the efficiency of task processing are improved.
In this embodiment, the method further includes: determining the number of unprocessed tasks in the memory, if the number of unprocessed tasks in the memory is a preset number threshold, determining the tasks to be removed in the memory according to the sorting result, and removing the tasks to be removed from the memory; determining the starting execution time of the task which is not removed in the memory, determining the maximum value in the starting execution time of the task which is not removed as a critical time point, and stopping writing the task with the starting execution time greater than the critical time point into the memory.
Specifically, a minimum heap binary tree is placed in the memory, and when the number of tasks is sufficiently large, long-term tasks can be removed to prevent memory overflow. For example, subtracting the latter half from the task in order of starting execution time reconstructs the remaining tasks into a minimum heap binary tree. That is, a number threshold may be preset, and the number threshold may be the maximum value of the number of tasks that can be stored in the memory. The number of tasks in the memory is determined in real time or at regular time, and the tasks in the memory are removed after being processed, so that the tasks in the memory are unprocessed tasks. Judging whether the number of unprocessed tasks in the memory is a preset number threshold, if not, continuing to determine the task to be processed from the task database and writing the task into the memory; if yes, determining a task to be removed according to the sorting result obtained in the step S403, and removing the task to be removed from the memory. For example, in the sorting result, the task located at the preset sorting position may be determined as the task to be removed. Or determining the task of the node positioned at the preset layer in the minimum heap binary tree of the memory as the task to be removed. A removal ratio may be preset, for example, the removal ratio is 40%, and then the task that is ranked 40% later may be determined as the task to be removed. The task to be removed is removed after the start execution time of the task, which is not executed temporarily.
And determining the starting execution time of the task which is not removed in the memory, determining the maximum value of the starting execution time, and determining the starting execution time as a critical time point. The starting execution time of the task located at the last bit can be directly determined according to the sorting result as a critical time point. That is, the critical point in time is the start execution time of the last task in the memory. After the task to be removed in the memory is removed, stopping writing the task with the starting execution time longer than the critical time point into the memory.
The task database can receive the task submitted by the staff at any time, and if the starting execution time of the task received by the task database is greater than a critical time point, the task is not written into the memory; if the starting execution time of the task received by the task database is not greater than the critical time point, the task can be written into the memory. And judging the number of the tasks currently existing in the memory and the number threshold value every time a task to be processed is received in the memory, so that the problem that the normal processing of the tasks is affected due to excessive number of the tasks in the memory is avoided. For example, the upper limit of tasks in the memory is set to 50 ten thousand, and the removal rate is 40%. When 50 ten thousand tasks are written into the memory, 40 ten thousand tasks may be executed, and the unprocessed tasks in the memory are determined to be 10 ten thousand, so that the tasks can be written into the memory continuously. In another case, the number of tasks in the memory is up to 50 ten thousand, then the first 30 ten thousand tasks are reserved according to the time sequence of the starting execution time according to the removal proportion, and the later 20 ten thousand tasks are removed. And the starting execution time of the 30 th ten thousand tasks is recorded as a critical time point a. And for the tasks submitted to the task database next, if the starting execution time is greater than the critical time point a, only recording the database, and not adding the database into the memory queue until the current time is a.
The method has the advantages that the number of tasks in the memory is judged, the long-term tasks are removed in time, memory overflow is avoided, data confusion is reduced, and task processing efficiency and accuracy are improved.
In this embodiment, the method further includes: if the current time is determined to be the critical time point, determining to start executing the task with the time longer than the critical time point from the task database, and writing the task into the memory.
Specifically, after determining the critical time point, if the task database receives a task whose start execution time is less than the critical time point, the task may be written into the memory. For tasks that begin execution for times greater than the critical point in time, no more writes are made. If the current time reaches the critical time point, the unprocessed task which is longer than the critical time point can be determined from the task database, and the task can be written into the memory.
The method has the advantages that when the critical time point is reached, the tasks can be normally written into the memory, the sequencing result of the tasks is continuously updated, the steps of the embodiment of the application are repeatedly executed, the task is timely processed, the task scheduling robustness is improved, and the reliability of task processing can be improved through auxiliary records of the database.
The embodiment of the application provides a multi-process task processing method, which can write tasks to be processed into a memory, sort all tasks existing in the memory according to the starting execution time of the tasks, and determine the execution sequence of the tasks in the memory. Each time a task is written to the memory, the ordering result of the task in the memory may change. The target task, i.e. the task to be executed next, is determined from the current ordering result. After the sequencing result is changed each time, the target task may be changed, so that the flexibility of task processing is improved, and the task with the earliest execution time is ensured to be preferentially processed. And if the current time is the starting execution time of the target task, proving that the target task needs to be executed. A first task process is preset, and the target task is executed by the first task process. And determining a second task process from other task processes so as to facilitate the execution of the next target task. By sequencing the tasks, the tasks to be executed can be quickly determined, and the task scheduling efficiency and the task processing precision are improved. By presetting the task process for executing the task, the task can be rapidly processed when the task starts to execute, the task process is not required to be determined, and the task processing efficiency is improved.
Fig. 5 is a block diagram of a multi-process task processing device according to an embodiment of the present application. For ease of illustration, only portions relevant to embodiments of the present disclosure are shown. The device is applied to a terminal, and at least two task processes are configured in the terminal. Referring to fig. 5, the apparatus includes: a task writing module 501, a task ordering module 502, a task determining module 503, and a task executing module 504.
The task writing module 501 is configured to obtain a task to be processed, and write the task to be processed into the memory;
the task ordering module 502 is configured to determine a start execution time of each task in the memory, and order the tasks in the memory according to the start execution time of each task in the memory;
a task determining module 503, configured to determine a target task from the memory according to the sorting result;
the task execution module 504 is configured to execute the target task by using a preset first task process if the current time is determined to be the start execution time of the target task, and determine a second task process from all task processes; the second task process is used for executing the next target task.
Fig. 6 is a block diagram of a multi-process task processing device according to an embodiment of the present application, and, on the basis of the embodiment shown in fig. 5, as shown in fig. 6, a task ordering module 502 includes a time ordering unit 5021 and a binary tree determining unit 5022.
The time sequencing unit 5021 is configured to sequence the starting execution time of each task in the memory according to the time size, so as to obtain the time sequence of each task in the memory;
the binary tree determining unit 5022 is configured to write the tasks in the memory into a pre-constructed minimum heap binary tree based on a preset minimum heap ordering rule according to the time sequence of each task in the memory; wherein one node in the minimum heap binary tree represents a task, and the connection sequence between the nodes is used for representing the ordering of the tasks.
In one example, task writing module 501 includes:
the first determining unit is used for determining the starting execution time of the tasks which are not written into the memory in the task database if at least two tasks which are not written into the memory exist in the preset task database; the task database is used for carrying out persistent storage on the task;
and the second determining unit is used for determining the task to be processed according to the starting execution time of the task which is not written into the memory in the task database.
In one example, the second determining unit is specifically configured to:
determining a time difference between the start execution time of each task which is not written into the memory and the current time;
And comparing the time differences, and determining the task corresponding to the time difference with the minimum value as the task to be processed.
In one example, a minimum heap ordering rule is used to indicate that a task corresponding to a minimum start execution time in the time sequence is determined to be a root node of the minimum heap binary tree; and in the minimum heap binary tree, the start execution time corresponding to the non-leaf node is not more than the start execution time corresponding to the left child node and the right child node of the minimum heap binary tree.
In one example, the task determination module 503 is specifically configured to:
and determining the task corresponding to the root node in the minimum heap binary tree as the target task.
In one example, the first task process is a task process determined in advance from task processes in a plurality of idle states, and the state of the first task process is updated from the idle state to the working state;
the task execution module 504 is specifically configured to:
determining the task process in an idle state from all task processes as a candidate process;
and randomly selecting one task process from the candidate processes to be the second task process.
In one example, the task execution module 504 is specifically configured to:
If the current time is determined to be the starting execution time of the target task, searching the target task from the task database;
if the target task in the task database is not marked with a preset identification, executing the target task by adopting a preset first task process; wherein the identification is used to indicate that the task was performed.
In one example, the apparatus further comprises:
the task removing module is used for determining the number of unprocessed tasks in the memory, if the number of unprocessed tasks in the memory is a preset number threshold, determining the tasks to be removed in the memory according to the sorting result, and removing the tasks to be removed from the memory;
and the time determining module is used for determining the starting execution time of the task which is not removed in the memory, determining the maximum value of the starting execution time of the task which is not removed as a critical time point, and stopping writing the task with the starting execution time which is greater than the critical time point into the memory.
In one example, the apparatus further comprises:
and the time judging module is used for determining that the task with the starting execution time greater than the critical time point is started from the task database and writing the task into the memory if the current time is determined to be the critical time point.
Fig. 7 is a block diagram of an electronic device according to an embodiment of the present application, where, as shown in fig. 7, the electronic device includes: a memory 71, a processor 72; a memory 71; a memory for storing instructions executable by processor 72.
Wherein the processor 72 is configured to perform the method as provided in the above embodiments.
The electronic device further comprises a receiver 73 and a transmitter 74. The receiver 73 is used for receiving instructions and data transmitted from other devices, and the transmitter 74 is used for transmitting instructions and data to external devices.
Fig. 8 is a block diagram of an electronic device, which may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, etc., in accordance with an exemplary embodiment.
Device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interactions between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the device 800. Examples of such data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, and the like. The memory 804 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 806 provides power to the various components of the device 800. The power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the device 800.
The multimedia component 808 includes a screen between the device 800 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and/or a rear camera. The front camera and/or the rear camera may receive external multimedia data when the device 800 is in an operational mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 further includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of the device 800. For example, the sensor assembly 814 may detect an on/off state of the device 800, a relative positioning of the components, such as a display and keypad of the device 800, the sensor assembly 814 may also detect a change in position of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, an orientation or acceleration/deceleration of the device 800, and a change in temperature of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communication between the device 800 and other devices, either wired or wireless. The device 800 may access a wireless network based on a communication standard, such as WiFi,2G or 3G, or a combination thereof. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 804 including instructions executable by processor 820 of device 800 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
A non-transitory computer readable storage medium, which when executed by a processor of a terminal device, causes the terminal device to perform the above-described multi-process task processing method of the terminal device.
The application also discloses a computer program product comprising a computer program which, when executed by a processor, implements a method as described in the present embodiment.
Various implementations of the above-described systems and techniques of the application may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present application may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or electronic device.
In the context of the present application, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, 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.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data electronic device), or that includes a middleware component (e.g., an application electronic device), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and an electronic device. The client and the electronic device are generally remote from each other and typically interact through a communication network. The relationship of client and electronic devices arises by virtue of computer programs running on the respective computers and having a client-electronic device relationship to each other. The electronic equipment can be cloud electronic equipment, also called cloud computing electronic equipment or cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service (Virtual Private Server or VPS for short) are overcome. The electronic device may also be an electronic device of a distributed system or an electronic device that incorporates a blockchain. It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution disclosed in the present application can be achieved, and are not limited herein.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (14)

1. The multi-process task processing method is characterized in that the method is applied to a terminal, and at least two task processes are configured in the terminal; the method comprises the following steps:
acquiring a task to be processed, and writing the task to be processed into a memory;
determining the starting execution time of each task in a memory, and sequencing the tasks in the memory according to the starting execution time of each task in the memory;
determining a target task from the memory according to the sequencing result;
if the current time is determined to be the starting execution time of the target task, executing the target task by adopting a preset first task process, and determining a second task process from all task processes; the second task process is used for executing the next target task.
2. The method of claim 1, wherein acquiring the task to be processed comprises:
if at least two tasks which are not written into the memory exist in a preset task database, determining the starting execution time of the tasks which are not written into the memory in the task database; the task database is used for carrying out persistent storage on the task;
And determining the task to be processed according to the starting execution time of the task which is not written into the memory in the task database.
3. The method of claim 2, wherein determining the task to be processed based on the starting execution time of the task in the task database that is not written to the memory comprises:
determining a time difference between the start execution time of each task which is not written into the memory and the current time;
and comparing the time differences, and determining the task corresponding to the time difference with the minimum value as the task to be processed.
4. The method of claim 1, wherein ordering the tasks in the memory according to the starting execution time of each task in the memory comprises:
sequencing the starting execution time of each task in the memory according to the time size to obtain the time sequence of each task in the memory;
writing the tasks in the memory into a pre-built minimum heap binary tree based on a preset minimum heap ordering rule according to the time sequence of each task in the memory; wherein one node in the minimum heap binary tree represents a task, and the connection sequence between the nodes is used for representing the ordering of the tasks.
5. The method of claim 4, wherein the minimum heap sort rule is used to represent that a task corresponding to a minimum start execution time in the time sequence is determined as a root node of the minimum heap binary tree; and in the minimum heap binary tree, the start execution time corresponding to the non-leaf node is not more than the start execution time corresponding to the left child node and the right child node of the minimum heap binary tree.
6. The method of claim 5, wherein determining the target task from the memory based on the ranking result comprises:
and determining the task corresponding to the root node in the minimum heap binary tree as the target task.
7. The method of claim 1, wherein the first task process is a task process previously determined from a plurality of idle state task processes;
determining a second task process from all task processes, including:
determining the task process in an idle state from all task processes as a candidate process;
and randomly selecting one task process from the candidate processes to be the second task process.
8. The method of claim 1, wherein if it is determined that the current time is a start execution time of the target task, executing the target task with a preset first task process, comprising:
If the current time is determined to be the starting execution time of the target task, searching the target task from the task database;
if the target task in the task database is not marked with a preset identification, executing the target task by adopting a preset first task process; wherein the identification is used to indicate that the task was performed.
9. The method according to any one of claims 1-8, further comprising:
determining the number of unprocessed tasks in the memory, if the number of unprocessed tasks in the memory is a preset number threshold, determining the tasks to be removed in the memory according to the sorting result, and removing the tasks to be removed from the memory;
and determining the starting execution time of the task which is not removed in the memory, determining the maximum value of the starting execution time of the task which is not removed as a critical time point, and stopping writing the task with the starting execution time which is greater than the critical time point into the memory.
10. The method according to claim 9, wherein the method further comprises:
if the current time is determined to be the critical time point, determining to start executing the task with the time longer than the critical time point from the task database, and writing the task into a memory.
11. A multi-process task processing device, wherein the device is applied to a terminal, and at least two task processes are configured in the terminal; the device comprises:
the task writing module is used for acquiring a task to be processed and writing the task to be processed into the memory;
the task ordering module is used for determining the starting execution time of each task in the memory and ordering the tasks in the memory according to the starting execution time of each task in the memory;
the task determining module is used for determining a target task from the memory according to the sequencing result;
the task execution module is used for executing the target task by adopting a preset first task process if the current time is determined to be the starting execution time of the target task, and determining a second task process from all task processes; the second task process is used for executing the next target task.
12. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the multi-process task processing method as recited in claims 1-10.
13. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are for implementing a multi-process task processing method as claimed in any one of claims 1 to 10.
14. A computer program product comprising a computer program which, when executed by a processor, implements the multi-process task processing method of any one of claims 1 to 10.
CN202310694769.7A 2023-06-12 2023-06-12 Multi-process task processing method and device, electronic equipment and storage medium Pending CN116700974A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310694769.7A CN116700974A (en) 2023-06-12 2023-06-12 Multi-process task processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310694769.7A CN116700974A (en) 2023-06-12 2023-06-12 Multi-process task processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116700974A true CN116700974A (en) 2023-09-05

Family

ID=87833577

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310694769.7A Pending CN116700974A (en) 2023-06-12 2023-06-12 Multi-process task processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116700974A (en)

Similar Documents

Publication Publication Date Title
CN106302996B (en) Message display method and device
CN112039929B (en) File editing method and device and electronic equipment
US10489032B1 (en) Rich structured data interchange for copy-paste operations
CN111046040A (en) Method and device for determining index, electronic equipment and storage medium
US11797218B2 (en) Method and device for detecting slow node and computer-readable storage medium
CN116841713A (en) Task scanning method, device, electronic equipment and storage medium
CN115422203A (en) Data management method, device, equipment and medium for block chain distributed system
CN116700974A (en) Multi-process task processing method and device, electronic equipment and storage medium
CN116048757A (en) Task processing method, device, electronic equipment and storage medium
CN115687303A (en) Data information migration method, device, equipment and storage medium
CN112099715B (en) Information processing method and device
CN109426572B (en) Task processing method and device and electronic equipment
CN112134987A (en) Information processing method and device and electronic equipment
CN113360254A (en) Task scheduling method and system
CN110795194A (en) Desktop display control method, device, terminal and storage medium
CN111049981A (en) Message identification method, device, user equipment and computer readable storage medium
CN116361071B (en) Backup file generation method, device, equipment and storage medium
CN112988160B (en) Server compiling method, device, equipment and computer readable storage medium
CN117453435B (en) Cache data reading method, device, equipment and storage medium
CN111241134B (en) Data processing method and device
CN117032920A (en) Batch job priority determining method, device, equipment and storage medium
CN116150386A (en) Enterprise knowledge graph updating method, device, equipment and storage medium
CN117742901A (en) Task scheduling method, device, equipment and medium
CN116708671A (en) Customer service system routing node determining method, equipment and storage medium
CN116302196A (en) Application running method and device based on dependency package, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination