[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN118012612A - Kernel preemption switching method and computing device - Google Patents

Kernel preemption switching method and computing device Download PDF

Info

Publication number
CN118012612A
CN118012612A CN202410145520.5A CN202410145520A CN118012612A CN 118012612 A CN118012612 A CN 118012612A CN 202410145520 A CN202410145520 A CN 202410145520A CN 118012612 A CN118012612 A CN 118012612A
Authority
CN
China
Prior art keywords
kernel
preemption
configuration item
state
processor
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410145520.5A
Other languages
Chinese (zh)
Inventor
陈嘉宏
毛阿利
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Henan Kunlun Technology Co ltd
Original Assignee
XFusion Digital Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by XFusion Digital Technologies Co Ltd filed Critical XFusion Digital Technologies Co Ltd
Priority to CN202410145520.5A priority Critical patent/CN118012612A/en
Publication of CN118012612A publication Critical patent/CN118012612A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/484Precedence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a kernel preemption switching method and computing equipment, wherein the kernel preemption switching method comprises the following steps: starting a kernel program package, and configuring a kernel preemption global mark according to the guide parameters under the condition that the guide parameters are acquired; under the target condition, according to a first kernel configuration item corresponding to the kernel preemption attribute, a second kernel configuration item corresponding to the preemption attribute and a kernel preemption global mark are dynamically closed to determine whether to trigger scheduling, so that a high-priority task acquires processor resources. The kernel preemption switching method and the computing device provided by the embodiment of the application can be used for efficiently and conveniently switching kernel versions.

Description

Kernel preemption switching method and computing device
Technical Field
The embodiment of the application relates to the technical field of computing equipment, in particular to a kernel preemption switching method and computing equipment.
Background
The operating system kernel has an on preemption version and an off preemption version. When the kernel of the operating system is in an open preemption version, a certain process is operated in the kernel, if a task with higher priority appears, the current kernel allows preemption, the current task can be suspended, and the process with higher priority is executed; while the operating system kernel is in the off preemption version, high priority processes cannot suspend low priority processes running in the kernel while preempting CPU operations.
In the related art, when the server performs kernel version switching, it is generally necessary to reconfigure a kernel configuration item, recompile a kernel image, and redeploy the kernel image, which is complicated and complex in flow. In the scene of frequent switching of the preemption version and the preemption version in development and test, two sets of images need to be compiled for the kernels of different versions, and the images are respectively deployed on different servers, so that the deployment and test cannot be performed rapidly.
Therefore, how to efficiently and conveniently switch kernel versions is a problem to be solved.
Disclosure of Invention
The embodiment of the application provides a kernel preemption switching method and computing equipment, which can be used for efficiently and conveniently switching kernel versions.
In a first aspect, an embodiment of the present application provides a method for switching kernel preemption, including: starting a kernel program package, and configuring a kernel preemption global mark according to a guide parameter under the condition that the guide parameter is acquired; under the target condition, according to a first kernel configuration item corresponding to the kernel preemption attribute, dynamically closing a second kernel configuration item corresponding to the preemption attribute and the kernel preemption global mark to determine whether to trigger scheduling, so that the high-priority task obtains the processor resource.
According to the kernel preemption switching method provided by the embodiment of the application, the preemption version of the kernel of the operating system can be flexibly opened and closed by modifying the kernel preemption global mark through the guide parameter, so that the kernel version switching can be efficiently and conveniently performed, and the problem that the related technology cannot efficiently and conveniently perform the kernel version switching is solved.
In a possible implementation manner, the determining, under the target condition, whether to trigger scheduling according to a first kernel configuration item corresponding to a kernel preemption attribute, dynamically closing a second kernel configuration item corresponding to the preemption attribute and the kernel preemption global flag includes: when checking before the kernel interrupt exits, determining whether a first kernel configuration item corresponding to a kernel preemption attribute is in an open state, and when determining that the first kernel configuration item is in the open state, determining whether a second kernel configuration item corresponding to a dynamic closing preemption attribute is in the open state; when the second kernel configuration item is determined to be in an on state, determining whether the kernel preemption global mark is in the on state; and when the kernel preemption global mark is determined to be in an on state, determining whether a high-priority task exists or not, and triggering scheduling when the high-priority task exists.
In the above embodiment, when the check before the core interrupt exit is performed, the scheduling is triggered when it is determined that the first core configuration item, the second core configuration item, and the core preemption global flag are all in an on state and a high priority task exists. Under the condition that the kernel of the operating system is in the preemptive version and the preemptive version can be dynamically closed, the preemptive version of the kernel of the operating system is kept in an open state by opening the kernel preemptive global mark, so that the effective scheduling of the processor resources is realized, and the high-priority tasks acquire the processor resources.
In one possible embodiment, the method further comprises: and when the second kernel configuration item is determined to be in a closed state, determining whether a high-priority task exists or not, and triggering scheduling when the high-priority task exists.
In the above embodiment, when the check before the core interrupt exits is performed, the scheduling is triggered when it is determined that the first core configuration item is in an on state, the second core configuration item is in an off state, and a high-priority task exists. Under the condition that the operating system kernel is in the preemptive version and the preemptive version cannot be dynamically closed, the preemptive version of the operating system kernel is kept in an open state, so that the effective scheduling of the processor resources is realized, and the high-priority tasks acquire the processor resources.
In one possible embodiment, the method further comprises: and when the first kernel configuration item is determined to be in a closed state, or the kernel preemption global mark is determined to be in a closed state, or no high-priority task is determined to exist, the process jumps to a non-preemption flow.
In the above embodiment, when the check before the core interrupt exit is performed, the non-preemptive flow is executed when it is determined that the first core configuration item is in the off state, or when it is determined that the core preemptive global flag is in the off state, or when it is determined that there is no high priority task. The method can enable the operating system kernel to keep a non-preemptive state when the operating system kernel is in a preemptive-closing version or an preemptive-opening version of the operating system kernel is closed or the kernel does not have a high-priority task, and ensure that the current task continuously occupies processor resources for efficient execution.
In a possible implementation manner, the determining, under the target condition, whether to trigger scheduling according to a first kernel configuration item corresponding to a kernel preemption attribute, dynamically closing a second kernel configuration item corresponding to the preemption attribute and the kernel preemption global flag includes: when a kernel display calling program is triggered, determining whether a first kernel configuration item corresponding to a kernel preemption attribute is in an open state, and when the first kernel configuration item is in the open state, determining whether a second kernel configuration item corresponding to a dynamic closing preemption attribute is in the open state; when the second kernel configuration item is determined to be in an on state, determining whether the kernel preemption global mark is in an off state or not; triggering scheduling when the kernel preemption global mark is determined to be in a closed state.
In the above embodiment, when the kernel display calling program is triggered, the scheduling is triggered when the first kernel configuration item is determined to be in an on state, the second kernel configuration item is determined to be in an on state, and the kernel preemption global flag is determined to be in an off state. Under the conditions that the kernel of the operating system is in an on-preempting version and the on-preempting version can be dynamically closed, the on-preempting version of the kernel of the operating system is kept in a closed state by closing the kernel preempting global mark, so that the process in a dormant state gives up the processor resource, the effective scheduling of the processor resource is realized, and other tasks needing to be scheduled acquire the processor resource.
In one possible embodiment, the method further comprises: triggering scheduling when the first kernel configuration item is determined to be in a closed state.
In the above embodiment, when the first kernel configuration item is determined to be in the off state, scheduling is triggered. Under the condition that the kernel of the operating system is in the preemptive version, the process in the dormant state can give out the processor resource, so that the effective scheduling of the processor resource is realized, and other tasks needing to be scheduled can acquire the processor resource.
In a possible implementation manner, under the target condition, according to a first kernel configuration item corresponding to a kernel preemption attribute, dynamically closing a second kernel configuration item corresponding to the preemption attribute and the kernel preemption global flag to determine whether to trigger scheduling, including: when a process releases lock resources and a first kernel configuration item corresponding to a kernel preemption attribute is in an open state, determining whether preemption count is 0, and when the preemption count is 0, determining whether a second kernel configuration item corresponding to a dynamic closing preemption attribute is in an open state; when the second kernel configuration item is determined to be in an on state, determining whether the kernel preemption global mark is in the on state; triggering scheduling when the kernel preemption global mark is determined to be in an on state.
In the above embodiment, when the process releases the lock resource, the scheduling is triggered when the first kernel configuration item is determined to be in an open state, the preemption count is 0, the second kernel configuration item is in an open state, and the kernel preemption global flag is in an open state. Under the conditions that all lock resources are released by a process, the kernel of the operating system is in an open preemption version and the open preemption version can be dynamically closed, the open preemption version of the kernel of the operating system is kept in an open state by opening a kernel preemption global mark, so that effective scheduling of processor resources is realized, and other tasks needing to be scheduled are enabled to acquire the processor resources.
In one possible embodiment, the method further comprises: and when the preemption count is not 0 or the kernel preemption global mark is in a closed state, jumping to a non-preemption flow.
In the above embodiment, when the process releases the lock resource, the preemption count is determined to be not 0, that is, when the process has not released the lock resource yet; or executing a non-preemptive flow when the kernel preemptive global mark is determined to be in a closing state, namely, the open preemptive version of the kernel of the operating system is closed. When the lock resources are not released by the process or the open preemptive version of the operating system kernel is closed, the operating system kernel is kept in a non-preemptive state, and the current task is ensured to continuously occupy the processor resources for efficient execution.
In one possible implementation, after modifying the kernel preemption global flag according to the boot parameters, the method further includes: and modifying system information according to the guide parameters.
In the above embodiment, after the kernel preemption global flag is modified according to the boot parameters, the system information is modified according to the boot parameters. Therefore, the user can know whether the kernel of the current operating system is in the on-preemption state or the off-preemption state by looking up the system information.
In a second aspect, embodiments of the present application also provide a computing device, including: a processor, a memory, a communication interface; the memory is used for storing executable instructions of the processor; wherein the processor is configured to perform the kernel preemption handover method of the first aspect via execution of the executable instructions.
According to the computing device provided by the embodiment of the application, the kernel preemption version of the operating system kernel is flexibly opened and closed by modifying the kernel preemption global mark through the guide parameter, so that the kernel version switching is efficiently and conveniently carried out.
In a third aspect, embodiments of the present application also provide a computing device, comprising: the starting module is used for starting the kernel program package, and under the condition that the guiding parameters are acquired, the kernel preemption global mark is configured according to the guiding parameters; and the processing module is used for dynamically closing a second kernel configuration item corresponding to the preemption attribute and the kernel preemption global mark according to the first kernel configuration item corresponding to the kernel preemption attribute under the target condition to determine whether to trigger scheduling so as to enable the high-priority task to acquire the processor resource.
In a fourth aspect, an embodiment of the present application further provides a readable storage medium, where a computer program is stored, where the computer program when executed by a processor implements the kernel preemption handover method according to the first aspect.
The embodiment of the application provides a kernel preemption switching method and computing equipment, wherein the method comprises the following steps: starting a kernel program package, and configuring a kernel preemption global mark according to a guide parameter under the condition that the guide parameter is acquired; under the target condition, according to a first kernel configuration item corresponding to the kernel preemption attribute, dynamically closing a second kernel configuration item corresponding to the preemption attribute and the kernel preemption global mark to determine whether to trigger scheduling, so that the high-priority task acquires the processor resource. Compared with the related art, the method and the device can flexibly start and close the on-preemptive version of the kernel of the operating system by modifying the kernel preemptive global mark through the guide parameter, so that the kernel version switching is performed efficiently and conveniently, and the problem that the related art cannot perform the kernel version switching efficiently and conveniently is solved.
Drawings
Fig. 1 is a schematic flow chart of an embodiment of a kernel preemption switching method according to an embodiment of the present application;
Fig. 2 is a schematic flow chart of a first embodiment of a kernel preemption switching method according to an embodiment of the present application;
fig. 3 is a schematic flow chart of a second embodiment of a kernel preemption switching method according to an embodiment of the present application;
fig. 4 is a schematic flow chart of a third embodiment of a kernel preemption switching method according to an embodiment of the present application;
fig. 5 is a schematic flow chart of a fourth embodiment of a kernel preemption switching method according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a computing device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of another computing device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which are made by a person skilled in the art based on the embodiments of the application in light of the present disclosure, are intended to be within the scope of the application.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The operating system kernel has an on preemption version and an off preemption version. When the kernel of the operating system is in an open preemption version, a certain process is operated in the kernel, if a task with higher priority appears, the current kernel allows preemption, the current task can be suspended, and the process with higher priority is executed; while the operating system kernel is in the off preemption version, high priority processes cannot suspend low priority processes running in the kernel while preempting processor resource operations.
In the related art, when the server performs kernel version switching, it is generally necessary to reconfigure a kernel configuration item, recompile a kernel package, and redeploy the kernel package, which is complicated and complex in flow. In the scene of frequent switching of the preemptive version and the preemptive version, such as development and test, two sets of mirror image program packages need to be compiled for the kernels of different versions, and the mirror image program packages are respectively deployed on different servers, so that the deployment and test cannot be performed rapidly.
Therefore, how to efficiently and conveniently switch kernel versions is a problem to be solved.
In order to solve the above problems, the embodiment of the application provides a kernel preemption switching method.
The core preemption switching method provided by the embodiment of the application is described in detail below through a specific implementation manner.
Fig. 1 is a schematic flow chart of an embodiment of a kernel preemption switching method according to an embodiment of the present application. Referring to fig. 1, when a kernel package is started, a processor acquires a kernel start instruction program uboot, and performs parameter analysis through a processing function to acquire a boot parameter. Specifically, the processor may read the parameter sequence cmdline in the kernel boot director uboot to parse the boot parameters from cmdline; and then modifying the kernel preemption global mark according to the guide parameter, and modifying the system information according to the guide parameter.
The user may write the boot parameters to the parameter sequence cmdline in the kernel launch guidance uboot to cause the processor to parse the boot parameters from cmdline when reading the kernel launch guidance uboot. The user does not write the boot parameters into the kernel start instruction program uboot, and the processor does not acquire the boot parameters when reading the kernel start instruction program uboot.
In one possible implementation, the kernel preemption global flag defaults to an on state, and when the processor acquires the boot parameters, the kernel preemption global flag is modified to an off state; when the processor does not acquire the boot parameters, the kernel preemption global flag is not modified.
In one possible implementation, the processor may modify the system information according to the boot parameters, and in particular, may modify the kernel preemption status information in the system information, so that the user may learn whether the current operating system kernel is in an on preemption status or an off preemption status by looking at the system information.
After modifying the kernel preemption global flag according to the boot parameters, the processor reads the kernel preemption global flag at the time that kernel preemption can be performed to determine whether to trigger preemption scheduling. The kernel preemption opportunity may include: when checking before the kernel interrupt exits, when triggering the kernel to display a calling program or when a process releases a lock resource.
In one possible implementation, the processor may perform parameter analysis by using a processing function when the kernel package is started, and if the boot parameter is obtained, modify the kernel preemption global flag to a closed state according to the boot parameter, and not trigger preemption scheduling at the kernel preemption opportunity. Therefore, the method for modifying the kernel preemption global mark through the guide parameter is realized, and the preemption version of the kernel of the operating system is dynamically closed.
In one possible implementation, the processor may restart the kernel package with the kernel preemptive global flag restoring the default on state. And the processor analyzes parameters through the processing function, if the guide parameters are not acquired, the kernel preemption global mark is not modified, and preemption scheduling is triggered at the kernel preemption opportunity. Therefore, the method for recovering the kernel preemption global mark by restarting is realized, and the preemption version of the kernel of the operating system is dynamically started.
In summary, the kernel preemption switching method provided by the embodiment of the application can efficiently and conveniently switch the kernel versions, and solves the problem that the related technology cannot efficiently and conveniently switch the kernel versions.
Fig. 2 is a schematic flow chart of a first embodiment of a kernel preemption switching method according to an embodiment of the present application. Referring to fig. 2, the method for switching kernel preemption specifically includes the following steps:
Step S201: and starting a kernel program package, and configuring a kernel preemption global mark according to the guide parameter under the condition that the guide parameter is acquired.
In this embodiment, when the kernel package is started, the processor may acquire a boot parameter, and configure the kernel preemption global flag according to the boot parameter. The processor may be a central processing unit (Central Processing Unit, abbreviated as CPU) or a baseboard management controller (Baseboard Management Controller, abbreviated as BMC). Or the processor may be another type of controller running the linux operating system.
The kernel package is deployed in a server. The kernel program package comprises kernel configuration items, wherein the kernel configuration items can comprise a first kernel configuration item corresponding to the kernel preemption attribute and a second kernel configuration item corresponding to the dynamic closing preemption attribute.
The kernel preemption attribute may characterize whether the operating system kernel is in an on preemption version. The first kernel configuration item is in an open state, which indicates that the operating system kernel is in an open preemption version; and if the first kernel configuration item is in a closed state, indicating that the operating system kernel is in a preemptive version.
The dynamic close preemption attribute may characterize whether the operating system kernel may dynamically close the open preemption version. The second kernel configuration item is in an open state, which indicates that the operating system kernel can dynamically close the preemptive version; and if the second kernel configuration item is in a closed state, the kernel of the operating system cannot dynamically close the preemptive version.
In this embodiment, when the first kernel configuration item and the second kernel configuration item are both in an on state, the kernel of the operating system is indicated to be in an on preemption version, and the on preemption version can be dynamically closed, so that the kernel in this embodiment can dynamically open or close the kernel preemption attribute according to the need.
In a first possible embodiment, the processor may obtain the kernel start director uboot when starting the kernel package, and perform parameter parsing by the processing function to obtain the boot parameters. Specifically, the processor may read the parameter sequence cmdline in the kernel boot director uboot to parse the boot parameters from cmdline; and under the condition that the boot parameters are acquired, modifying the kernel preemption global mark according to the boot parameters.
The kernel preemption global flag may characterize the switch state of the kernel-on preemption version. The kernel preemption global mark is in an open state, which indicates that the preemption version of the operating system kernel is in the open state; and if the kernel preemption global mark is in a closed state, indicating that the open preemption version of the operating system kernel is in the closed state.
In one possible implementation, the kernel preemption global flag is stored in the kernel package, defaulting to an on state. When the processor acquires the guide parameters, the kernel preemption global mark is modified to be in a closed state; when the boot parameters are not acquired, the kernel preemption global flag is not modified. The pilot parameter may be "preempt _off".
Illustratively, if the processor modifies the kernel preemption global flag to an off state according to the boot parameters, the on preemption version of the operating system kernel is off and the operating system kernel is in a non-preemptive state.
In this embodiment, the processor may also modify the system information according to the boot parameters after modifying the kernel preemption global flag according to the boot parameters. Therefore, a user can know whether the current operating system kernel is in the on-preemption state or the off-preemption state when looking up the system information.
In a second possible implementation manner, the processor may acquire the kernel start instruction program uboot when starting the kernel package, and perform parameter analysis through the processing function, and if the boot parameter is not acquired, the kernel preemption global flag is not modified, that is, the kernel preemption global flag stores a default on state.
Step S202: under the target condition, according to a first kernel configuration item corresponding to the kernel preemption attribute, dynamically closing a second kernel configuration item corresponding to the preemption attribute and the kernel preemption global mark to determine whether to trigger scheduling, so that the high-priority task acquires the processor resource.
In this embodiment, the target conditions may include: when checking before the kernel interrupt exits, when triggering the kernel to display a calling program or when a process releases a lock resource.
In this embodiment, the core has a clock interrupt, and the processor needs to perform a check before the interrupt exits after the interrupt, so as to determine which process to enter for executing processing. When the kernel is in the preemption state, the processor can determine the version and the state of the kernel of the operating system according to the first kernel configuration item, the second kernel configuration item and the kernel preemption global mark when checking before the kernel interrupt exits, and further judge whether to trigger scheduling or execute a non-preemption flow to return to the original context.
Specifically, when the processor performs the check before the core interrupt exits, the processor triggers the scheduling when determining that the first core configuration item, the second core configuration item and the core preemption global flag are all in an on state and a high-priority task exists.
When the processor checks before the kernel interrupt exits, the processor triggers scheduling when determining that the first kernel configuration item is in an on state and the second kernel configuration item is in an off state and a high-priority task exists.
When the processor performs checking before the kernel interrupt exits, determining that the first kernel configuration item is in a closed state, namely, the operating system kernel is in a preemptive version; or when the kernel preemption global mark is determined to be in a closed state, namely the open preemption version of the operating system kernel is closed; or executing a non-preemptive process to return to the original context when it is determined that there is no high priority task.
In this embodiment, when the kernel is in a non-preemptive state, some processes may be executed in segments to avoid suspending hungtask tasks due to the long-term occupation of processor resources by those processes. Specifically, each time a section of process is executed, the kernel display calling program is executed, so that the process actively gives up processor resources, and system errors are avoided being caused, so that the non-preemptive kernel can stably run. When the processor triggers the kernel to display the calling program, the processor can determine the version and the state of the kernel of the operating system according to the first kernel configuration item, the second kernel configuration item and the kernel preemption global mark, and further judge whether to attempt preemption scheduling.
Specifically, when the processor triggers the kernel to display the calling program, the processor may trigger scheduling when determining that the first kernel configuration item is in an on state, the second kernel configuration item is in an on state, and the kernel preemption global flag is in an off state, so that other tasks to be scheduled may attempt preemption, so that the tasks to be scheduled may acquire processor resources.
When the processor triggers the kernel to display the calling program and determines that the first kernel configuration item is in a closed state, the processor can trigger scheduling, so that other tasks needing to be scheduled can attempt to preempt, and the tasks needing to be scheduled can acquire processor resources.
In this embodiment, some processes hold a lock resource at run-time that characterizes the process as locking the processor resource. When the process is completed, the process releases the lock resources, and further releases the processor resources occupied by the lock resources. When a process releases a lock resource, the processor may execute kernel-enabled preemption logic to attempt to trigger a dispatch process, if in a preempted state. The process may attempt to enable preemption when releasing the lock resources, and determine, according to the first kernel configuration item, the second kernel configuration item, and the kernel preemption global flag, whether scheduling should be triggered.
Specifically, when a process releases a lock resource, the processor determines that a first kernel configuration item is in an open state, the preemption count is 0, a second kernel configuration item is in an open state, and when a kernel preemption global flag is in an open state, or when the process releases the lock resource, the processor determines that the first kernel configuration item is in an open state, the preemption count is 0, and when the second kernel configuration item is in a closed state, scheduling is triggered.
And when the processor determines that the first kernel configuration item is in an open state and the preemption count is not 0 or determines that the kernel preemption global mark is in a closed state, executing a non-preemption flow.
In this embodiment, a kernel package is started, and under the condition that a boot parameter is obtained, a kernel preemption global flag is configured according to the boot parameter; when checking before the kernel interrupt exits, or when triggering the kernel to display a calling program, or when a process releases a lock resource, determining whether to trigger scheduling according to the first kernel configuration item, the second kernel configuration item and the kernel preemption global mark, so that a high-priority task acquires the processor resource. Compared with the related art, the method and the device can flexibly start and close the on-preemptive version of the kernel of the operating system by modifying the kernel preemptive global mark through the guide parameter, so that the kernel version switching is performed efficiently and conveniently, and the problem that the related art cannot perform the kernel version switching efficiently and conveniently is solved.
Fig. 3 is a schematic flow chart of a second embodiment of a kernel preemption switching method according to an embodiment of the present application. The target condition may be when a check before the core interrupt exits is made. The kernel has clock interruption, and the processor needs to check before the interruption exits after the interruption to judge which process is entered for executing the processing. When the kernel is in the preemption state, the processor can determine the version and the state of the kernel of the operating system according to the first kernel configuration item, the second kernel configuration item and the kernel preemption global mark when checking before the kernel interrupt exits, and further judge whether to trigger scheduling or return to the original context. Referring to fig. 3, the step S202 specifically includes the following steps:
step S301: when checking before the kernel interrupt exits, determining whether the first kernel configuration item is in an open state; if yes, go to step S302; if not, step S306 is performed.
In this embodiment, the processor may trigger the kernel interrupt every preset time, and check the kernel interrupt before ending. And when the processor performs the check before the kernel interrupt exits, determining whether a first kernel configuration item corresponding to the kernel preemption attribute is in an open state. Specifically, the processor may obtain the first kernel configuration item from the kernel package to determine whether the first kernel configuration item is in an on state.
The kernel preemption attribute may characterize whether the operating system kernel is in an on preemption version.
And if the first kernel configuration item is in an open state, indicating that the kernel of the operating system is in an open preemption version. When the processor determines that the first kernel configuration item is in the on state, the processor may further determine whether a second kernel configuration item corresponding to the dynamic off preemption attribute is in the on state.
And if the first kernel configuration item is in a closed state, indicating that the operating system kernel is in a preemptive version. And when the processor determines that the first kernel configuration item is in the closed state, the processor can jump to a non-preemptive flow without triggering scheduling.
Step S302: determining whether the second kernel configuration item is in an on state; if yes, go to step S303; if not, step S304 is performed.
In this embodiment, when determining that the first kernel configuration item is in the on state, the processor may determine whether the second kernel configuration item corresponding to the dynamic off preemption attribute is in the on state. Specifically, the processor may obtain the second kernel configuration item from the kernel package to determine whether the second kernel configuration item is in an on state.
The dynamic close preemption attribute may characterize whether the operating system kernel may dynamically close the open preemption version.
And if the second kernel configuration item is in an open state, the kernel of the operating system can dynamically close the preemptive version. The processor may further determine whether the core preemption global flag is on when determining that the second core configuration item is on.
And if the second kernel configuration item is in a closing state, indicating that the kernel of the operating system can not dynamically close the open preemption version, and enabling the kernel to be in the open preemption state all the time. The processor, upon determining that the second core configuration item is in the off state, may determine whether there are high priority tasks that require resource scheduling. Triggering scheduling when determining that a high-priority task exists, so that the high-priority task acquires processor resources; and when the high-priority task is determined not to exist, jumping to a non-preemptive flow, and not triggering scheduling.
Step S303: determining whether the kernel preemption global flag is in an on state; if yes, executing step S304; if not, step S306 is performed.
In this embodiment, the processor may determine, when determining that the second core configuration item is in the on state, whether the core preemption global flag is in the on state. Specifically, the processor may obtain the kernel preemptive global flag from the kernel package to determine whether the kernel preemptive global flag is in an on state.
And if the kernel preemption global mark is in an on state, indicating that the on preemption version of the kernel of the operating system is in the on state, and the kernel is in the on preemption state. The processor may determine whether there are high priority tasks that need to be scheduled for resources when it is determined that the kernel preemption global flag is on. Triggering scheduling when determining that a high-priority task exists, so that the high-priority task acquires processor resources; and when the high-priority task is determined not to exist, jumping to a non-preemptive flow, and not triggering scheduling.
And if the kernel preemption global mark is in a closing state, indicating that the open preemption version of the kernel of the operating system is in the closing state, and the kernel is in a non-preemption state. And when the processor determines that the kernel preemption global mark is in a closed state, the processor jumps to a non-preemption flow, and does not trigger scheduling.
Step S304: determining whether there is a high priority task, if so, executing step S305; if not, step S306 is performed.
In this embodiment, when determining that the first core configuration item is in an on state and the second core configuration item is in an off state, or when determining that the first core configuration item is in an on state, the second core configuration item is in an on state and the core preemption global flag is in an on state, the processor may determine that the core is in an on preemption state. The processor needs to determine whether there are high priority tasks in the kernel that need to be resource scheduled. If yes, triggering scheduling to enable the high-priority task to acquire processor resources; if not, jumping to a non-preemptive flow, and not triggering scheduling.
Step S305: triggering scheduling.
When the processor determines that the high-priority task needing to be subjected to resource scheduling exists in the kernel, triggering the current task to give up the processor resource, and triggering the high-priority task to preempt the processor resource.
Step S306: and jumping to a non-preemptive flow.
When the processor determines that the kernel is in a non-preemptive state or that the high-priority task needing to be subjected to resource scheduling does not exist in the kernel, the processor jumps to a non-preemptive flow, does not trigger scheduling, and enables the current task to continuously occupy the processor resource.
In this embodiment, when the processor performs the check before the core interrupt exits, the processor triggers the scheduling when it is determined that the first core configuration item, the second core configuration item, and the core preemption global flag are all in an on state, and a high priority task exists. Under the condition that the kernel of the operating system is in the preemptive version and the preemptive version can be dynamically closed, the preemptive version of the kernel of the operating system is kept in an open state by opening the kernel preemptive global mark, so that the effective scheduling of the processor resources is realized, and the high-priority tasks acquire the processor resources.
When the processor checks before the kernel interrupt exits, the processor triggers scheduling when determining that the first kernel configuration item is in an on state and the second kernel configuration item is in an off state and a high-priority task exists. Under the condition that the operating system kernel is in the preemptive version and the preemptive version cannot be dynamically closed, the preemptive version of the operating system kernel is kept in an open state, so that the effective scheduling of the processor resources is realized, and the high-priority tasks acquire the processor resources.
The processor executes a non-preemptive flow when determining that the first core configuration item is in a closed state, or when determining that the core preemptive global flag is in a closed state, or when determining that no high priority task exists, when performing a check before the core interrupt exits. The method can enable the operating system kernel to keep a non-preemptive state when the operating system kernel is in a preemptive-closing version or an preemptive-opening version of the operating system kernel is closed or the kernel does not have a high-priority task, and ensure that the current task continuously occupies processor resources for efficient execution.
Therefore, the embodiment realizes that when checking before the kernel interrupt exit, whether the scheduling is triggered or not is determined according to the first kernel configuration item, the second kernel configuration item and the kernel preemption global mark, so that the high-priority task acquires the processor resource. Therefore, the processor can be guaranteed to be in the preemption state, and when the processor performs the check before the interrupt exit of the core, the first core configuration item, the second core configuration item and the core preemption global mark are combined, flexible scheduling of processor resources is realized, and efficient and convenient execution of the service is guaranteed.
Fig. 4 is a schematic flow chart of a third embodiment of a kernel preemption switching method according to an embodiment of the present application. When the kernel is in a non-preempted state, some processes may be executed in segments to avoid suspending hungtask tasks due to the long-term occupation of processor resources by those processes. Specifically, each time a section of process is executed, the kernel display calling program is executed, so that the process actively gives up processor resources, and system errors are avoided being caused, so that the non-preemptive kernel can stably run. When the processor triggers the kernel to display the calling program, the processor can determine the version and the state of the kernel of the operating system according to the first kernel configuration item, the second kernel configuration item and the kernel preemption global mark, and further judge whether to attempt preemption scheduling. Referring to fig. 4, the step S202 specifically includes the following steps:
Step S401: when triggering the kernel display calling program, determining whether the first kernel configuration item is in an open state; if yes, go to step S402; if not, step S404 is performed.
In this embodiment, the processor may determine, when the kernel display calling program is triggered, whether the first kernel configuration item is in an on state. Specifically, the processor may obtain the first kernel configuration item from the kernel package to determine whether the first kernel configuration item is in an on state.
The kernel preemption attribute may characterize whether the operating system kernel is in an on preemption version.
And if the first kernel configuration item is in an open state, indicating that the kernel of the operating system is in an open preemption version. When the processor determines that the first kernel configuration item is in the on state, the processor may further determine whether a second kernel configuration item corresponding to the dynamic off preemption attribute is in the on state.
And if the first kernel configuration item is in a closed state, indicating that the operating system kernel is in a preemptive version. When the first kernel configuration item is in a closed state, the operating system kernel is in a non-preemptive state, and the processor triggers the kernel to display a calling program, so that processor resources are yielded, the processor can trigger scheduling, other tasks needing to be scheduled can attempt preemption, and the tasks needing to be scheduled can acquire the processor resources.
Step S402: determining whether the second kernel configuration item is in an on state; if yes, go to step S403; if not, the scheduling is not triggered.
In this embodiment, when determining that the first kernel configuration item is in the on state, the processor may determine whether the second kernel configuration item corresponding to the dynamic off preemption attribute is in the on state. Specifically, the processor may obtain the second kernel configuration item from the kernel package to determine whether the second kernel configuration item is in an on state.
The dynamic close preemption attribute may characterize whether the operating system kernel may dynamically close the open preemption version.
And if the second kernel configuration item is in an open state, the kernel of the operating system can dynamically close the preemptive version. The processor may further determine whether the core preemption global flag is in an off state when determining that the second core configuration item is in an on state.
And if the second kernel configuration item is in a closed state, the kernel of the operating system cannot dynamically close the preemptive version. When the first kernel configuration item is in an on state and the second kernel configuration item is in an off state, the kernel of the operating system is in an on preemption version and can not be dynamically closed, namely the kernel is in an on preemption state. The processor triggers the kernel to display that the calling program is only applicable to the kernel in a non-preemptive state, so that preemptive scheduling does not occur when the first kernel configuration item is in an on state and the second kernel configuration item is in an off state, and the processor does not trigger scheduling.
Step S403: determining whether the kernel preemption global flag is in an off state; if yes, go to step S404; if not, the scheduling is not triggered.
In this embodiment, the processor may determine whether the kernel preemption global flag is in an off state when determining that the first kernel configuration item is in an on state and the second kernel configuration item is in an on state. Specifically, the processor may obtain the kernel preemptive global flag from the kernel package to determine whether the kernel preemptive global flag is in an on state.
And if the kernel preemption global mark is in a closed state, indicating that the open preemption version of the operating system kernel is in the closed state. When the kernel preemption global mark is in a closed state, the kernel of the operating system is in a non-preemption state, and the processor triggers the kernel to display a calling program, so that processor resources are yielded, the processor can trigger scheduling, other tasks needing to be scheduled can attempt preemption, and the tasks needing to be scheduled can acquire the processor resources.
And if the kernel preemption global mark is in an on state, indicating that the preemption version of the kernel of the operating system is in the on state. The processor triggers the kernel to display that the calling program is only applicable to the kernel in a non-preemptive state, so that preemptive scheduling does not occur when the kernel preemptive global mark is in an on state, and the processor does not trigger scheduling.
Step S404: triggering scheduling.
In this embodiment, when the processor triggers the kernel to display the calling program, it may trigger scheduling when determining that the first kernel configuration item is in an on state, the second kernel configuration item is in an on state, and the kernel preemption global flag is in an off state, so that other tasks to be scheduled may attempt preemption, so that the tasks to be scheduled may acquire processor resources. Under the conditions that the kernel of the operating system is in an on-preempting version and the on-preempting version can be dynamically closed, the on-preempting version of the kernel of the operating system is kept in a closed state by closing the kernel preempting global mark, so that the process in a dormant state gives up the processor resource, the effective scheduling of the processor resource is realized, and other tasks needing to be scheduled acquire the processor resource.
When the processor triggers the kernel to display the calling program and determines that the first kernel configuration item is in a closed state, the processor can trigger scheduling, so that other tasks needing to be scheduled can attempt to preempt, and the tasks needing to be scheduled can acquire processor resources. Under the condition that the kernel of the operating system is in the preemptive version, the process in the dormant state can give out the processor resource, so that the effective scheduling of the processor resource is realized, and other tasks needing to be scheduled can acquire the processor resource.
Therefore, when the kernel display calling program is triggered, the processor can determine whether to trigger scheduling according to the first kernel configuration item, the second kernel configuration item and the kernel preemption global mark, so that the high-priority task can acquire processor resources. Therefore, when the kernel is in a non-preemptive state and the processor triggers the kernel to display a calling program, the first kernel configuration item, the second kernel configuration item and the kernel preemptive global mark are combined, flexible scheduling of processor resources is realized, and efficient and convenient execution of the service is ensured.
Fig. 5 is a schematic flow chart of a fourth embodiment of a kernel preemption switching method according to an embodiment of the present application. Some processes hold a lock resource at run-time that characterizes the process as locking the processor resource. When the process is completed, the process releases the lock resources, and further releases the processor resources occupied by the lock resources. When a process releases a lock resource, the processor may execute kernel-enabled preemption logic to attempt to trigger a dispatch process, if in a preempted state. The processor may attempt to enable preemption when the process releases the lock resources, and determine, based on the first core configuration item, the second core configuration item, and the core preemption global flag, whether scheduling should be triggered. Referring to fig. 5, the step S202 specifically includes the following steps:
step S501: when the process releases the lock resource and the first kernel configuration item is in an open state, determining whether the preemption count is 0; if yes, execute step S502; if not, step S505 is executed.
In this embodiment, when the process releases the lock resource, the processor may determine whether the first core configuration item is in an open state. The first kernel configuration item is in an on state, indicating that the operating system kernel is in an on preemption version. The first kernel configuration item is in a closed state, indicating that the operating system kernel is in a preemptive version. Specifically, the processor may obtain the first kernel configuration item from the kernel package to determine whether the first kernel configuration item is in an on state.
When the first kernel configuration item is determined to be in an on state, the operating system kernel is in an on preemption version, so that scheduling of resources released by the process can be attempted.
The preemption count characterizes the number of lock resources held by a process. The preemption count is decremented by 1 for each release of a lock resource by the process. When the preemption count is 0, the process is indicated to release all the lock resources held by the process, and all the processor resources occupied by the process are released for preemption of other tasks. Thus, the processor needs to first determine whether the preemption count is 0. And if the preemption count is not 0, indicating that the lock resource is not released in the process, and jumping to a non-preemption flow. And if the preemption count is 0, the lock resources are completely released by the process, and preemption scheduling can be performed.
Step S502: determining whether the second kernel configuration item is in an on state; if yes, go to step S503; if not, step S504 is performed.
In this embodiment, the processor may determine whether the second core configuration item is in an on state when determining that the preemption count is 0. And if the second kernel configuration item is in an open state, the kernel of the operating system can dynamically close the preemptive version. Specifically, the processor may obtain the second kernel configuration item from the kernel package to determine whether the second kernel configuration item is in an on state.
The processor may further determine whether the core preemption global flag is on when determining that the second core configuration item is on.
And if the second kernel configuration item is in a closed state, the kernel of the operating system cannot dynamically close the preemptive version. When the first kernel configuration item is in an open state and the second kernel configuration item is in a closed state, the operating system kernel is in an open preemption version and can not be closed dynamically, which means that the operating system kernel is always in the open state of the open preemption version, and the processing can schedule the resources released by the process.
Step S503: determining whether the kernel preemption global flag is in an on state; if yes, go to step S504; if not, step S505 is executed.
In this embodiment, when determining that the second core configuration item is in the on state, the processor may further determine whether the core preemption global flag is in the on state. Specifically, the processor may obtain the kernel preemptive global flag from the kernel package to determine whether the kernel preemptive global flag is in an on state.
And if the kernel preemption global mark is in an on state, indicating that the preemption version of the kernel of the operating system is in the on state. When the processor determines that the kernel preemption global mark is in an on state, the processor can trigger scheduling to schedule the resources released by the process.
And if the kernel preemption global mark is in a closed state, indicating that the open preemption version of the operating system kernel is in the closed state. And when the processor determines that the kernel preemption global mark is in a closed state, the processor jumps to a non-preemption flow.
Step S504: triggering scheduling.
When the processor determines that the process releases all the lock resources held by the process and the kernel is in an open preemption state, the processor triggers other tasks to be scheduled to preempt the processor resources released by the process.
Step S505: and jumping to a non-preemptive flow.
When the processor determines that the lock resources held by the process are not released completely or the kernel is in a non-preemptive state, the processor jumps to a non-preemptive flow, and does not trigger scheduling, so that the current task continues to occupy the processor resources.
In this embodiment, when the process releases the lock resource, the processor determines that the first kernel configuration item is in an open state, the preemption count is 0, the second kernel configuration item is in an open state, and when the kernel preemption global flag is in an open state, or when the process releases the lock resource, the processor determines that the first kernel configuration item is in an open state, the preemption count is 0, and when the second kernel configuration item is in a closed state, the processor triggers the scheduling. When all lock resources are released by the process, the operating system kernel is in the on-preemptive version, and the on-preemptive version of the operating system kernel can be kept in an on state by opening the kernel preemptive global mark under the condition that the on-preemptive version can be dynamically closed, so that the processor resources can be effectively scheduled, and other tasks needing to be scheduled can acquire the processor resources.
When the process releases the lock resource, the processor determines that the first kernel configuration item is in an open state, the preemption count is not 0, or when the processor determines that the kernel preemption global mark is in a closed state, the processor executes a non-preemption flow. When all lock resources are not released by the process or the open preemptive version of the operating system kernel is closed, the operating system kernel is kept in a non-preemptive state, and the current task is ensured to continuously occupy the processor resources for efficient execution.
Therefore, when the process releases the lock resource, whether the scheduling is triggered or not can be determined according to the first kernel configuration item, the second kernel configuration item and the kernel preemption global mark, and when the triggering scheduling is determined, the high-priority task can acquire the processor resource. Therefore, when the kernel is in the preemptive state and the process releases the lock resources, the first kernel configuration item, the second kernel configuration item and the kernel preemptive global mark are combined, flexible scheduling of the processor resources is realized, and efficient and convenient execution of the service is ensured.
Fig. 6 is a schematic structural diagram of a computing device according to an embodiment of the present application. As shown in fig. 6, the computing device 60 includes: a processor 61, a memory 62, and a communication interface 63; wherein the memory 62 is used for storing executable instructions of the processor 61; the processor 61 is configured to perform the technical solutions of any of the method embodiments described above via execution of executable instructions.
Alternatively, the memory 62 may be separate or integrated with the processor 61.
Optionally, when the memory 62 is a device separate from the processor 61, the computing device 60 may further include: bus 64 for connecting the above devices.
The computing device is configured to execute the technical scheme in any of the foregoing method embodiments, and its implementation principle and technical effects are similar, and are not described herein again.
Fig. 7 is a schematic structural diagram of another computing device according to an embodiment of the present application. As shown in fig. 7, the computing device 70 includes: a start module 71 and a processing module 72. The starting module 71 is configured to start the kernel package, and configure the kernel preemption global flag according to the boot parameters when the boot parameters are obtained; the processing module 72 is configured to dynamically close, under a target condition, a second kernel configuration item corresponding to the preemption attribute and the kernel preemption global flag according to the first kernel configuration item corresponding to the kernel preemption attribute, to determine whether to trigger scheduling, so that the high-priority task obtains the processor resource.
The computing device provided by the embodiment of the application can execute the technical scheme shown in the embodiment of the method, and the implementation principle and the beneficial effects are similar, and are not repeated here.
In one possible implementation, the processing module 72 is specifically configured to determine, when performing a check before the kernel interrupt exits, whether a first kernel configuration item corresponding to a kernel preemption attribute is in an on state, and determine, when determining that the first kernel configuration item is in an on state, whether a second kernel configuration item corresponding to a dynamic close preemption attribute is in an on state; when the second kernel configuration item is determined to be in an on state, determining whether the kernel preemption global mark is in the on state; and when the kernel preemption global mark is determined to be in an on state, determining whether a high-priority task exists, and triggering scheduling when the high-priority task is determined to exist.
In one possible embodiment, the processing module 72 is further configured to determine whether a high priority task is present when the second kernel configuration item is determined to be in an off state, and trigger scheduling when it is determined that a high priority task is present.
In one possible embodiment, the processing module 72 is further configured to jump to a non-preemptive flow upon determining that the first kernel configuration item is in an off state, or upon determining that the kernel preemptive global flag is in an off state, or upon determining that there is no high priority task.
The computing device provided by the embodiment of the application can execute the technical scheme shown in the embodiment of the method, and the implementation principle and the beneficial effects are similar, and are not repeated here.
In a possible implementation manner, the processing module 72 is specifically configured to determine, when the kernel display calling procedure is triggered, whether a first kernel configuration item corresponding to the kernel preemption attribute is in an on state, and determine, when the first kernel configuration item is determined to be in an on state, whether a second kernel configuration item corresponding to the dynamic closing preemption attribute is in an on state; when the second kernel configuration item is determined to be in an on state, determining whether the kernel preemption global mark is in an off state or not; triggering scheduling when the core preemption global flag is determined to be in a closed state.
In one possible embodiment, the processing module 72 is further configured to trigger scheduling upon determining that the first core configuration item is in an off state.
The computing device provided by the embodiment of the application can execute the technical scheme shown in the embodiment of the method, and the implementation principle and the beneficial effects are similar, and are not repeated here.
In one possible implementation, the processing module 72 is specifically configured to determine, when the process releases the lock resource and the first kernel configuration item corresponding to the kernel preemption attribute is in an on state, whether the preemption count is 0, and determine, when the preemption count is determined to be 0, whether the second kernel configuration item corresponding to the dynamic shutdown preemption attribute is in an on state; when the second kernel configuration item is determined to be in an on state, determining whether the kernel preemption global mark is in the on state; triggering scheduling when the kernel preemption global flag is determined to be in an on state.
In one possible embodiment, the processing module 72 is further configured to jump to a non-preemptive process upon determining that the preemption count is not 0, or upon determining that the kernel preemption global flag is off.
The computing device provided by the embodiment of the application can execute the technical scheme shown in the embodiment of the method, and the implementation principle and the beneficial effects are similar, and are not repeated here.
In one possible embodiment, the processing module 72 is further configured to modify the system information according to the boot parameters after modifying the kernel preemption global flag according to the boot parameters.
The computing device provided by the embodiment of the application can execute the technical scheme shown in the embodiment of the method, and the implementation principle and the beneficial effects are similar, and are not repeated here.
The embodiment of the application also provides a readable storage medium, on which a computer program is stored, which when executed by a processor implements the technical solution provided by any of the foregoing embodiments.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the embodiments of the present application, and are not limited thereto; although embodiments of the present application have 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 scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. The kernel preemption switching method is characterized by comprising the following steps of:
starting a kernel program package, and configuring a kernel preemption global mark according to a guide parameter under the condition that the guide parameter is acquired;
under the target condition, according to a first kernel configuration item corresponding to the kernel preemption attribute, dynamically closing a second kernel configuration item corresponding to the preemption attribute and the kernel preemption global mark to determine whether to trigger scheduling, so that the high-priority task obtains the processor resource.
2. The method for switching kernel preemption according to claim 1, wherein said dynamically closing a second kernel configuration item corresponding to a preemption attribute and the kernel preemption global flag to determine whether to trigger scheduling according to a first kernel configuration item corresponding to a kernel preemption attribute under a target condition comprises:
When checking before the kernel interrupt exits, determining whether a first kernel configuration item corresponding to a kernel preemption attribute is in an open state, and when determining that the first kernel configuration item is in the open state, determining whether a second kernel configuration item corresponding to a dynamic closing preemption attribute is in the open state;
when the second kernel configuration item is determined to be in an on state, determining whether the kernel preemption global mark is in the on state;
And when the kernel preemption global mark is determined to be in an on state, determining whether a high-priority task exists or not, and triggering scheduling when the high-priority task exists.
3. The kernel preemption switch method of claim 2, further comprising:
and when the second kernel configuration item is determined to be in a closed state, determining whether a high-priority task exists or not, and triggering scheduling when the high-priority task exists.
4. The kernel preemption switch method of claim 2, further comprising:
And when the first kernel configuration item is determined to be in a closed state, or the kernel preemption global mark is determined to be in a closed state, or no high-priority task is determined to exist, the process jumps to a non-preemption flow.
5. The method for switching kernel preemption according to claim 1, wherein said dynamically closing a second kernel configuration item corresponding to a preemption attribute and the kernel preemption global flag to determine whether to trigger scheduling according to a first kernel configuration item corresponding to a kernel preemption attribute under a target condition comprises:
When a kernel display calling program is triggered, determining whether a first kernel configuration item corresponding to a kernel preemption attribute is in an open state, and when the first kernel configuration item is in the open state, determining whether a second kernel configuration item corresponding to a dynamic closing preemption attribute is in the open state;
When the second kernel configuration item is determined to be in an on state, determining whether the kernel preemption global mark is in an off state or not;
Triggering scheduling when the kernel preemption global mark is determined to be in a closed state.
6. The kernel preemption switch method of claim 5, further comprising:
triggering scheduling when the first kernel configuration item is determined to be in a closed state.
7. The method for switching kernel preemption according to claim 1, wherein under the target condition, determining whether to trigger scheduling according to a first kernel configuration item corresponding to a kernel preemption attribute, and dynamically closing a second kernel configuration item corresponding to the preemption attribute and the kernel preemption global flag comprises:
When a process releases lock resources and a first kernel configuration item corresponding to a kernel preemption attribute is in an open state, determining whether preemption count is 0, and when the preemption count is 0, determining whether a second kernel configuration item corresponding to a dynamic closing preemption attribute is in an open state;
when the second kernel configuration item is determined to be in an on state, determining whether the kernel preemption global mark is in the on state;
triggering scheduling when the kernel preemption global mark is determined to be in an on state.
8. The kernel preemption switch method of claim 7, further comprising:
And when the preemption count is not 0 or the kernel preemption global mark is in a closed state, jumping to a non-preemption flow.
9. The kernel preemption switch method of claim 1, wherein after modifying a kernel preemption global flag according to the boot parameters, the method further comprises:
and modifying system information according to the guide parameters.
10. A computing device, comprising:
A processor, a memory, a communication interface;
The memory is used for storing executable instructions of the processor;
wherein the processor is configured to perform the kernel preemption handover method of any of claims 1-9 via execution of the executable instructions.
CN202410145520.5A 2024-02-01 2024-02-01 Kernel preemption switching method and computing device Pending CN118012612A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410145520.5A CN118012612A (en) 2024-02-01 2024-02-01 Kernel preemption switching method and computing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410145520.5A CN118012612A (en) 2024-02-01 2024-02-01 Kernel preemption switching method and computing device

Publications (1)

Publication Number Publication Date
CN118012612A true CN118012612A (en) 2024-05-10

Family

ID=90942357

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410145520.5A Pending CN118012612A (en) 2024-02-01 2024-02-01 Kernel preemption switching method and computing device

Country Status (1)

Country Link
CN (1) CN118012612A (en)

Similar Documents

Publication Publication Date Title
US9075692B2 (en) Method, device and system for activating on-line patch
Xu et al. A practical verification framework for preemptive OS kernels
US8161453B2 (en) Method and apparatus for implementing task management of computer operations
US7406699B2 (en) Enhanced runtime hosting
US8387075B1 (en) Common scheduling and synchronization primitives
EP2182438A1 (en) Virtual machine control method and virtual machine system
US20150169346A1 (en) Method for controlling a virtual machine and a virtual machine system
JP2004288162A (en) Operating system architecture using synchronous task
US20080244592A1 (en) Multitask processing device and method
CN112965794B (en) Algorithm calling method, electronic equipment and storage medium
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
US10761904B2 (en) Method and system for synchronizing and joining multiple calls to the same asynchronous code segment
CN113918336A (en) FreeRTOS task running method and device based on multi-core CPU
EP1820100B1 (en) Efficient switching between prioritized tasks
CN114327655A (en) Component initialization processing method and device and electronic equipment
CN118012612A (en) Kernel preemption switching method and computing device
CN110543395B (en) Verification method, verification device and related product
EP3688578B1 (en) Systems and methods defining thread specifications
CN112313620A (en) Android system starting method, device, equipment and storage medium
US9619277B2 (en) Computer with plurality of processors sharing process queue, and process dispatch processing method
Burns et al. Guide for the use of the Ada Ravenscar Profile in high-integrity systems
KR20190077235A (en) Semiconductor device
EP4276610A1 (en) Exception handling method and relevant apparatus
Craveiro Integration of generic operating systems in partitioned architectures
CN112486631B (en) Method for constructing virtual machine mirror image

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
TA01 Transfer of patent application right

Effective date of registration: 20240729

Address after: 450046, 10th Floor, North Chuangzhi Tiandi Building, Dongshigeng Street, Longzihu Wisdom Island Middle Road East, Zhengdong New District, Zhengzhou City, Henan Province

Applicant after: Henan Kunlun Technology Co.,Ltd.

Country or region after: China

Address before: 450000 Floor 9, building 1, Zhengshang Boya Plaza, Longzihu smart Island, Zhengdong New District, Zhengzhou City, Henan Province

Applicant before: xFusion Digital Technologies Co., Ltd.

Country or region before: China

TA01 Transfer of patent application right