CN113296900A - Task switching method and device - Google Patents
Task switching method and device Download PDFInfo
- Publication number
- CN113296900A CN113296900A CN202010108883.3A CN202010108883A CN113296900A CN 113296900 A CN113296900 A CN 113296900A CN 202010108883 A CN202010108883 A CN 202010108883A CN 113296900 A CN113296900 A CN 113296900A
- Authority
- CN
- China
- Prior art keywords
- task
- register
- management module
- operating system
- target
- 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/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30098—Register arrangements
- G06F9/3012—Organisation of register space, e.g. banked or distributed register file
- G06F9/30123—Organisation of register space, e.g. banked or distributed register file according to context, e.g. thread buffers
Abstract
The embodiment of the invention provides a task switching method and device. The method is applied to a target device, wherein the target device comprises a plurality of tasks and a task management module of each task; the method comprises the following steps: when receiving a task switching operation, acquiring an initial task executed by an operating system of the target device at the current moment and a first register context operated by the operating system at the current moment; saving the first register context to a first register sub-module of a first task management module of the initial task, and acquiring a target task of the task switching operation; and acquiring a second register context in a second register submodule of a second task management module of the target task, and controlling the operating system to run the second register context. The embodiment of the invention solves the problems that the task switching process of the base station operating system is complex, the time consumption is long, and the processing performance of the operating system is influenced in the prior art.
Description
Technical Field
The present invention relates to the field of mobile communications technologies, and in particular, to a task switching method and apparatus.
Background
In a wireless communication system, each functional module in a software system of a base station device performs task management through a standard Linux task. When business code runs, software of multiple subsystems in a software system is usually required to run cooperatively, so that frequent task switching is introduced. The time for switching the task directly affects the effective utilization rate of the service code to a Central Processing Unit (CPU); the service code has high effective utilization rate to the CPU, and the hardware capability of the CPU can be better exerted.
In the 5G base station system, service software runs in a user mode of a Linux operating system, but task switching is in a kernel mode, so that switching of a standard Linux task needs to enter the kernel mode; after the task to be switched is scheduled and switched in the kernel mode, the task also needs to be returned to the user mode for execution, and the system overhead is high. Specifically, task switching typically includes 3 processes: (1) a task A currently running by a base station enters a kernel state from a user state, and the mode of entering the kernel state is system calling, interruption, exception and the like; (2) and the base station operating system executes the scheduling code in the kernel mode, and performs task switching after selecting the next task to be executed. The task switching mainly comprises two contents, namely a memory page table for switching the task and a register for switching the task; (3) and after the switching is finished, entering the user state again, and executing the application program of the task B of the base station. In the process, non-negligible overhead is brought to the CPU, and the effective utilization of the CPU by the base station service is influenced; in addition, in the process of executing task scheduling by the kernel code and selecting the next task to be switched, the operating system faces tens of thousands of tasks managed by the operating system, the accuracy of task scheduling cannot be guaranteed, and serious delay is brought to application scenes with very strict real-time requirements such as a base station system.
Therefore, in the prior art, the task switching process of the base station operating system is complex and time-consuming, and the processing performance of the operating system is affected.
Disclosure of Invention
Embodiments of the present invention provide a task switching method and apparatus, so as to solve the problems in the prior art that a task switching process of a base station operating system is complex, time consumption is long, and processing performance of the operating system is affected.
In one aspect, an embodiment of the present invention provides a task switching method, which is applied to a target device, where the target device includes a plurality of tasks and a task management module for each task, and the task management module includes a register submodule for storing a register context;
the method comprises the following steps:
when receiving a task switching operation, acquiring an initial task executed by an operating system of the target device at the current moment and a first register context operated by the operating system at the current moment;
saving the first register context to a first register sub-module of a first task management module of the initial task, and acquiring a target task of the task switching operation;
and acquiring a second register context in a second register submodule of a second task management module of the target task, and controlling the operating system to run the second register context.
Optionally, the task management module further includes a stack sub-module for storing task data;
after the step of obtaining the initial task executed by the operating system of the target device at the current time, the method further includes:
and storing the task data in the first register operated by the operating system at the current moment into a first stack submodule of the task management module of the initial task.
Optionally, after the step of obtaining the target task of the task switching operation, the method further includes:
and acquiring task data in a second stack submodule of a second task management module of the target task.
Optionally, after the step of controlling the operating system to run the second register context, the method includes:
and if the target task is finished, triggering task switching operation for switching to the initial task.
Optionally, the task management module further includes a scheduling control sub-module and/or a priority sub-module for storing task priority information.
On the other hand, an embodiment of the present invention further provides a task switching apparatus, which is applied to a target device, where the target device includes a plurality of tasks and a task management module for each task, and the task management module includes a register submodule for storing a register context;
the device comprises:
the operation receiving module is used for acquiring an initial task executed by an operating system of the target equipment at the current moment and a first register context operated by the operating system at the current moment when task switching operation is received;
the first processing module is used for saving the first register context into a first register sub-module of a first task management module of the initial task and acquiring a target task of the task switching operation;
and the second processing module is used for acquiring a second register context in a second register submodule of the second task management module of the target task and controlling the operating system to operate the second register context.
Optionally, the task management module further includes a stack sub-module for storing task data;
the device further comprises:
and the storage module is used for storing the task data in the first register operated by the operating system at the current moment into the first stack submodule of the task management module of the initial task.
Optionally, the apparatus further comprises:
and the acquisition module is used for acquiring the task data in the second stack submodule of the second task management module of the target task.
Optionally, the apparatus comprises:
and the operation triggering module is used for triggering task switching operation for switching to the initial task if the target task is operated completely.
Optionally, the task management module further includes a scheduling control sub-module and/or a priority sub-module for storing task priority information.
In yet another aspect, an embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps in the task switching method described above are implemented.
In still another aspect, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program implements the steps in the task switching method described above.
In the embodiment of the invention, when task switching operation is received, an initial task executed by an operating system of a target device at the current moment and a first register context operated by the operating system at the current moment are acquired; saving the first register context to a first register sub-module of a first task management module of the initial task, and acquiring a target task of the task switching operation; acquiring a second register context in a second register submodule of a second task management module of the target task, and controlling the operating system to run the second register context; based on the task management module, the target device can realize task switching in the user mode space only by exchanging the register context, and the task switching is carried out in the user mode space, so that the operating system cost is low, and the occupied resources of the operating system are less.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
Fig. 1 is a flowchart illustrating steps of a task switching method according to an embodiment of the present invention;
FIG. 2 is a diagram of a task management module according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a first example of an embodiment of the present invention;
FIG. 4 is a schematic diagram of a second example of embodiment of the present invention;
fig. 5 is a block diagram of a communication device according to an embodiment of the present invention;
fig. 6 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
In various embodiments of the present invention, it should be understood that the sequence numbers of the following processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
In the embodiments provided herein, it should be understood that "B corresponding to A" means that B is associated with A from which B can be determined. It should also be understood that determining B from a does not mean determining B from a alone, but may be determined from a and/or other information.
Fig. 1 shows a flowchart of a task switching method according to an embodiment of the present invention.
As shown in fig. 1, an embodiment of the present invention provides a task switching method, which is applied to a target device, where the target device includes a plurality of tasks and a task management module for each task, and in a wireless communication system, the target device may be a network-side device, such as a base station; for convenience of description, in the embodiment of the present invention, a base station is taken as an example of a target device, however, the target device is not limited, and other devices having the same operating system and/or operating mode may also be taken as the target device.
As shown in fig. 2, the task management module includes a register submodule for storing register context, in which a complete set of register values related to the CPU, such as R15 to SS in fig. 2, are stored;
the method comprises the following steps:
The task switching operation may be from a high-level instruction of the base station, or a task switching operation when a currently executed task is completed due to a periodic processing task or preempted by the user-mode scheduler and needs to be switched. When receiving a task switching operation, the base station acquires an initial task currently executed by an operating system of the base station, and acquires a first register context currently operated by the operating system.
Specifically, the Register Context (Register Context) includes general purpose registers, program registers (IPs), processor status registers (EFLAGS), stack pointers (ESP), and other related parameters. Register context, that is, context on which register values are based, a CPU generally has only one set of registers, so when the CPU executes a plurality of tasks (threads) in the system in turn, the registers of the CPU store register values of the currently executing threads, and thus, the first register context is the register context of the initial task; for non-executing threads, register values are stored in memory and loaded from memory into physical registers by the CPU when the CPU is to perform this task.
And storing the first register context to a first register submodule of a first task management module of the initial task so as to obtain the first register context when the operating system executes the initial task again. Meanwhile, the base station also acquires a target task of task switching operation, namely a switched task.
Before the target task is operated, the base station firstly acquires a second register context, wherein the second register context is the register context of the target task and is stored in a second register submodule of a second task management module of the target task; and after the second register context is obtained, the target equipment controls the operating system to run the second register context so as to execute the target task.
Therefore, based on the task management module of each task, when the base station switches the tasks, the base station only needs to exchange the register context of the operating system, the exchange register context runs in the user mode space and does not enter the kernel mode, so that when the base station services are processed, the task scheduling and the task switching do not need to enter the kernel mode, the controllability of the user mode operation is good, and the running reliability of the operating system can be improved.
As a first example, referring to fig. 3, in the task switching process, the base station operating system first executes the step shown by arrow 1, and stores the register context operated by the current operating system into the first register submodule of the first task management module; and then executing the step shown by the arrow 2 to obtain a second register context in a second register submodule of a second task management module of the target task.
In the above embodiment of the present invention, when a task switching operation is received, an initial task executed by an operating system of the target device at the current time and a first register context operated by the operating system at the current time are obtained; saving the first register context to a first register sub-module of a first task management module of the initial task, and acquiring a target task of the task switching operation; acquiring a second register context in a second register submodule of a second task management module of the target task, and controlling the operating system to run the second register context; based on the task management module, the target device can realize task switching in the user mode space only by exchanging the register context, and the task switching is carried out in the user mode space, so that the operating system cost is low, and the occupied resources of the operating system are less. The embodiment of the invention solves the problems that the task switching process of the base station operating system is complex, the time consumption is long, and the processing performance of the operating system is influenced in the prior art.
Optionally, in this embodiment of the present invention, as shown in fig. 2, the task management module further includes a stack sub-module for storing task data; the stack submodule is the private stack of the task, which is realized by using the system reserved memory.
After the step of obtaining the initial task executed by the operating system of the target device at the current time, the method further includes:
and storing the task data in the first register operated by the operating system at the current moment into a first stack submodule of the task management module of the initial task.
And the task data in the first register operated by the operating system at the current moment is the task data of the initial task. When the base station switches tasks, the task data of the initial task is stored in a first stack submodule of a task management module of the initial task, so that normal operation is recovered when the initial task is executed again.
Optionally, in this embodiment of the present invention, after the step of obtaining the target task of the task switching operation, the method further includes:
and acquiring task data in a second stack submodule of a second task management module of the target task.
Before an operating system executes the target task, firstly, acquiring task data of the target task; and the task data of the target task is stored in its second stack submodule.
Optionally, in this embodiment of the present invention, after the step of controlling the operating system to run the second register context, the method includes:
and if the target task is finished, triggering task switching operation for switching to the initial task.
And after the target task is switched, if a new task switching operation is not received and the new task switching operation indicates to switch to a task except the initial task, the base station automatically triggers to switch back to the initial task so as to maintain the quick operation of the operating system.
Optionally, in this embodiment of the present invention, as shown in fig. 2, the task management module further includes a scheduling control sub-module and/or a priority sub-module for storing task priority information.
The scheduling control submodule is used for receiving task scheduling from an operating system; the priority submodule is used for maintaining task priorities of tasks, and one thread can have a plurality of micro-level tasks of the scheme. The micro-level tasks have own priorities, and are lighter than Linux threads by taking the micro-level tasks as an example, and the micro-level tasks are scheduled according to the task priorities.
As a second example, with reference to fig. 4, a task switching scenario in the embodiment of the present invention is shown in fig. 4, and mainly includes the following processes:
1. the base station runs a micro-scale task A;
2. when the task is required to be switched, the task A is directly switched to the task B in a user mode without entering a kernel space and passing through a kernel scheduler;
3. the base station executes a micro-scale task B;
4. the task B finishes processing the active trigger task switching or the task B is seized to trigger the task switching, the task B is switched to the task A, and the task A is continuously executed;
5. and the base station micro-scale task A continues to execute.
In the processes 1 to 5, two task switches exist, namely, the task A is switched to the task B, and the task B is switched back to the task A, and the two task switches both run in the user state space and do not enter the kernel state space.
In the above embodiment of the present invention, when a task switching operation is received, an initial task executed by an operating system of the target device at the current time and a first register context operated by the operating system at the current time are obtained; saving the first register context to a first register sub-module of a first task management module of the initial task, and acquiring a target task of the task switching operation; acquiring a second register context in a second register submodule of a second task management module of the target task, and controlling the operating system to run the second register context; based on the task management module, the target device can realize task switching in the user mode space only by exchanging the register context, and the task switching is carried out in the user mode space, so that the operating system cost is low, and the occupied resources of the operating system are less.
With the above description of the task switching method according to the embodiment of the present invention, a communication device according to the embodiment of the present invention will be described with reference to the accompanying drawings.
Referring to fig. 5, an embodiment of the present invention further provides a task switching apparatus, which is applied to a target device, where the target device includes a plurality of tasks and a task management module for each task, and in a wireless communication system, the target device may be a network side device, such as a base station; for convenience of description, in the embodiment of the present invention, a base station is taken as an example of a target device, however, the target device is not limited, and other devices having the same operating system and/or operating mode may also be taken as the target device.
As shown in fig. 2, the task management module includes a register submodule for storing register context, in which a complete set of register values related to the CPU, such as R15 to SS in fig. 2, are stored;
the device comprises:
an operation receiving module 501, configured to obtain an initial task executed by an operating system of the target device at the current time and a first register context run by the operating system at the current time when receiving a task switching operation.
The task switching operation may be from a high-level instruction of the base station, or a task switching operation when a currently executed task is completed due to a periodic processing task or preempted by the user-mode scheduler and needs to be switched. When receiving a task switching operation, the base station acquires an initial task currently executed by an operating system of the base station, and acquires a first register context currently operated by the operating system.
Specifically, the register context includes general purpose registers, program registers (IPs), processor status registers (EFLAGS), stack pointers (ESPs), and other relevant parameters. Register context, that is, context on which register values are based, a CPU generally has only one set of registers, so when the CPU executes a plurality of tasks (threads) in the system in turn, the registers of the CPU store register values of the currently executing threads, and thus, the first register context is the register context of the initial task; for non-executing threads, register values are stored in memory and loaded from memory into physical registers by the CPU when the CPU is to perform this task.
The first processing module 502 is configured to save the first register context to the first register sub-module of the first task management module of the initial task, and obtain a target task of the task switching operation.
And saving the first register context to a first register submodule of a first task management module of the initial task so as to obtain the first register context when the operating system executes the initial task again. Meanwhile, the base station also acquires a target task of task switching operation, namely a switched task.
The second processing module 503 is configured to obtain a second register context in a second register submodule of the second task management module of the target task, and control the operating system to run the second register context.
Before the target task is operated, the base station firstly acquires a second register context, wherein the second register context is the register context of the target task and is stored in a second register submodule of a second task management module of the target task; and after the second register context is obtained, the target equipment controls the operating system to run the second register context so as to execute the target task.
Therefore, based on the task management module of each task, when the base station switches the tasks, the base station only needs to exchange the register context of the operating system, the exchange register context runs in the user mode space and does not enter the kernel mode, so that when the base station services are processed, the task scheduling and the task switching do not need to enter the kernel mode, the controllability of the user mode operation is good, and the running reliability of the operating system can be improved.
Optionally, in this embodiment of the present invention, the task management module further includes a stack sub-module for storing task data;
the device further comprises:
and the storage module is used for storing the task data in the first register operated by the operating system at the current moment into the first stack submodule of the task management module of the initial task.
Optionally, in an embodiment of the present invention, the apparatus further includes:
and the acquisition module is used for acquiring the task data in the second stack submodule of the second task management module of the target task.
Optionally, in an embodiment of the present invention, the apparatus includes:
and the operation triggering module is used for triggering task switching operation for switching to the initial task if the target task is operated completely.
Optionally, in this embodiment of the present invention, the task management module further includes a scheduling control sub-module and/or a priority sub-module for storing task priority information.
The communication device provided in the embodiment of the present invention can implement each process implemented by the base station side in the method embodiments of fig. 1 to fig. 4, and is not described here again to avoid repetition.
In the embodiment of the present invention, when receiving a task switching operation, the operation receiving module 501 obtains an initial task executed by an operating system of the target device at the current time and a first register context operated by the operating system at the current time; the first processing module 502 saves the first register context to the first register sub-module of the first task management module of the initial task, and obtains a target task of the task switching operation; the second processing module 503 obtains a second register context in a second register submodule of the second task management module of the target task, and controls the operating system to run the second register context; based on the task management module, the target device can realize task switching in the user mode space only by exchanging the register context, and the task switching is carried out in the user mode space, so that the operating system cost is low, and the occupied resources of the operating system are less.
On the other hand, an embodiment of the present invention further provides an electronic device, which includes a memory, a processor, a bus, and a computer program stored on the memory and executable on the processor, where the processor implements the steps in the task switching method when executing the program.
For example, fig. 6 shows a schematic physical structure diagram of an electronic device.
As shown in fig. 6, the electronic device may include: a processor (processor)610, a communication Interface (Communications Interface)620, a memory (memory)630 and a communication bus 640, wherein the processor 610, the communication Interface 620 and the memory 630 communicate with each other via the communication bus 640. The processor 610 may call logic instructions in the memory 630 to perform the following method:
when receiving a task switching operation, acquiring an initial task executed by an operating system of the target device at the current moment and a first register context operated by the operating system at the current moment;
saving the first register context to a first register sub-module of a first task management module of the initial task, and acquiring a target task of the task switching operation;
and acquiring a second register context in a second register submodule of a second task management module of the target task, and controlling the operating system to run the second register context.
In addition, the logic instructions in the memory 630 may be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the task switching method provided in the foregoing embodiments when executed by a processor, for example, the method includes:
when receiving a task switching operation, acquiring an initial task executed by an operating system of the target device at the current moment and a first register context operated by the operating system at the current moment;
saving the first register context to a first register sub-module of a first task management module of the initial task, and acquiring a target task of the task switching operation;
and acquiring a second register context in a second register submodule of a second task management module of the target task, and controlling the operating system to run the second register context.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (12)
1. A task switching method is applied to target equipment and is characterized in that the target equipment comprises a plurality of tasks and a task management module of each task, wherein the task management module comprises a register submodule for storing register context;
the method comprises the following steps:
when receiving a task switching operation, acquiring an initial task executed by an operating system of the target device at the current moment and a first register context operated by the operating system at the current moment;
saving the first register context to a first register sub-module of a first task management module of the initial task, and acquiring a target task of the task switching operation;
and acquiring a second register context in a second register submodule of a second task management module of the target task, and controlling the operating system to run the second register context.
2. The task switching method according to claim 1, wherein the task management module further comprises a stack submodule for storing task data;
after the step of obtaining the initial task executed by the operating system of the target device at the current time, the method further includes:
and storing the task data in the first register operated by the operating system at the current moment into a first stack submodule of the task management module of the initial task.
3. The task switching method according to claim 2, wherein after the step of obtaining the target task of the task switching operation, the method further comprises:
and acquiring task data in a second stack submodule of a second task management module of the target task.
4. The task switching method according to claim 1, wherein after the step of controlling the operating system to run a second register context, the method comprises:
and if the target task is finished, triggering task switching operation for switching to the initial task.
5. The task switching method according to claim 1, wherein the task management module further comprises a scheduling control sub-module and/or a priority sub-module for storing task priority information.
6. A task switching device is applied to a target device, and is characterized in that the target device comprises a plurality of tasks and a task management module of each task, wherein the task management module comprises a register submodule for storing register context;
the device comprises:
the operation receiving module is used for acquiring an initial task executed by an operating system of the target equipment at the current moment and a first register context operated by the operating system at the current moment when task switching operation is received;
the first processing module is used for saving the first register context into a first register sub-module of a first task management module of the initial task and acquiring a target task of the task switching operation;
and the second processing module is used for acquiring a second register context in a second register submodule of the second task management module of the target task and controlling the operating system to operate the second register context.
7. The task switching device according to claim 6, wherein the task management module further comprises a stack submodule for storing task data;
the device further comprises:
and the storage module is used for storing the task data in the first register operated by the operating system at the current moment into the first stack submodule of the task management module of the initial task.
8. The task switching device according to claim 7, characterized in that the device further comprises:
and the acquisition module is used for acquiring the task data in the second stack submodule of the second task management module of the target task.
9. The task switching device according to claim 6, characterized in that the device comprises:
and the operation triggering module is used for triggering task switching operation for switching to the initial task if the target task is operated completely.
10. The task switching device according to claim 6, wherein the task management module further comprises a scheduling control sub-module and/or a priority sub-module for storing task priority information.
11. An electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, characterized in that the computer program, when executed by the processor, implements the steps of the task switching method according to any of claims 1 to 5.
12. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the task switching method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010108883.3A CN113296900A (en) | 2020-02-21 | 2020-02-21 | Task switching method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010108883.3A CN113296900A (en) | 2020-02-21 | 2020-02-21 | Task switching method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113296900A true CN113296900A (en) | 2021-08-24 |
Family
ID=77318471
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010108883.3A Pending CN113296900A (en) | 2020-02-21 | 2020-02-21 | Task switching method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113296900A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2016033755A1 (en) * | 2014-09-03 | 2016-03-10 | 华为技术有限公司 | Task handling apparatus and method, and electronic device |
CN107003899A (en) * | 2015-10-28 | 2017-08-01 | 华为技术有限公司 | A kind of interrupt response method, device and base station |
CN109213591A (en) * | 2017-06-30 | 2019-01-15 | 合网络技术(北京)有限公司 | Assist the distribution method and device of journey running stack |
CN109298922A (en) * | 2018-08-30 | 2019-02-01 | 百度在线网络技术(北京)有限公司 | Parallel task processing method, association's journey frame, equipment, medium and unmanned vehicle |
CN110597601A (en) * | 2019-09-16 | 2019-12-20 | 杭州和利时自动化有限公司 | Controller task switching method, device, equipment and readable storage medium |
-
2020
- 2020-02-21 CN CN202010108883.3A patent/CN113296900A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2016033755A1 (en) * | 2014-09-03 | 2016-03-10 | 华为技术有限公司 | Task handling apparatus and method, and electronic device |
CN107003899A (en) * | 2015-10-28 | 2017-08-01 | 华为技术有限公司 | A kind of interrupt response method, device and base station |
CN109213591A (en) * | 2017-06-30 | 2019-01-15 | 合网络技术(北京)有限公司 | Assist the distribution method and device of journey running stack |
CN109298922A (en) * | 2018-08-30 | 2019-02-01 | 百度在线网络技术(北京)有限公司 | Parallel task processing method, association's journey frame, equipment, medium and unmanned vehicle |
CN110597601A (en) * | 2019-09-16 | 2019-12-20 | 杭州和利时自动化有限公司 | Controller task switching method, device, equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3425502B1 (en) | Task scheduling method and device | |
US10977070B2 (en) | Control system for microkernel architecture of industrial server and industrial server comprising the same | |
EP3413196A1 (en) | Service container creation method and device | |
EP2492810A1 (en) | Method and device for managing operating systems in embedded system | |
CN109968352B (en) | Robot control method, robot and device with storage function | |
CN109656725B (en) | Message consumer switching method and device, storage medium and electronic equipment | |
CN104991811B (en) | The method of adjustment and intelligent terminal of running state of process when shielding system switches | |
US6820263B1 (en) | Methods and system for time management in a shared memory parallel processor computing environment | |
CN111897637B (en) | Job scheduling method, device, host and storage medium | |
EP0955581A1 (en) | Software interrupt mechanism | |
CN115269196A (en) | Thread pool dynamic creation method, device, equipment and storage medium | |
CN115033352A (en) | Task scheduling method, device and equipment for multi-core processor and storage medium | |
EP4336359A1 (en) | Method for processing page faults and corresponding apparatus | |
CN113296900A (en) | Task switching method and device | |
CN115934656A (en) | Information processing method, service processing method and device | |
CN109756356B (en) | Equipment upgrading method and device | |
US20090083754A1 (en) | Implementation of multi-tasking on a digital signal processor | |
CN114610485A (en) | Resource processing system and method | |
CN114691321A (en) | Task scheduling method, device, equipment and storage medium | |
US10866833B2 (en) | Method and appratus for implementing microkernel architecture of industrial server | |
US9619277B2 (en) | Computer with plurality of processors sharing process queue, and process dispatch processing method | |
CN113608845A (en) | Data processing method and device | |
CN113467901A (en) | Task scheduling method and related equipment | |
CN108009007B (en) | Scheduling method of lightweight thread, cooperative manager and vCPU scheduler | |
CN114760161B (en) | LIN bus scheduling method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |