CN116185587A - Task scheduling method, device, equipment and medium - Google Patents
Task scheduling method, device, equipment and medium Download PDFInfo
- Publication number
- CN116185587A CN116185587A CN202310084999.1A CN202310084999A CN116185587A CN 116185587 A CN116185587 A CN 116185587A CN 202310084999 A CN202310084999 A CN 202310084999A CN 116185587 A CN116185587 A CN 116185587A
- Authority
- CN
- China
- Prior art keywords
- task
- target
- current
- context
- executed
- 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
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
- 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/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy 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)
- Bus Control (AREA)
Abstract
The application discloses a task scheduling method, a device, equipment and a medium, and relates to the technical field of computers, wherein the method comprises the following steps: monitoring the current task execution progress; if the execution progress meets a preset interrupt condition, judging that the current task is a current interrupt task, and storing the context of the current interrupt task to a target storage area by utilizing a register bank function; and screening out a target task to be executed, and if the screened target task to be executed is the current interrupt task, recovering the context of the current interrupt task from the target storage area so as to execute the current interrupt task. Through the scheme, automation of saving the task context and automation of recovering the task context can be realized by utilizing the register bank function, so that the task scheduling efficiency is improved.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a task scheduling method, device, equipment, and medium
Background
The MCU (Microcontroller Unit, i.e. a single-chip microcomputer) serves as a control core of the ECU (Electronic Control Unit, i.e. an electronic control unit), typically a multi-task system. To ensure real-time performance of each control task, an RTOS (Real Time Operation System, i.e., a real-time operating system) is generally used to take charge of scheduling each task. The core function of the RTOS is to coordinate the operation of each task according to the priority of each task in the required time. When the task is interrupted, a worker is required to save the running data of the current interrupted task, namely the context of the current interrupted task, the target task to be executed after the interruption is determined, a corresponding task control module is required to be determined, and the running data of the target task is recovered from the memory based on the stack pointer so as to complete the task switching. In the existing RTOS, these running data are stored in a stack, and the task needs to be pushed and pulled in an interrupt response function for switching, which requires additional time and greatly reduces the efficiency of task scheduling.
In summary, how to improve the task scheduling efficiency is a problem to be solved at present.
Disclosure of Invention
In view of the above, the present invention aims to provide a task scheduling method, device, equipment and medium, which can improve the task scheduling efficiency. The specific scheme is as follows:
in a first aspect, the present application discloses a task scheduling method, including:
monitoring the current task execution progress;
if the execution progress meets a preset interrupt condition, judging that the current task is a current interrupt task, and storing the context of the current interrupt task to a target storage area by utilizing a register bank function;
and screening out a target task to be executed, and if the screened target task to be executed is the current interrupt task, recovering the context of the current interrupt task from the target storage area so as to execute the current interrupt task.
Optionally, the saving the context of the current interrupt task to the target storage area by using a register bank function includes:
and saving the context of the current interrupt task to a target storage area by utilizing a register bank function of a target register which is configured in advance in an initializing way.
Optionally, before the monitoring of the current task execution progress, the method further includes:
determining a target register from all the register registers;
and determining an initial storage area corresponding to the target register so as to finish the initialization configuration of the target register.
Optionally, the saving the context of the current interrupt task to the target storage area by using a register bank function includes:
determining current stored address information, and storing the context of the current interrupt task to a target storage area corresponding to the current stored address information by utilizing a register bank function;
and determining next storage address information based on the current storage address information, so that when a next interrupt task exists, a register bank function is utilized to store the context of the next interrupt task to a target storage area corresponding to the next storage address information.
Optionally, the screening the task to be executed from the target includes:
and acquiring the priorities of all the tasks to be executed, and screening out target tasks to be executed based on the priorities.
Optionally, the screening the target task to be executed based on the priority includes:
sorting all the tasks to be executed based on the priority, so as to obtain the sorted tasks to be executed;
and screening the target task to be executed with the highest priority from the ordered tasks to be executed.
Optionally, the restoring the context of the current interrupt task from the target storage area includes:
and executing a RESBANK instruction so as to restore the context of the current interrupt task from the target storage area.
In a second aspect, the present application discloses a task scheduling device, including:
the task monitoring module is used for monitoring the current task execution progress;
the context saving module is used for judging that the current task is the current interrupt task if the execution progress meets the preset interrupt condition, and saving the context of the current interrupt task to a target storage area by utilizing a register bank function;
and the task execution module is used for screening a target task to be executed, and if the screened target task to be executed is the current interrupt task, restoring the context of the current interrupt task from the target storage area so as to execute the current interrupt task.
In a third aspect, the present application discloses an electronic device comprising:
a memory for storing a computer program;
and a processor for executing the computer program to implement the steps of the task scheduling method disclosed above.
In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements the steps of the task scheduling method disclosed previously.
The method comprises the steps of monitoring the current task execution progress; if the execution progress meets a preset interrupt condition, judging that the current task is a current interrupt task, and storing the context of the current interrupt task to a target storage area by utilizing a register bank function; and screening out a target task to be executed, and if the screened target task to be executed is the current interrupt task, recovering the context of the current interrupt task from the target storage area so as to execute the current interrupt task. Therefore, when the current task execution progress meets the preset interrupt condition, namely when an interrupt occurs, the context of the current interrupt task can be automatically saved to the target storage area by utilizing the register bank function, after the target task to be executed is screened out, the context of the current interrupt task is automatically restored, and the current interrupt task is executed, namely, the context saving and interrupt parallel processing are realized, the task context code saving work is not needed to be manually written by a worker, the code writing time is reduced, and the task scheduling efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings may be obtained according to the provided drawings without inventive effort to a person skilled in the art.
FIG. 1 is a flow chart of a task scheduling method disclosed in the present application;
FIG. 2 is a schematic illustration of a specific task execution disclosed herein;
FIG. 3 is a flowchart of a specific task scheduling method disclosed in the present application;
FIG. 4 is a schematic illustration of a specific initial configuration disclosed herein;
FIG. 5 is a schematic diagram of a specific context preservation disclosed herein;
FIG. 6 is a schematic diagram of a task scheduler disclosed in the present application;
fig. 7 is a block diagram of an electronic device disclosed in the present application.
Detailed Description
The following description of the technical solutions in the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The MCU, as the control core of the ECU, is typically a multi-tasking system. In order to ensure real-time performance of each control task, an RTOS is generally used to take charge of scheduling each task. The core function of the RTOS is to coordinate the operation of each task according to the priority of each task in the required time. When a task is interrupted, a worker is required to manually save the running data of the current interrupted task, namely the context of the current interrupted task, a target task to be executed after the interruption occurs is determined, a corresponding task control module is required to be manually realized, and the running data of the target task is recovered from a memory based on a stack pointer so as to complete task switching. In the existing RTOS, these running data are stored in a stack, and the task needs to be pushed and pulled in an interrupt response function for switching, which requires additional time and greatly reduces the efficiency of task scheduling.
Therefore, the task scheduling scheme is correspondingly provided, and the task scheduling efficiency can be improved.
Referring to fig. 1, an embodiment of the present application discloses a task scheduling method, which includes:
step S11: and monitoring the current task execution progress.
The MCU is used as a control core of the ECU, and is a multi-task system generally, wherein the MCU appropriately reduces the frequency and the specification of a central processing unit (Central Process Unit, namely a CPU), integrates peripheral interfaces such as a memory (memory), a counter (Timer), A/D conversion and the like on a single chip to form a chip-level computer, and performs different combination control for different application occasions; the ECU is also called a driving computer, a vehicle-mounted computer and the like, and the ECU is used for controlling the driving state of the automobile and realizing various functions of the automobile. The method mainly uses various sensors and buses for data acquisition and exchange to judge the state of the vehicle and the intention of a driver and controls the automobile through an actuator.
In this embodiment, the execution progress of the current task is monitored in real time, so that when the current task is interrupted, the task can be switched in time subsequently.
Step S12: if the execution progress meets the preset interrupt condition, judging that the current task is the current interrupt task, and storing the context of the current interrupt task to a target storage area by utilizing a register bank function.
If an interrupt occurs, that is, the current task is the current interrupt task, the target register needs to be initialized and configured in advance, and it can be understood that only one initialization and configuration is needed, and then the manual configuration is not needed, the context of the current interrupt task can be automatically saved to the target storage area by using the register bank function, so that the operation complexity of staff is reduced, and the writing time of the staff is shortened.
Step S13: and screening out a target task to be executed, and if the screened target task to be executed is the current interrupt task, recovering the context of the current interrupt task from the target storage area so as to execute the current interrupt task.
In this embodiment, the screening the task to be executed of the target includes: and acquiring the priorities of all the tasks to be executed, and screening out target tasks to be executed based on the priorities.
In this embodiment, the screening the target task to be executed based on the priority includes: sorting all the tasks to be executed based on the priority, so as to obtain the sorted tasks to be executed; and screening the target task to be executed with the highest priority from the ordered tasks to be executed. For example, in a specific task execution schematic diagram shown in fig. 2, all tasks to be executed are ordered based on priority, and the task with the highest priority is screened out and determined as the target task to be executed.
The method comprises the steps of monitoring the current task execution progress; if the execution progress meets a preset interrupt condition, judging that the current task is a current interrupt task, and storing the context of the current interrupt task to a target storage area by utilizing a register bank function; and screening out a target task to be executed, and if the screened target task to be executed is the current interrupt task, recovering the context of the current interrupt task from the target storage area so as to execute the current interrupt task. Therefore, when the current task execution progress meets the preset interrupt condition, namely when an interrupt occurs, the context of the current interrupt task can be automatically saved to the target storage area by utilizing the register bank function, after the target task to be executed is screened out, the context of the current interrupt task is automatically restored, and the current interrupt task is executed, namely, the context saving and interrupt parallel processing are realized, the task context code saving work is not needed to be manually written by a worker, the code writing time is reduced, and the task scheduling efficiency is improved.
Referring to fig. 3, an embodiment of the present application discloses a specific task scheduling method, and compared with the previous embodiment, the present embodiment further describes and optimizes a technical solution. The method specifically comprises the following steps:
step S21: and monitoring the current task execution progress.
In this embodiment, before the monitoring of the current task execution progress, the method further includes: determining a target register from all the register registers; and determining an initial storage area corresponding to the target register so as to finish the initialization configuration of the target register. For example, a specific initial configuration diagram shown in fig. 4, configuration ostm and syscall use the register bank function to pre-write the default values of the context in the region pointed to by RBIP, set rbnr.bn to 0, rbcr0.md to 1, rbcr0.be to 0 x 4200, rbcr0.nc to 0 x 4200, intcfg.ulnr to 32.
Step S22: if the execution progress meets the preset interrupt condition, judging that the current task is the current interrupt task, and storing the context of the current interrupt task to a target storage area by utilizing a register bank function of a target register which is configured in advance in an initializing mode.
In this embodiment, the current saved address information is determined, and the context of the current interrupt task is saved to a target storage area corresponding to the current saved address information by using a register bank function; and determining next storage address information based on the current storage address information, so that when a next interrupt task exists, a register bank function is utilized to store the context of the next interrupt task to a target storage area corresponding to the next storage address information. For example, in a specific context save schematic diagram shown in fig. 5, if the target storage area is pointed to as 1, that is, the current save address information is 1, the register bank function is used to save the context of the current interrupt task to the target storage area, and the next save address information is updated to be 2.
The register bank functions of the RH850G4MH kernel include: the area where the context is saved is not a dedicated memory, but a normal memory area, and is specified by the RBIP register; the rbcr0.md bit specifies the context to be saved from the two groups; up to 64 levels of interrupts are supported, and the rbnr.bn bit indicates the number of interrupts accepted.
Step S23: and screening out a target task to be executed, and if the screened target task to be executed is the current interrupt task, recovering the context of the current interrupt task from the target storage area so as to execute the current interrupt task.
In this embodiment, the restoring the context of the current interrupt task from the target storage area includes: and executing a RESBANK instruction so as to restore the context of the current interrupt task from the target storage area. The priority of the current pending task is ordered, the task with the highest priority is selected, and the RBNR.BN value is rewritten according to the task id. And then invoking a RESBANK instruction, so that task switching is completed.
Therefore, after the initialization configuration of the target register is finished in advance, the register bank function can be directly utilized in the follow-up process, the context of the interrupt task is automatically saved, and after the target task to be executed is screened out, the context can be automatically recovered, so that the labor cost is reduced, and the working efficiency is improved.
Referring to fig. 6, an embodiment of the present application discloses a task scheduling device, including:
the task monitoring module 11 is used for monitoring the current task execution progress;
the context saving module 12 is configured to determine that the current task is a current interrupt task if the execution progress meets a preset interrupt condition, and save the context of the current interrupt task to a target storage area by using a register bank function;
and the task execution module 13 is configured to screen out a target task to be executed, and if the screened target task to be executed is the current interrupt task, restore the context of the current interrupt task from the target storage area, so as to execute the current interrupt task.
The method comprises the steps of monitoring the current task execution progress; if the execution progress meets a preset interrupt condition, judging that the current task is a current interrupt task, and storing the context of the current interrupt task to a target storage area by utilizing a register bank function; and screening out a target task to be executed, and if the screened target task to be executed is the current interrupt task, recovering the context of the current interrupt task from the target storage area so as to execute the current interrupt task. Therefore, when the current task execution progress meets the preset interrupt condition, namely when an interrupt occurs, the context of the current interrupt task can be automatically saved to the target storage area by utilizing the register bank function, after the target task to be executed is screened out, the context of the current interrupt task is automatically restored, and the current interrupt task is executed, namely, the context saving and interrupt parallel processing are realized, the task context code saving work is not needed to be manually written by a worker, the code writing time is reduced, and the task scheduling efficiency is improved.
In some embodiments, the context save module 12 includes:
and the first saving unit is used for saving the context of the current interrupt task to a target storage area by utilizing a register bank function of a target register which is configured in advance in an initializing mode.
In some embodiments, the task scheduling device includes:
an initialization configuration unit for determining a target register from all the register registers; and determining an initial storage area corresponding to the target register so as to finish the initialization configuration of the target register.
In some embodiments, the context save module 12 includes:
the storage area determining unit is used for determining the current stored address information and storing the context of the current interrupt task to a target storage area corresponding to the current stored address information by utilizing a register bank function;
and the second saving unit is used for determining the next saving address information based on the current saving address information so as to save the context of the next interrupt task to a target storage area corresponding to the next saving address information by utilizing a register bank function when the next interrupt task exists.
In some embodiments, the task execution module 13 includes:
and the task screening sub-module is used for acquiring the priorities of all the tasks to be executed and screening out target tasks to be executed based on the priorities.
In some embodiments, the task screening sub-module includes:
the sorting unit is used for sorting all the tasks to be executed based on the priority, so as to obtain the sorted tasks to be executed;
and the target task screening unit is used for screening the target task to be executed with the highest priority from the ordered tasks to be executed.
In some embodiments, the task execution module 13 includes:
and the context recovery unit is used for executing a RESBANK instruction so as to recover the context of the current interrupt task from the target storage area.
Further, the embodiment of the application also provides electronic equipment. Fig. 7 is a block diagram of an electronic device 20, according to an exemplary embodiment, and the contents of the diagram should not be construed as limiting the scope of use of the present application in any way.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application. Specifically, the method comprises the following steps: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. Wherein the memory 22 is used for storing a computer program, which is loaded and executed by the processor 21 for realizing the following steps:
monitoring the current task execution progress;
if the execution progress meets a preset interrupt condition, judging that the current task is a current interrupt task, and storing the context of the current interrupt task to a target storage area by utilizing a register bank function;
and screening out a target task to be executed, and if the screened target task to be executed is the current interrupt task, recovering the context of the current interrupt task from the target storage area so as to execute the current interrupt task.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
and saving the context of the current interrupt task to a target storage area by utilizing a register bank function of a target register which is configured in advance in an initializing way.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
determining a target register from all the register registers;
and determining an initial storage area corresponding to the target register so as to finish the initialization configuration of the target register.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
determining current stored address information, and storing the context of the current interrupt task to a target storage area corresponding to the current stored address information by utilizing a register bank function;
and determining next storage address information based on the current storage address information, so that when a next interrupt task exists, a register bank function is utilized to store the context of the next interrupt task to a target storage area corresponding to the next storage address information.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
and acquiring the priorities of all the tasks to be executed, and screening out target tasks to be executed based on the priorities.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
sorting all the tasks to be executed based on the priority, so as to obtain the sorted tasks to be executed;
and screening the target task to be executed with the highest priority from the ordered tasks to be executed.
In some embodiments, the processor may further include the following steps by executing the computer program stored in the memory:
and executing a RESBANK instruction so as to restore the context of the current interrupt task from the target storage area.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
Processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 may be implemented in at least one hardware form of DSP (Digital Signal Processing ), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array ). The processor 21 may also comprise a main processor, which is a processor for processing data in an awake state, also called CPU (Central Processing Unit ); a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 may integrate a GPU (Graphics Processing Unit, image processor) for rendering and drawing of content required to be displayed by the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence ) processor for processing computing operations related to machine learning.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon include an operating system 221, a computer program 222, and data 223, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and the computer program 222, so as to implement the operation and processing of the processor 21 on the mass data 223 in the memory 22, which may be Windows, unix, linux. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the task scheduling method performed by the electronic device 20 as disclosed in any of the previous embodiments. The data 223 may include, in addition to data received by the electronic device and transmitted by the external device, data collected by the input/output interface 25 itself, and so on.
Further, the embodiment of the application also discloses a computer readable storage medium, wherein the storage medium stores a computer program, and when the computer program is loaded and executed by a processor, the method steps executed in the task scheduling process disclosed in any embodiment are realized.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The task scheduling method, device, equipment and storage medium provided by the invention are described in detail, and specific examples are applied to illustrate the principle and implementation of the invention, and the description of the above examples is only used for helping to understand the method and core idea of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.
Claims (10)
1. A method for task scheduling, comprising:
monitoring the current task execution progress;
if the execution progress meets a preset interrupt condition, judging that the current task is a current interrupt task, and storing the context of the current interrupt task to a target storage area by utilizing a register bank function;
and screening out a target task to be executed, and if the screened target task to be executed is the current interrupt task, recovering the context of the current interrupt task from the target storage area so as to execute the current interrupt task.
2. The task scheduling method according to claim 1, wherein the saving the context of the current interrupt task to the target storage area by using a register bank function includes:
and saving the context of the current interrupt task to a target storage area by utilizing a register bank function of a target register which is configured in advance in an initializing way.
3. The task scheduling method according to claim 2, further comprising, before the monitoring of the current task execution progress:
determining a target register from all the register registers;
and determining an initial storage area corresponding to the target register so as to finish the initialization configuration of the target register.
4. A task scheduling method according to claim 3, wherein the saving the context of the current interrupt task to the target storage area by using a register bank function includes:
determining current stored address information, and storing the context of the current interrupt task to a target storage area corresponding to the current stored address information by utilizing a register bank function;
and determining next storage address information based on the current storage address information, so that when a next interrupt task exists, a register bank function is utilized to store the context of the next interrupt task to a target storage area corresponding to the next storage address information.
5. The task scheduling method according to claim 1, wherein the screening out the target task to be executed includes:
and acquiring the priorities of all the tasks to be executed, and screening out target tasks to be executed based on the priorities.
6. The task scheduling method according to claim 5, wherein the screening out the target task to be executed based on the priority includes:
sorting all the tasks to be executed based on the priority, so as to obtain the sorted tasks to be executed;
and screening the target task to be executed with the highest priority from the ordered tasks to be executed.
7. The task scheduling method according to any one of claims 1 to 6, wherein the restoring the context of the current interrupt task from the target storage area includes:
and executing a RESBANK instruction so as to restore the context of the current interrupt task from the target storage area.
8. A task scheduling device, comprising:
the task monitoring module is used for monitoring the current task execution progress;
the context saving module is used for judging that the current task is the current interrupt task if the execution progress meets the preset interrupt condition, and saving the context of the current interrupt task to a target storage area by utilizing a register bank function;
and the task execution module is used for screening a target task to be executed, and if the screened target task to be executed is the current interrupt task, restoring the context of the current interrupt task from the target storage area so as to execute the current interrupt task.
9. An electronic device, comprising:
a memory for storing a computer program;
processor for executing the computer program to implement the steps of the task scheduling method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program; wherein the computer program when executed by a processor implements the steps of the task scheduling method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310084999.1A CN116185587A (en) | 2023-02-08 | 2023-02-08 | Task scheduling method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310084999.1A CN116185587A (en) | 2023-02-08 | 2023-02-08 | Task scheduling method, device, equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116185587A true CN116185587A (en) | 2023-05-30 |
Family
ID=86445618
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310084999.1A Pending CN116185587A (en) | 2023-02-08 | 2023-02-08 | Task scheduling method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116185587A (en) |
-
2023
- 2023-02-08 CN CN202310084999.1A patent/CN116185587A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5799188A (en) | System and method for managing variable weight thread contexts in a multithreaded computer system | |
CN101714091B (en) | Methods and systems to display platform graphics during operating system initialization | |
EP1766518B1 (en) | Adaptive algorithm for selecting a virtualization algorithm in virtual machine environments | |
CN112764872B (en) | Computer device, virtualization acceleration device, remote control method, and storage medium | |
CN109062246B (en) | Modularized flight control system with multitask self-scheduling function and design method thereof | |
JPH0353328A (en) | Register saving recoverying method and processor | |
CN112269536A (en) | Method and device for optimizing storage software system and computer readable storage medium | |
US4851992A (en) | Register/saving/restoring system for saving and restoring data in a register of a slave processor | |
CN113849238B (en) | Data communication method, device, electronic equipment and readable storage medium | |
US7401335B2 (en) | Single stack kernel | |
CN116185587A (en) | Task scheduling method, device, equipment and medium | |
CN109800166B (en) | Debugging method and device for embedded real-time operating system | |
EP4350524A1 (en) | Error detection method and device related thereto | |
JPH07109589B2 (en) | Instruction processing method | |
JPH05165652A (en) | Task switching control method | |
CN114064089A (en) | HMI software system, updating method, electronic device and medium | |
US20210141661A1 (en) | Lightweight Context For CPU Idling Using A Real Time Kernel | |
CN116238540A (en) | Map construction operation method and device for parking and electronic equipment | |
CN116783097A (en) | Vehicle-mounted computer, computer execution method and computer program | |
CN117957531A (en) | Method and apparatus for sequence monitoring of multiple threads | |
CN115756831A (en) | Two-stage asynchronous task result proxy system and method suitable for heterogeneous interface | |
JP3077812B2 (en) | Information processing device | |
JPH0535499A (en) | Data processing device and method | |
CN202049474U (en) | Information terminal | |
CN114203127A (en) | Improved method, device and processor for data output display of dot matrix liquid crystal display and computer readable storage medium thereof |
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 |