CN110955502A - Task scheduling method and device - Google Patents
Task scheduling method and device Download PDFInfo
- Publication number
- CN110955502A CN110955502A CN201811130422.5A CN201811130422A CN110955502A CN 110955502 A CN110955502 A CN 110955502A CN 201811130422 A CN201811130422 A CN 201811130422A CN 110955502 A CN110955502 A CN 110955502A
- Authority
- CN
- China
- Prior art keywords
- task
- priority
- new
- identifier
- adjustment request
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/48—Indexing scheme relating to G06F9/48
- G06F2209/484—Precedence
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
The invention discloses a task scheduling method and a task scheduling device, relates to the technical field of computers, and mainly aims to adjust the priority of tasks in a queue and improve the flexibility of task scheduling. The main technical scheme of the invention is as follows: adding a task identifier of the task into a global filter according to a priority adjustment request of the task, wherein the global filter is used for recording the task identifier of the task prohibited to be executed; acquiring task data according to the task identifier to generate a new task, wherein the new task has a new task identifier; adding the new task into a task queue corresponding to the priority adjustment request so as to execute the new task; preventing execution of tasks that match the task identification in the global filter. The method and the device are mainly used for adjusting the task priority in the task queue.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a task scheduling method and a task scheduling device.
Background
With the rapid development of computer technology and internet technology, users can easily access the internet and submit tasks to a server on the internet, and the server can provide corresponding services for the users by executing the tasks submitted by the users. For an internet product, it is often used by a large number of users during the same time period. In a task request instruction sent by a user when using an internet product, a server generally submits a task corresponding to the task request instruction to an abstract queue, accumulates the tasks, and then selects a specific task from the queue and triggers execution through some scheduling strategies.
At present, two types of queues are generally used for task scheduling, one type is a high-priority queue, the other type is a common queue, when a task is created, the priority of the task is specified, and then the task is scheduled to the corresponding queue according to the priority of the task. However, the queue processes tasks in a first-in first-out order, and tasks already allocated to the queue cannot be effectively scheduled, so the existing task scheduling processing mechanism cannot effectively schedule such bursty tasks that are already allocated to the queue.
Disclosure of Invention
In view of this, the present invention provides a task scheduling method and device, and mainly aims to adjust the priority of tasks in a queue and improve the flexibility of task scheduling.
In order to achieve the purpose, the invention mainly provides the following technical scheme:
in one aspect, the present invention provides a task scheduling method, including:
adding a task identifier of a task into a global filter according to a priority adjustment request of the task;
acquiring task data according to the task identifier to generate a new task, wherein the new task has a new task identifier;
adding the new task into a task queue corresponding to the priority adjustment request so as to execute the new task;
preventing execution of tasks that match the task identification in the global filter.
Preferably, before the new task is added to the task queue corresponding to the priority adjustment request, the method further includes:
judging whether the number of tasks is greater than a threshold value, wherein the number of tasks is the number of tasks of which the user initiating the priority adjustment request requests to adjust the priority under a preset condition;
if the current task is larger than the threshold value, caching the new task;
and if the priority is smaller than or equal to the threshold, executing the operation of adding the new task into the task queue corresponding to the priority adjustment request.
Preferably, if the threshold is an adjustment number per unit time, the caching the new task includes:
caching the new task in the unit time;
and when the unit time is exceeded, clearing the task quantity, and adding the cached new task into a task queue corresponding to the priority adjustment request.
Preferably, before the task identifier of the task is added to the global filter according to the task priority adjustment request, the method further includes:
and storing the context data of the task into a database according to the created task.
Preferably, acquiring task data according to the task identifier, and generating a new task includes:
extracting context data of the task from the database;
generating a new task using the context data and the priority in the priority adjustment request.
Preferably, the adding the task identifier of the task to the global filter according to the task priority adjustment request includes:
adding the task identifier of the task and the priority before adjustment into a global filter according to the priority adjustment request;
the preventing execution of the task matching the task identification in the global filter comprises:
and before executing the task, matching the task identifier and the priority of the task by using a global filter, and preventing the successfully matched task from being continuously executed.
In another aspect, the present invention further provides a task scheduling apparatus, including:
the task identifier adding unit is used for adding the task identifier of the task into a global filter according to the priority adjustment request of the task, and the global filter is used for recording the task identifier of the task which is forbidden to be executed;
the task generation unit is used for acquiring task data according to the task identifier and generating a new task, and the new task has a new task identifier;
a task queue adding unit, configured to add the new task generated by the task generating unit to a task queue corresponding to the priority adjustment request, so as to execute the new task;
and the task filtering unit is used for preventing the execution of the task matched with the task identifier added in the global filter by the task identifier adding unit.
Preferably, the apparatus further comprises:
a judging unit, configured to judge whether a task number is greater than a threshold before the task queue adding unit adds the new task to the task queue corresponding to the priority adjustment request, where the task number is a task number of a user initiating the priority adjustment request requesting to adjust a priority under a preset condition;
the task caching unit is used for caching the new task when the judgment unit determines that the value is larger than a threshold value;
the task queue adding unit is further configured to, when the determination unit determines that the priority is smaller than or equal to a threshold, execute the operation of adding the new task to the task queue corresponding to the priority adjustment request.
Preferably, if the threshold is the adjustment amount in a unit time, the task caching unit is further configured to cache the new task in the unit time;
and the task queue adding unit is further used for clearing the number of the tasks when the unit time is exceeded, and adding the new tasks cached by the task caching unit into the task queue corresponding to the priority adjustment request.
Preferably, the apparatus further comprises:
and the data storage unit is used for storing the context data of the task into a database according to the created task before the task identifier adding unit adjusts the request according to the priority of the task and adds the task identifier of the task into the global filter.
Preferably, the task generating unit includes:
the data extraction module is used for extracting context data of the task from the database;
and the generating module is used for generating a new task by using the context data and the priority in the priority adjusting request.
Preferably, the task identifier adding unit is further configured to add the task identifier of the task and the priority before adjustment to the global filter according to the priority adjustment request;
and the task filtering unit is also used for matching the task identifier and the priority of the task by using the global filter before executing the task, and preventing the successfully matched task from being continuously executed.
In order to achieve the above object, according to another aspect of the present invention, there is provided a storage medium including a stored program, wherein when the program runs, a device on which the storage medium is located is controlled to execute the task scheduling method.
In order to achieve the above object, according to another aspect of the present invention, there is provided a processor for executing a program, wherein the program executes to perform the task scheduling method described above.
According to the task scheduling method and device provided by the invention, mainly aiming at tasks which are added into a task queue, when the priorities of the tasks are required to be adjusted, the tasks in the task queue can not be dynamically adjusted in real time because the tasks need to follow the first-in first-out processing principle, therefore, the invention newly generates a task according to the requirements of the task priorities and schedules a new task into the task queue with the corresponding priority, and meanwhile, for the original task of the assigned task queue, the invention adds the task identifier of the original task into a global filter and judges whether to execute the task by using the global filter when executing the task, thereby realizing the purpose of executing the scheduled new task and forbidding the original task to be executed. The problem that the task priority in the task queue cannot be dynamically adjusted is solved, and the flexibility of task scheduling is improved.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating a task scheduling method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another task scheduling method proposed by the embodiment of the present invention;
fig. 3 is a block diagram illustrating a task scheduling apparatus according to an embodiment of the present invention;
fig. 4 is a block diagram showing another task scheduling apparatus according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
An embodiment of the present invention provides a method for task scheduling, and as shown in fig. 1, the method implements real-time dynamic scheduling of task priorities when there is a need for priority adjustment for tasks in a task queue. The method comprises the following specific steps:
101. and adding the task identifier of the task into the global filter according to the task priority adjustment request.
In this embodiment, the global filter is used to filter a task to be executed extracted from the task queue, that is, a task identifier of a task prohibited from being executed is recorded in the global filter. In particular, the global filter identifies tasks by task identification, which typically uses a task ID. In the step, the task identifier of the task adjusted in the priority adjustment request is acquired and added into the global filter, so that the same task is prevented from being executed for multiple times and processing resources are prevented from being wasted.
In addition, when executing the step, the task corresponding to the priority adjustment request may also be queried, and whether the task is in the current queue is determined, if so, the subsequent step is executed according to the priority adjustment request, and if not, prompt information needs to be fed back to the user. Here, there may be two cases that the task does not exist, one is that the task is not created yet, and at this time, the user may be prompted whether to create the task; the other is that the task has been executed, at which point the user is prompted whether to re-execute the task.
It should be noted that, in this embodiment, the number of tasks included in the request is not limited for the priority adjustment request, that is, one user may adjust the priority of only one task in one priority adjustment request, or may adjust the priorities of multiple tasks at the same time.
102. And acquiring task data according to the task identifier to generate a new task.
The task identifier in this step is the task identifier of the corresponding task extracted according to the priority adjustment request. In this embodiment, the task data refers to data content required for executing the task, and the data content is backed up and stored, and when the priority of the task needs to be adjusted, the backed-up data content is extracted according to the task identifier, and a new task is regenerated. That is, this step is to recreate a new task using the data content required for task execution, and the priority of the new task may be set to the priority specified in the priority adjustment request.
Compared with the original task which is added into the queue, the new task has the same content to be executed, but the task identification of the new task is different from that of the original task, namely the new task has the new task identification.
103. And adding the new task into the task queue corresponding to the priority adjustment request so as to execute the new task.
By executing the step, the new task is added into the corresponding task queue as required, and because the new task and the original task before adjustment execute the same content, the purpose of adjusting the priority can be achieved only by preventing the execution of the original task while adding the new task into the task queue.
In the embodiment of the invention, the adjustment of the priority is divided into two types, wherein one type is to improve the priority, and the other type is to reduce the priority. For the priority improvement, the new task added to the high-priority task queue is generally executed earlier than the original task, and at this time, although the purpose of the priority adjustment request is achieved, the executed task can be filtered out through the operation of step 104, so that the task processing efficiency of all queues is improved. For the lower priority, the original task in the high priority task queue still exists, so the execution step 104 will ensure the user purpose to be achieved, and achieve the effect of the priority adjustment request to adjust the task execution sequence.
104. Tasks that match the task identification in the global filter are prevented from being executed.
When a task is executed, namely after a task to be executed is extracted from a task queue, the task is input into a global filter for filtering, a task identifier of the task is matched with a task identifier stored in the global filter, when the matching is successful, the task is forbidden to be executed, the next task to be executed is extracted from the task queue, and when the matching is failed, the task is normally executed.
It can be seen from the foregoing implementation manner that the task scheduling method adopted in the embodiment of the present invention dynamically adjusts the priority of the task that has been added to the task queue, thereby achieving the purpose of adjusting the task in the task queues with different priorities. Therefore, in the embodiment of the invention, a new task is regenerated according to the priority adjustment request, the new task is added into the designated priority, meanwhile, the task identifier of the adjusted task is added into the global filter, and the adjusted task is filtered by using the global filter when the task is executed, so that the same task is prevented from being executed for many times, and the task processing efficiency is improved. By the adjusting mode of the embodiment of the invention, the priority of the tasks in the queue can be adjusted according to the user requirement without being influenced by the first-in first-out principle of the task queue, the task queue where the tasks are located is changed, and the dynamic adjustment of the task priority is realized.
In order to describe the task scheduling method provided by the present invention in more detail, and in particular, to solve the problem how to prevent task blocking caused by excessive priority adjustment of a task queue when a task in the task queue is blocked, an embodiment of the present invention further provides a task scheduling method with reference to a specific example, as shown in fig. 2, the method includes the following specific steps:
201. and storing the context data of the task into a database according to the created task.
The context data of the task is data content required for executing the task, and is core content constituting the task. The method comprises the steps of extracting context data of a task and storing the context data into a database while the task is created, so that the corresponding context data can be extracted from the database when the task needs to be prioritized after being distributed to a task queue, and a new task identical to the task is generated.
Based on this step, when adding a task to a task queue, another embodiment of the present invention may add a task copy or a task identifier of the task to a corresponding task queue according to the priority of the task, and when executing the task, obtain corresponding context data from a database according to the task copy or the task identifier extracted from the task queue, and generate an executable task.
202. And adding the task identifier of the task into the global filter according to the priority adjustment request.
In this embodiment, when a new task is generated, a task identifier corresponding to the new task is different from an original task. Therefore, according to the task identification recorded by the global filter, which tasks need to be prohibited from being executed can be distinguished.
Further, in another possible embodiment of the present invention, if the task identifier of the generated new task is the same as the task identifier of the original task, the task identifier of the task and the priority before the adjustment need to be added to the global filter according to the priority adjustment request. During filtering, the task is matched with the priority together through the task identifier, so that the recognition accuracy of the task before adjustment is improved.
203. And extracting context data of the task from the database to generate a new task.
Specifically, context data of the task is extracted from the database according to a task identifier of the corresponding task in the priority adjustment request, and a new task is generated by combining the extracted context data and the priority specified in the priority adjustment request.
204. And judging whether the number of tasks which request a user to initiate priority adjustment and correspond to the new task is greater than a threshold value.
Generally, tasks in a high-priority task queue are processed preferentially, but if too many tasks are in the task queue, the tasks are blocked, and therefore the processing efficiency of the tasks is affected. Therefore, in the embodiment of the present invention, before the task is allocated to the task queue according to the corresponding priority, the current task number in the corresponding task queue is determined, and the task is added to the task queue when the allocation condition is reached. The step is to perform optimization processing before distributing the task queues for the new tasks generated by the priority adjustment request, specifically to judge the task adjustment number initiated by the requesting user of the new tasks, namely to limit the total processing amount of the new tasks by limiting the number of the task priorities adjusted by the user, and when the number is greater than a threshold value, to add the exceeded new tasks into the corresponding task queues and buffer the tasks in the preset storage; and when the number is smaller than the threshold, the following step 205 is executed.
Further, in a possible embodiment of the present invention, the threshold is the number of task adjustments per unit time, for example, the threshold is 2000/10min, that is, the user can adjust the priority of 2000 new tasks within 10 minutes, and if the priority is exceeded, from 2001 new tasks, the new tasks will be buffered to the specified position until the next timing period is exceeded, that is, the next timing period is entered. At this time, the task adjustment number is cleared, the new tasks cached by the user are extracted from the designated position and added into the corresponding task queue, meanwhile, the total number of the user adjustment tasks in the timing period is accumulated again, and the new tasks exceeding 2000 are cached again.
205. And adding the new task into a task queue corresponding to the priority adjustment request.
206. And matching the task identification and the priority of the task by using the global filter, and preventing the successfully matched task from being continuously executed.
Before executing the task, inputting the task to be executed extracted from the task queue into a global filter, matching the task to be executed through a task identifier and a priority stored in the global filter, preventing the task from being continuously executed if the matching is successful, and continuously executing the task if the matching is failed, so that the task before the execution of the priority adjustment can be effectively prevented, and the task is ensured to be sequentially executed according to the priority required by a user.
It should be noted that, the embodiment of the present invention does not limit the adjustment of the priority level to increasing the task priority level or decreasing the task priority level. For the task with the higher priority, the adjusted new task is generally executed preferentially, and the global filter filters the task before adjustment which is executed later, so that the repeated execution of the same task is prevented. For the task with the lowered priority, the task before adjustment is generally extracted from the task queue, and at the moment, the global filter filters the task to ensure that the task is executed according to the requirement adjusted by the user.
In order to achieve the above object, according to another aspect of the present invention, a storage medium is further provided, where the storage medium includes a stored program, and when the program runs, a device on which the storage medium is located is controlled to execute the task scheduling method described above.
In addition, in order to achieve the above object, according to another aspect of the present invention, an embodiment of the present invention further provides a processor, where the processor is configured to execute a program, where the program executes the task scheduling method described above.
Further, as an implementation of the foregoing method, an embodiment of the present invention provides a task scheduling apparatus, where the apparatus embodiment corresponds to the foregoing method embodiment, and for convenience of reading, details in the foregoing method embodiment are not repeated in this apparatus embodiment one by one, but it should be clear that the apparatus in this embodiment can correspondingly implement all the contents in the foregoing method embodiment. The device is used for adjusting the priority of the task in the task queue and realizing the real-time dynamic adjustment of the task priority, and specifically, as shown in fig. 3, the device comprises:
a task identifier adding unit 31, configured to add a task identifier of a task to a global filter according to a priority adjustment request of the task, where the global filter is used to record a task identifier of a task prohibited from being executed;
the task generating unit 32 is configured to obtain task data according to the task identifier, and generate a new task, where the new task has a new task identifier;
a task queue adding unit 33, configured to add the new task generated by the task generating unit 32 to the task queue corresponding to the priority adjustment request;
a task filtering unit 34, configured to prevent the task matching the task identifier added to the global filter by the task identifier adding unit 31 from being executed.
Further, as shown in fig. 4, the apparatus further includes:
a determining unit 35, configured to determine whether a task number is greater than a threshold before the task queue adding unit 33 adds the new task to the task queue corresponding to the priority adjustment request, where the task number is a task number of a user initiating the priority adjustment request requesting to adjust a priority under a preset condition;
a task caching unit 36, configured to cache the new task when the determining unit 35 determines that the value is greater than the threshold value;
the task queue adding unit 33 is further configured to, when the determining unit 35 determines that the priority is smaller than or equal to a threshold, perform the operation of adding the new task to the task queue corresponding to the priority adjustment request.
Further, as shown in fig. 4, if the threshold is the adjustment amount in a unit time, the task caching unit 36 is further configured to cache the new task in the unit time;
the task queue adding unit 33 is further configured to, when the unit time is exceeded, zero-clear the number of tasks requesting the user to adjust the task priority, and add the new task cached by the task caching unit 36 to the task queue corresponding to the priority adjustment request.
Further, as shown in fig. 4, the apparatus further includes:
and a data storage unit 37, configured to store context data of the task into a database according to the created task before the task identifier adding unit 31 adds the task identifier of the task to the global filter according to the task priority adjustment request.
Further, as shown in fig. 4, the task generating unit 32 includes:
a data extraction module 321, configured to extract context data of the task from the database;
a generating module 322, configured to generate a new task by using the context data extracted by the data extracting module 321 and the priority in the priority adjustment request.
Further, the task identifier adding unit 31 is further configured to add the task identifier of the task and the priority before adjustment to a global filter according to the priority adjustment request;
the task filtering unit 34 is further configured to, before executing a task, match the task identifier and the priority of the task with the global filter, and prevent the task that is successfully matched from continuing to execute.
In summary, the task scheduling method and apparatus adopted in the embodiments of the present invention perform priority adjustment on the tasks in the task queue, and schedule the tasks to the task queue required by the user, and the embodiments of the present invention save the context data of the tasks in advance, when the priority needs to be adjusted, a new task is created by using the stored context data and is added to the corresponding task queue, and the execution of the tasks before adjustment is stopped through the global filter, the tasks are ensured to be executed in order according to the requirements of users, meanwhile, before adding the new task into the corresponding task queue, the embodiment of the invention judges whether the user who initiates the request for adjusting the priority has the right to execute the new task to be added into the task queue, therefore, the situation that the tasks in the task queue are blocked due to the fact that the number of the new tasks is too large due to transition adjustment of the user is avoided, and the processing efficiency of the tasks in the task queue is improved.
The task scheduling device comprises a processor and a memory, wherein the task identifier adding unit, the task generating unit, the task queue adding unit, the task filtering unit and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, the priority adjustment of the tasks in the queue is realized by adjusting kernel parameters, and the flexibility of task scheduling is improved.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a storage medium on which a program is stored, the program implementing the task scheduling method when executed by a processor.
The embodiment of the invention provides a processor, which is used for running a program, wherein the task scheduling method is executed when the program runs.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein the processor executes the program and realizes the following steps: adding a task identifier of the task into a global filter according to a priority adjustment request of the task, wherein the global filter is used for recording the task identifier of the task prohibited to be executed; acquiring task data according to the task identifier to generate a new task, wherein the new task has a new task identifier; adding the new task into a task queue corresponding to the priority adjustment request so as to execute the new task; preventing execution of tasks that match the task identification in the global filter.
And the devices herein are not limited to servers, PCs, PADs, handsets, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: adding a task identifier of the task into a global filter according to a priority adjustment request of the task, wherein the global filter is used for recording the task identifier of the task prohibited to be executed; acquiring task data according to the task identifier to generate a new task, wherein the new task has a new task identifier; adding the new task into a task queue corresponding to the priority adjustment request so as to execute the new task; preventing execution of tasks that match the task identification in the global filter.
Further, before adding the new task to the task queue corresponding to the priority adjustment request, the method further includes:
judging whether the number of tasks is greater than a threshold value, wherein the number of tasks is the number of tasks of which the user initiating the priority adjustment request requests to adjust the priority under a preset condition;
if the current task is larger than the threshold value, caching the new task;
and if the priority is smaller than or equal to the threshold, executing the operation of adding the new task into the task queue corresponding to the priority adjustment request.
Further, if the threshold is the adjustment amount per unit time, the caching the new task includes:
caching the new task in the unit time;
and when the unit time is exceeded, clearing the task quantity, and adding the cached new task into a task queue corresponding to the priority adjustment request.
Further, before the task identifier of the task is added to the global filter according to the priority adjustment request of the task, the method further includes:
and storing the context data of the task into a database according to the created task.
Further, acquiring task data according to the task identifier, and generating a new task includes:
extracting context data of the task from the database;
generating a new task using the context data and the priority in the priority adjustment request.
Further, adding the task identifier of the task to the global filter according to the task priority adjustment request includes:
adding the task identifier of the task and the priority before adjustment into a global filter according to the priority adjustment request;
the preventing execution of the task matching the task identification in the global filter comprises:
and before executing the task, matching the task identifier and the priority of the task by using a global filter, and preventing the successfully matched task from being continuously executed.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims (10)
1. A method for task scheduling, the method comprising:
adding a task identifier of the task into a global filter according to a priority adjustment request of the task, wherein the global filter is used for recording the task identifier of the task prohibited to be executed;
acquiring task data according to the task identifier to generate a new task, wherein the new task has a new task identifier;
adding the new task into a task queue corresponding to the priority adjustment request so as to execute the new task;
preventing execution of tasks that match the task identification in the global filter.
2. The method of claim 1, wherein prior to adding the new task to the task queue corresponding to the priority adjustment request, the method further comprises:
judging whether the number of tasks is greater than a threshold value, wherein the number of tasks is the number of tasks of which the user initiating the priority adjustment request requests to adjust the priority under a preset condition;
if the current task is larger than the threshold value, caching the new task;
and if the priority is smaller than or equal to the threshold, executing the operation of adding the new task into the task queue corresponding to the priority adjustment request.
3. The method of claim 2, wherein the threshold is an adjustment amount per unit time, and the caching the new task comprises:
caching the new task in the unit time;
and when the unit time is exceeded, clearing the task quantity, and adding the cached new task into a task queue corresponding to the priority adjustment request.
4. The method of claim 1, wherein prior to adding a task identification for a task to a global filter based on a priority adjustment request for the task, the method further comprises:
and storing the context data of the task into a database according to the created task.
5. The method of claim 4, wherein obtaining task data based on the task identifier, and generating a new task comprises:
extracting context data of the task from the database;
generating a new task using the context data and the priority in the priority adjustment request.
6. The method of any of claims 1-5, wherein adding a task identification for a task to a global filter based on a priority adjustment request for the task comprises:
adding the task identifier of the task and the priority before adjustment into a global filter according to the priority adjustment request;
the preventing execution of the task matching the task identification in the global filter comprises:
and before executing the task, matching the task identifier and the priority of the task by using a global filter, and preventing the successfully matched task from being continuously executed.
7. A task scheduling apparatus, characterized in that the apparatus comprises:
the task identifier adding unit is used for adding the task identifier of the task into a global filter according to the priority adjustment request of the task, and the global filter is used for recording the task identifier of the task which is forbidden to be executed;
the task generation unit is used for acquiring task data according to the task identifier and generating a new task, and the new task has a new task identifier;
a task queue adding unit, configured to add the new task generated by the task generating unit to a task queue corresponding to the priority adjustment request, so as to execute the new task;
and the task filtering unit is used for preventing the execution of the task matched with the task identifier added in the global filter by the task identifier adding unit.
8. The apparatus of claim 7, further comprising:
a judging unit, configured to judge whether a task number is greater than a threshold before the task queue adding unit adds the new task to the task queue corresponding to the priority adjustment request, where the task number is a task number of a user initiating the priority adjustment request requesting to adjust a priority under a preset condition;
the task caching unit is used for caching the new task when the judgment unit determines that the value is larger than a threshold value;
the task queue adding unit is further configured to, when the determination unit determines that the priority is smaller than or equal to a threshold, execute the operation of adding the new task to the task queue corresponding to the priority adjustment request.
9. A storage medium, characterized in that the storage medium comprises a stored program, wherein when the program runs, a device on which the storage medium is located is controlled to execute the task scheduling method according to any one of claims 1 to 6.
10. A processor, characterized in that the processor is configured to run a program, wherein the program when running performs the task scheduling method of any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811130422.5A CN110955502B (en) | 2018-09-27 | 2018-09-27 | Task scheduling method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811130422.5A CN110955502B (en) | 2018-09-27 | 2018-09-27 | Task scheduling method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110955502A true CN110955502A (en) | 2020-04-03 |
CN110955502B CN110955502B (en) | 2022-07-05 |
Family
ID=69967843
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811130422.5A Active CN110955502B (en) | 2018-09-27 | 2018-09-27 | Task scheduling method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110955502B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111797110A (en) * | 2020-06-23 | 2020-10-20 | 北京金堤科技有限公司 | Method and device for generating scheduling model, computer equipment and storage medium |
CN114090208A (en) * | 2021-11-22 | 2022-02-25 | 南方电网电力科技股份有限公司 | Task scheduling method and device for electric energy meter operating system |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101807159A (en) * | 2010-03-18 | 2010-08-18 | 西北工业大学 | Self-adapting task scheduling method |
CN103870327A (en) * | 2012-12-18 | 2014-06-18 | 华为技术有限公司 | Real-time multitask scheduling method and device |
US8826280B1 (en) * | 2006-03-23 | 2014-09-02 | Emc Corporation | Processing raw information for performing real-time monitoring of task queues |
US20150150016A1 (en) * | 2013-11-25 | 2015-05-28 | Xerox Corporation | Method and apparatus for a user-driven priority based job scheduling in a data processing platform |
CN105893263A (en) * | 2016-04-25 | 2016-08-24 | 北京智能综电信息技术有限责任公司 | Dispatching method for test tasks |
US20170139745A1 (en) * | 2015-11-18 | 2017-05-18 | Sap Se | Scaling priority queue for task scheduling |
WO2017166630A1 (en) * | 2016-03-31 | 2017-10-05 | 乐视控股(北京)有限公司 | Task priority correctingon method and device |
-
2018
- 2018-09-27 CN CN201811130422.5A patent/CN110955502B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8826280B1 (en) * | 2006-03-23 | 2014-09-02 | Emc Corporation | Processing raw information for performing real-time monitoring of task queues |
CN101807159A (en) * | 2010-03-18 | 2010-08-18 | 西北工业大学 | Self-adapting task scheduling method |
CN103870327A (en) * | 2012-12-18 | 2014-06-18 | 华为技术有限公司 | Real-time multitask scheduling method and device |
US20150150016A1 (en) * | 2013-11-25 | 2015-05-28 | Xerox Corporation | Method and apparatus for a user-driven priority based job scheduling in a data processing platform |
US20170139745A1 (en) * | 2015-11-18 | 2017-05-18 | Sap Se | Scaling priority queue for task scheduling |
WO2017166630A1 (en) * | 2016-03-31 | 2017-10-05 | 乐视控股(北京)有限公司 | Task priority correctingon method and device |
CN105893263A (en) * | 2016-04-25 | 2016-08-24 | 北京智能综电信息技术有限责任公司 | Dispatching method for test tasks |
Non-Patent Citations (4)
Title |
---|
YI TANG 等: "A Hardware Scheduler Based on Task Queues for FPGA-Based Embedded Real-Time Systems", 《IEEE TRANSACTIONS ON COMPUTERS》, vol. 64, no. 5, 1 May 2015 (2015-05-01), pages 1254 - 1267, XP011577363, DOI: 10.1109/TC.2014.2315637 * |
冯径 等: "一种多策略要素的数据访问调度算法", 《东南大学学报(自然科学版)》, vol. 42, no. 5, 20 September 2012 (2012-09-20), pages 820 - 824 * |
李薛剑 等: "一种基于动态优先级的RQ作业调度算法", 《小型微型计算机***》, vol. 38, no. 1, 15 January 2017 (2017-01-15), pages 124 - 128 * |
杨宝星 等: "一种面向BSP***的多等待队列作业调度算法", 《计算机与数字工程》, vol. 42, no. 9, 20 September 2014 (2014-09-20), pages 1547 - 1552 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111797110A (en) * | 2020-06-23 | 2020-10-20 | 北京金堤科技有限公司 | Method and device for generating scheduling model, computer equipment and storage medium |
CN111797110B (en) * | 2020-06-23 | 2024-01-26 | 北京金堤科技有限公司 | Method, device, computer equipment and storage medium for generating scheduling model |
CN114090208A (en) * | 2021-11-22 | 2022-02-25 | 南方电网电力科技股份有限公司 | Task scheduling method and device for electric energy meter operating system |
CN114090208B (en) * | 2021-11-22 | 2023-10-13 | 南方电网电力科技股份有限公司 | Task scheduling method and device for electric energy meter operating system |
Also Published As
Publication number | Publication date |
---|---|
CN110955502B (en) | 2022-07-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106933534B (en) | Data synchronization method and device | |
US8818989B2 (en) | Memory usage query governor | |
CN109669776B (en) | Detection task processing method, device and system | |
US20160019119A1 (en) | Prioritizing backup of files | |
US8583608B2 (en) | Maximum allowable runtime query governor | |
CN110955502B (en) | Task scheduling method and device | |
US10884667B2 (en) | Storage controller and IO request processing method | |
CN109739627B (en) | Task scheduling method, electronic device and medium | |
CN107402863B (en) | Method and equipment for processing logs of service system through log system | |
CN109343862B (en) | Scheduling method and device of resource data of application | |
US11765099B2 (en) | Resource allocation using distributed segment processing credits | |
CN109726007B (en) | Container arrangement quota management method and device and container arrangement system | |
CN111708812A (en) | Distributed data processing method | |
CN112416534A (en) | Agent-based task management method and device | |
CN110968406B (en) | Method, device, storage medium and processor for processing task | |
CN108270810B (en) | Media data access method and device | |
CN111338803A (en) | Thread processing method and device | |
CN109582460B (en) | Redis memory data elimination method and device | |
CN114374652B (en) | Data transmission speed limiting method and device between thermomagnetic storage and blue light storage | |
US20170168867A1 (en) | Information processing system and control method | |
CN114201284A (en) | Timed task management method and system | |
CN111176848B (en) | Cluster task processing method, device, equipment and storage medium | |
CN108920722B (en) | Parameter configuration method and device and computer storage medium | |
CN108270744B (en) | Media data access method and device | |
CN110618863A (en) | Operation scheduling method based on Raft algorithm |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |