Linux interactive process calling system and operation method thereof

By introducing a deterministic rules engine and a sys file system in the Linux kernel, the problem that existing schedulers cannot implement deterministic scheduling is solved, and deterministic control of processes and dynamic policy management are realized.

CN120256060APending Publication Date: 2025-07-04北京中关村实验室 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510426759.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The scheduler of the existing Linux kernel cannot implement deterministic scheduling control of processes and cannot meet the requirements of strict priority or avoiding scheduling in some scenarios.

Method used

By introducing a deterministic rule engine and a sys file system in the cfs scheduler, a prohibition policy and a priority policy are provided to achieve deterministic scheduling control of the process.

Benefits of technology

Deterministic scheduling control of processes is realized, and scheduling policies can be dynamically managed according to user needs, supported custom policies, and monitored the process life cycle in real time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256060A_ABST
    Figure CN120256060A_ABST
Patent Text Reader

Abstract

The invention provides a Linux interactive process calling system. The Linux interactive process calling system comprises the following steps that S1, a deterministic rule engine and an sys file system are initialized and set for a Linux system; s2, when the cfs scheduler executes the scheduling switching process, traversing the whole process ready queue according to the existing scheduling strategy of the cfs; s3, the cfs scheduler selects a process from the process ready queue in sequence to serve as a process to be regulated and controlled; s4, if yes, directly jumping to S7; otherwise, indicating that there is a process for determining scheduling execution at present, and continuing S5; s5, the deterministic rule engine judges the process to be regulated and controlled by adopting the scheduling strategies one by one; s6, if the to-be-regulated process passes the judgment of each scheduling strategy, the cfs scheduler sets the to-be-regulated process as the next running process in sequence, and the S3 is returned; otherwise, skipping the process to be regulated and controlled, and returning to S3; and S7, scheduling and executing the idle process by the cfs scheduler.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Linux kernel process scheduling algorithm design. Specifically, it relates to a Linux interactive process call system that can provide deterministic process scheduling for users and its operation method. Background Art

[0002] A process is an important concept in modern operating systems and is an abstraction of tasks running on the operating system. Multiple processes can run simultaneously on an operating system. In most operating systems, a processor can only run one process at a time, and the number of processes is much larger than the number of processors. Therefore, how to select processes to run has become a difficult problem for operating systems to solve. For this reason, modern operating systems have designed schedulers to be responsible for coordinating the running of processes.

[0003] In the Linux system, processes and schedulers are still important components of the entire operating system, and different scheduler classes are abstracted from this to cope with different usage scenarios. The current Linux kernel scheduler natively supports five major classes, which are, in order of decreasing priority: stop, deadline, realtime, cfs, and idle. Each scheduler class has an independent process ready queue for storing process tasks waiting to run. When the scheduler executes a scheduling task, it traverses different scheduler classes in order of priority, from high to low. Only when the process ready queue corresponding to the current scheduler class is empty will it schedule tasks in the ready queue of the next priority scheduler class. Otherwise, it selects a task from the ready queue according to the scheduling policy of the current scheduler class and executes it.

[0004] In the Linux kernel, the stop and idle scheduling classes have no selectable scheduling policies because they are usually applied to special scenarios and are not provided for system users. The stop scheduling class has a high priority and can preempt any process. It is usually used for kernel tasks such as process migration and soft lock detection. The idle scheduling class has the lowest priority and is usually used to put the processor into a low-power mode when there are no other tasks to schedule in the system, and it can be preempted by other tasks at any time. The deadline scheduling class currently has only one scheduling policy, SCHED_DEADLINE, which is used to execute real-time tasks with strict time requirements. The realtime scheduling class contains two scheduling policies, SCHED_FIFO and SCHED_RR, which represent using the first-in-first-out and round-robin policies to schedule processes in the realtime ready queue respectively. CFS is the most commonly used scheduling class in Linux. It undertakes the scheduling of most user-mode processes in the system, including three scheduling policies: SCHED_NORMAL, SCHED_BATCH, and SCHED_IDLE. Among them, SCHED_BATCH is designed for non-interactive tasks, SCHED_IDLE runs only when there are no other tasks in the system, and the rest of the processes run under the SCHED_NORMAL scheduling policy.

[0005] Under the CFS scheduling class, processes in the ready queue are scheduled by tracking the virtual run time (vruntime) of all tasks. The smaller the vruntime of a task, the more it should use the processor. At the same time, Linux also supports users to set the static priority of tasks. The lower the numerical value of the priority, the higher the priority. And the vruntime of processes with higher priorities grows relatively slowly, so they are more likely to be scheduled for execution.

[0006] During the operation of the Linux system, the kernel switches processes frequently according to the scheduling policy. Therefore, there are extremely high requirements for the execution efficiency of the scheduler, which also results in the scheduler being unable to accept the scheduling requirements of system administrators and users in real time. However, the Linux kernel provides some mechanisms for users to convey scheduling requirements to the scheduler. 1) Scheduling classes and policies. As mentioned before, Linux supports different scheduling classes and policies. Users can select different scheduling policies for processes through the shell. 2) nice (priority). The nice value is the static priority of the process, ranging from -20 to 19. The smaller the nice value of the process, the easier it is to be scheduled. 3) CFS scheduling interface. CFS provides skip and next, which respectively mean prohibiting and preferentially selecting specified processes for scheduling.

[0007] Among the existing three mechanisms in Linux scheduling, by controlling the scheduling granularity through scheduling policies, only different scheduling policies can be selected for processes, and it is impossible to achieve fine-grained selection of processes in the ready queue. Although the nice value and the cfs scheduling interface can provide more fine-grained management, they can only provide best-effort scheduling control for users. Modifying the nice can adjust the execution priority of the process, but it cannot guarantee that a specific process in the ready queue will definitely be selected first or will definitely not be selected. The cfs scheduling interface provides the ability to skip specific threads in the ready queue and preferentially schedule specified threads, but the cfs scheduling interface cannot achieve scheduling control in the case of violating the cfs fairness policy, so deterministic scheduling cannot be achieved, and this interface also cannot manage multiple processes simultaneously.

[0008] The inventors found in application research that in some scenarios, it is necessary to provide deterministic process scheduling for operating system users rather than best-effort scheduling control. That is: strictly prioritize or avoid scheduling specific processes. However, the existing three scheduling policies in the Linux kernel cannot meet the above requirements. Through research on the Linux kernel, the inventors found that by adding a policy engine to the process selection module of the existing cfs scheduler, it is possible to achieve deterministic execution of the scheduling policies specified by users, and through the Linux system sys file system, an interactive control interface can be implemented to provide users with a deterministic process scheduling effect. Summary of the Invention

[0009] In view of the above technical problems in the related art, the present disclosure proposes a Linux process interactive scheduling control method, which can overcome the above-mentioned deficiencies existing in the prior art.

[0010] To achieve the above technical objectives, the technical solution of the present disclosure is realized as follows: The first objective of the present disclosure is to provide a Linux interactive process call system, including a deterministic rule engine and a sys file system; The deterministic rule engine includes several scheduling policies including a prohibition policy and a priority policy; the sys file system includes several file interfaces including a prohibition policy interface and a priority policy interface; each file interface and each scheduling policy are in a one-to-one correspondence relationship; The deterministic rule engine is connected to the cfs scheduler of the Linux system kernel, and the cfs scheduler is further connected to a process ready queue. The deterministic rule engine controls the application of each scheduling policy when the cfs scheduler performs scheduling; the cfs scheduler sets whether the process to be regulated will run subsequently based on the determination results of each scheduling policy for the process to be regulated --- that is, the cfs scheduler sets the processes to be regulated that have passed the determination of each scheduling policy as the next process to run in sequence; The sys file system is used for interacting with users and accepting scheduling control commands input by users through various file interfaces; the sys file system converts the scheduling control commands into corresponding scheduling policies and then adds the corresponding scheduling policies to the deterministic rule engine.

[0011] The operating method of the Linux interactive process call system provided by the second object of the present disclosure is characterized by including the following steps: S1: Initialize and set the deterministic rule engine and the sys file system for the Linux system respectively; S2: When the cfs scheduler executes scheduling to switch processes, it traverses the entire process ready queue according to the existing cfs scheduling policies in the Linux system; S3: The cfs scheduler sequentially selects a process from the process ready queue as the process to be regulated and judged currently; S4: If the process to be regulated is empty, it means that there are no more processes available for scheduling and execution currently, so directly jump to S7; otherwise, it means that there are processes available for judgment and scheduling currently, so continue with S5; S5: The deterministic rule engine adopts each scheduling policy one by one to judge the process to be regulated; S6: If the process to be regulated passes the judgment of each scheduling policy, the cfs scheduler sets the process to be regulated as the next process to run in sequence and returns to S3; otherwise, skip the process to be regulated and return to S3; S7: The cfs scheduler schedules and executes the idle process.

[0012] In this operating method: S1 is the preliminary initialization operation of the deterministic rule engine and the sys file system, enabling them to cooperate with the Linux system and the cfs scheduler. S2, S3, and S4 are the scheduling mechanisms of the existing Linux technology. S5 - S7 is the part that further improves the Linux scheduling mechanism in this operating method.

[0013] In S2 - S4, the cfs scheduler traverses and sequentially selects a process from the process ready queue according to its existing scheduling policies as the process to be regulated and judges whether it is a null value. If the process to be regulated is not a null value, it will enter S5; if the process to be regulated is empty, it means that the traversal has ended and there are no more processes available for scheduling currently, so the iteration ends and jumps to S7 to execute the idle process (idle state).

[0014] In S5, the deterministic rule engine officially intervenes in the determination of the process to be regulated, and determines each process to be regulated one by one through each scheduling policy in the deterministic rule engine. In S6, only if all scheduling policy determinations in the deterministic rule engine are passed, the process to be regulated will be regarded as passing the determination of the deterministic rule engine and will be allowed to be executed subsequently; the cfs scheduler sets the process to be regulated that has passed the determination of the deterministic rule engine as the next process to run, that is, adds it to the run queue in the Linux system; if the process to be regulated fails to pass the determination of the deterministic rule engine, it will be ignored and S3 will be returned to continue iteration.

[0015] Preferably, in the deterministic rule engine, scheduling functions corresponding to each scheduling policy are registered.

[0016] Preferably, when the deterministic rule engine determines the process to be regulated through each scheduling policy, the corresponding scheduling function will determine whether the process to be regulated meets the requirements of the scheduling policy; if it meets, it will pass; otherwise, it will not pass.

[0017] Preferably, in S3, the cfs scheduler selects a process in order from the process ready queue through the pick_next_entity() function.

[0018] Preferably, inside the pick_next_entity() function, the scheduling entity of the first process in the process ready queue is obtained through the __pick_first_entity() function, and the scheduling entities of the subsequent processes in the process ready queue are obtained in order through the __pick_next_entity() function, so as to realize that the cfs scheduler selects a process in order from the process ready queue.

[0019] Preferably, the deterministic rule engine supports adding custom scheduling policies by modifying Linux to implement the corresponding custom scheduling policies and registering them in the deterministic rule engine.

[0020] Preferably, the deterministic rule engine supports adding custom scheduling policies by accepting custom scheduling control commands input by the user through the file interface by the sys file system. The sys file system converts the custom scheduling control commands into custom scheduling policies and adds the custom policies to the deterministic rule engine.

[0021] Preferably, for the prohibition policy: a skip list is set, and the deterministic rule engine checks whether the scheduling entity of the process to be regulated exists in the skip list; If so, it will not pass; otherwise, it will pass. The deterministic rule engine can check the skip list through the check_skip() function. If the scheduling entity of the process to be regulated is in the skip list, it will not pass; otherwise, it will pass. During implementation, the skip list in the prohibition list can include multiple prohibited execution processes, and its content can be passed in through the user control interface of the prohibition policy.

[0022] Preferably, a priority policy: set a priority list (priority_list), and the priority list (priority_list) is used to maintain the priority order of processes in the current runnable queue; The deterministic rule engine checks whether the priority of the current process to be regulated exists in the priority list (priority_list) and is the same as the priority recorded in the priority list (priority_list); if so, it will pass; otherwise, it will not pass. The deterministic rule engine checks the priority list (priority_list) through the check_priority() function. The priority list (priority_list) is used to maintain the priority order of processes in the current runnable process queue. If the scheduling entity of the current process to be regulated does not meet the priority requirements, it will not pass; otherwise, it will pass. During implementation, the priority_list defines the priority of the process, and the specific priority can be passed in by the user through the user control interface corresponding to the priority policy.

[0023] Preferably, the sys file system will generate corresponding file interfaces for each scheduling policy, and the file interfaces include read and write functions.

[0024] Preferably, the user writes the corresponding process information to the file interface. The process information includes the process ID. Since the file interface has a one-to-one correspondence with the scheduling policy, the association relationship between the process represented by the process information and the scheduling policy is established, and then the corresponding scheduling policy is applied to the corresponding process.

[0025] Preferably, the read operation of the file interface returns the process information of all processes associated with the scheduling policy it maps.

[0026] Preferably, the read operation of the prohibition policy interface returns the process ID pid of all processes associated with the prohibition policy; writing the process ID pid to the prohibition policy interface will apply the prohibition policy to the process represented by the process ID pid.

[0027] Preferably, for the read operation of the priority policy interface, the process ID (pid) and priority of all processes associated with the priority policy are returned; by writing the combination of (pid, priority) through the priority policy interface, the priority policy is applied to the process represented by pid, and the priority priority is set for the process represented by pid.

[0028] Preferably, for the read and write operations of each file interface, the following sub-steps are performed: S2.1: The user fills in the input information into the file interface and verifies the user's permissions; if the user has permissions, continue with S2.2; otherwise, after prompting that the current user has no operation permissions, jump to S2.5; S2.2: Determine whether the input information is legal; if so, continue with S2.3; otherwise, jump to S2.5; S2.3: Determine whether the input information meets the requirements of the corresponding scheduling policy; if so, continue with S2.3; otherwise, jump to S2.5; S2.4: The user selects or fills in the process information, and associates the process represented by the process information with the scheduling policy corresponding to the file interface, so that the process represented by the process information can apply the scheduling policy corresponding to the file interface; S2.5: End the input operation.

[0029] Preferably, since there are a process ready queue and a process suspended queue in the Linux system, the processes in the process ready queue are in the ready state available for scheduling and execution, and the processes in the process suspended queue are in the non-ready state not available for scheduling and execution; therefore, the deterministic rule engine can be connected to the process ready queue and the process suspended queue respectively, monitor the process ready queue and the process suspended queue respectively, transfer the processes that resume the ready state in the process suspended queue to the process ready queue, transfer the processes that change to the non-ready state in the process ready queue to the process suspended queue, and remove the terminated processes in the process suspended queue and the process ready queue. During implementation, the deterministic rule engine can participate in the process life cycle monitoring mechanism of the Linux system in this way to achieve real-time monitoring of the process status in the Linux system. In this way, when the status of the process changes dynamically for various reasons, the deterministic rule engine can achieve real-time monitoring of the process status and perform corresponding operations. A notification function can also be set at the position where the process status changes to synchronize the process status information to the deterministic rule engine, and the deterministic rule engine can be set on the core path of the Linux scheduler to further enable the deterministic rule engine to participate in the process full life cycle monitoring mechanism, which can effectively prevent the policy from being applied to invalid processes and improve the execution efficiency of the policy engine.

[0030] Advantages of the present disclosure over the prior art: The present disclosure proposes a Linux interactive process call system and its operation method, which solves the problem that the existing scheduling control technology cannot achieve deterministic control. The present disclosure can perform scheduling control on processes in the Linux system through a deterministic scheduling policy engine according to the confirmed scheduling policy; it can also convert the user's scheduling control command into a confirmed scheduling policy through the user-interactive sys file system and add it to the deterministic scheduling policy engine, thereby realizing the dynamic management of the scheduling policy.

[0031] The present disclosure realizes the ability of deterministic Linux scheduling control, and realizes customized different scheduling policies through the deterministic scheduling policy engine; the deterministic scheduling policy engine and the sys file system cooperate with each other. Users can input scheduling control commands through the file interfaces of the sys file system. The sys file system converts the scheduling control commands into corresponding scheduling policies and adds them to the deterministic scheduling policy engine, realizing the association of processes to be regulated with different scheduling policies. The deterministic scheduling policy engine will apply the scheduling policy to the scheduler in real time to ensure its effectiveness for the process, thereby realizing the user's control of the process scheduling.

[0032] In the present disclosure: (A). Through a unique deterministic scheduling policy engine, by adding an additional policy management function module to the Linux scheduler, deterministic execution priority and prohibition and other controls for specific processes are realized for the Linux scheduler. (B). Through the sys file system as a policy management and query interface, a user- and system-interactive scheduling policy management solution is provided for users. Customers can easily manage each scheduling policy in the deterministic scheduling policy engine through convenient and easy-to-use scheduling control commands, and then realize the dynamic management of the process scheduling method. (C). The deterministic scheduling policy engine can configure a process life cycle monitoring mechanism, and can monitor the state changes of the process to realize the full life cycle monitoring of the process and perform corresponding control or recording operations on it. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings required for use in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0034] Figure 1 It is a schematic diagram of the cooperation between the Linux interactive process call system described in the present disclosure and the Linux system.

[0035] Figure 2Schematic diagram of the cooperation between the deterministic rule engine and the cfs scheduler described in this disclosure.

[0036] Figure 3 Schematic diagram of the step-by-step read and write operations of each of the file interfaces described in this disclosure. Detailed implementation manners

[0037] Next, the technical solutions in the embodiments of this disclosure will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this disclosure. Obviously, the described embodiments are only a part of the embodiments of this disclosure, rather than all the embodiments. Based on the embodiments in this disclosure, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of this disclosure.

[0038] As Figures 1-3 shown, for the convenience of understanding the above technical solutions of this disclosure, the above technical solutions of this disclosure will be described in detail below in terms of specific usage methods.

[0039] A first object of this disclosure is to provide a Linux interactive process call system, including a deterministic rule engine and a sys file system; The deterministic rule engine includes several scheduling policies including a prohibition policy and a priority policy; the sys file system includes several file interfaces including a prohibition policy interface and a priority policy interface; each file interface and each scheduling policy are in a one-to-one correspondence; The deterministic rule engine is connected to the cfs scheduler of the Linux system kernel, and the cfs scheduler is further connected to a process ready queue. The deterministic rule engine controls the cfs scheduler to apply each scheduling policy during scheduling; the cfs scheduler determines whether the process to be regulated will run next based on the determination results of each scheduling policy for the process to be regulated --- that is, the cfs scheduler sets the processes to be regulated that have passed the determination of each scheduling policy as the next process to run in sequence; The sys file system is used to interact with the user and accept the scheduling control commands input by the user through each file interface; the sys file system converts the scheduling control commands into corresponding scheduling policies, and then adds the corresponding scheduling policies to the deterministic rule engine.

[0040] A second object of this disclosure is to provide a running method of the Linux interactive process call system, which is characterized by including the following steps: S1: Initialize and set the deterministic rule engine and the sys file system for the Linux system respectively; S2: When the cfs scheduler performs scheduling to switch processes, it will traverse the entire process ready queue according to the existing cfs scheduling policies in the Linux system; S3: The CFS scheduler sequentially selects a process from the process ready queue as the process to be regulated and judged currently. S4: If the process to be regulated is empty, it indicates that there is no process available for scheduling and execution currently, so directly jump to S7; otherwise, it indicates that there are processes available for judging and scheduling, so continue with S5. S5: The deterministic rule engine sequentially adopts each scheduling policy to judge the process to be regulated. S6: If the process to be regulated passes the judgment of each scheduling policy, the CFS scheduler sequentially sets the process to be regulated as the next process to run and returns to S3; otherwise, skip the process to be regulated and return to S3. S7: The CFS scheduler schedules and executes the idle process.

[0041] In this operation method: S1 is the preliminary initialization operation of the deterministic rule engine and the sys file system, enabling them to work in cooperation with the Linux system and the CFS scheduler. S2, S3, and S4 are the scheduling mechanisms of the existing Linux technologies. S5 - S7 is the part that further improves the Linux scheduling mechanism in this operation method.

[0042] In S2 - S4, the CFS scheduler traverses and sequentially selects a process from the process ready queue according to its existing scheduling policy as the process to be regulated and judges whether it is a null value. If the process to be regulated is not a null value, it will enter S5; if the process to be regulated is empty, it indicates that the traversal has ended and there is no process available for scheduling currently, so the iteration ends and jumps to S7 to execute the idle process (idle state).

[0043] In S5, the deterministic rule engine officially intervenes in the judgment of the process to be regulated and sequentially judges the process to be regulated through each scheduling policy in the deterministic rule engine. In S6, only when the process to be regulated passes the judgment of all scheduling policies in the deterministic rule engine will the process to be regulated be regarded as passing the judgment of the deterministic rule engine and be allowed to be executed subsequently; the CFS scheduler sets the process to be regulated that has passed the judgment of the deterministic rule engine as the next process to run, that is, adds it to the run queue in the Linux system; if the process to be regulated does not pass the judgment of the deterministic rule engine, it will be ignored and return to S3 to continue the iteration.

[0044] In an embodiment, in the deterministic rule engine, scheduling functions corresponding to each scheduling policy are registered.

[0045] In an embodiment, when the deterministic rule engine judges the process to be regulated through each scheduling policy, the corresponding scheduling function will judge whether the process to be regulated meets the requirements of the scheduling policy; if it meets, it will pass; otherwise, it will not pass.

[0046] In a certain embodiment, in S3, the CFS scheduler selects a process in order from the process ready queue through the pick_next_entity() function.

[0047] In a certain embodiment, inside the pick_next_entity() function, the scheduling entity of the process ranked first in the process ready queue is obtained through the __pick_first_entity() function, and the scheduling entities of the subsequent processes in the process ready queue are sequentially obtained according to the ranking through the __pick_next_entity() function, so as to enable the CFS scheduler to select a process in order from the process ready queue.

[0048] In a certain embodiment, the deterministic rule engine supports adding custom scheduling policies, and corresponding custom scheduling policies are implemented and registered in the deterministic rule engine by modifying Linux.

[0049] In a certain embodiment, the deterministic rule engine supports adding custom scheduling policies. The sys file system accepts the custom scheduling control commands input by the user through the file interface. The sys file system converts the custom scheduling control commands into custom scheduling policies and adds the custom policies to the deterministic rule engine.

[0050] In a certain embodiment, the prohibition policy: Set the skip list. The deterministic rule engine checks whether the scheduling entity of the process to be regulated exists in the skip list; If so, it will not pass; otherwise, it will pass. The deterministic rule engine can check the skip list through the check_skip() function. If the scheduling entity of the process to be regulated is in the skip_list, it will not pass; otherwise, it will pass. During implementation, the skip list can include multiple processes prohibited from execution, and its content can be passed in through the user control interface of the prohibition policy.

[0051] In a certain embodiment, the priority policy: The priority list (priority_list), and the priority list (priority_list) is used to maintain the priority order of the processes in the current runnable queue; The deterministic rule engine checks whether the priority of the currently to-be-regulated process exists in the priority list (priority_list) and is the same as the priority recorded in the priority list (priority_list); if so, it passes; otherwise, it does not pass. The deterministic rule engine checks the priority list (priority_list) through the check_priority() function. The priority list (priority_list) is used to maintain the priority order of the processes in the current runnable process queue. If the scheduling entity of the currently to-be-regulated process does not meet the priority requirements, it does not pass; otherwise, it passes. During implementation, the priority_list defines the priority of the process, and the specific priority can be passed in by the user through the user control interface corresponding to the priority policy.

[0052] In a certain embodiment, corresponding file interfaces are generated for each scheduling policy in the sys file system, and the file interfaces include read and write functions.

[0053] In a certain embodiment, the user writes the corresponding process information to the file interface. The process information includes the process ID. Since there is a one-to-one correspondence between the file interface and the scheduling policy, the association relationship between the process represented by the process information and the scheduling policy is established, and then the corresponding scheduling policy is applied to the corresponding process.

[0054] In a certain embodiment, the read operation of the file interface returns the process information of all processes associated with the scheduling policy it maps.

[0055] In a certain embodiment, the read operation of the prohibition policy interface returns the process IDs pid of all processes associated with the prohibition policy; by writing the process ID pid to the prohibition policy interface, the prohibition policy is applied to the process represented by the process ID pid.

[0056] In a certain embodiment, the read operation of the priority policy interface returns the process ID pid and priority priority of all processes associated with the priority policy; by writing the combination of (pid, priority) to the priority policy interface, the priority policy is applied to the process represented by pid, and the priority priority is set for the process represented by pid.

[0057] In a certain embodiment, the read and write operations of each file interface are all performed in the following sub-steps: S2.1: The user fills in the input information in the file interface and verifies the user's permissions; if the user has permissions, continue with S2.2; otherwise, after prompting that the current user has no operation permissions, jump to S2.5; S2.2: Determine whether the input information is legal; if so, continue with S2.3; otherwise, jump to S2.5; S2.3: Determine whether the input information meets the requirements of the corresponding scheduling policy; if yes, continue with S2.3; otherwise, jump to S2.5; S2.4: Let the user select or fill in process information, and associate the process represented by the process information with the scheduling policy corresponding to the file interface, so that the process represented by the process information can apply the scheduling policy corresponding to the file interface; S2.5: End the input operation.

[0058] In an embodiment, since there are a process ready queue and a process suspended queue in the Linux system, each process in the process ready queue is in a ready state available for scheduling and execution, and each process in the process suspended queue is in a non-ready state not available for scheduling and execution. Therefore, the deterministic rule engine can be respectively connected to the process ready queue and the process suspended queue, monitor the process ready queue and the process suspended queue respectively, transfer the processes restored to the ready state in the process suspended queue to the process ready queue, transfer the processes changed to the non-ready state in the process ready queue to the process suspended queue, and remove the terminated processes in the process suspended queue and the process ready queue. During implementation, the deterministic rule engine can participate in the process life cycle monitoring mechanism of the Linux system in this way to achieve real-time monitoring of the process status in the Linux system. In this way, when the status of a process changes dynamically for various reasons, the deterministic rule engine can achieve real-time monitoring of the process status and perform corresponding operations. A notification function can also be set at the position where the process status changes to synchronize the process status information to the deterministic rule engine, and the deterministic rule engine can be set on the core path of the Linux scheduler, further enabling the deterministic rule engine to participate in the process full life cycle monitoring mechanism, which can effectively prevent the policy from being applied to invalid processes and improve the execution efficiency of the policy engine.

[0059] In summary, by means of the above technical solutions of the present disclosure, a Linux interactive process call system and its operation method are proposed, which solve the problem that the existing scheduling control technology cannot achieve deterministic control. In the present disclosure: (A). Through a unique deterministic scheduling policy engine, by adding an additional policy management function module to the Linux scheduler, deterministic execution priority, prohibition, etc. control of the Linux scheduler for specific processes is achieved. (B). Through the sys file system as a policy management and query interface, a user- and system-interactive scheduling policy management solution is provided for users. Customers can easily manage each scheduling policy in the deterministic scheduling policy engine through convenient and easy-to-use scheduling control commands, and then achieve dynamic management of the process scheduling method. (C). The deterministic scheduling policy engine can configure a process life cycle monitoring mechanism, and can achieve full life cycle monitoring of the process and perform corresponding control or recording operations by monitoring the change of the process status.

[0060] The above are only the preferred embodiments of the present disclosure and are not intended to limit the present disclosure. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present disclosure shall be included within the protection scope of the present disclosure.

Claims

1. A Linux interactive process calling system, characterized in that, It includes a deterministic rule engine and a sys file system; The deterministic rule engine includes several scheduling policies including a prohibition policy and a priority policy; the sys file system includes several file interfaces including a prohibition policy interface and a priority policy interface; each of the file interfaces and each of the scheduling policies have a one-to-one correspondence; The deterministic rule engine is connected to the cfs scheduler of the Linux system kernel, and the cfs scheduler is further connected to a process ready queue. The deterministic rule engine controls the cfs scheduler to apply each of the scheduling policies during scheduling; The cfs scheduler sets whether the process to be regulated will run next according to the determination results of each of the scheduling policies for the process to be regulated --- that is, the cfs scheduler sets the process to be regulated that has passed the determination of each of the scheduling policies as the next process to run in order; The sys file system is used to interact with the user and accept the scheduling control commands input by the user through each of the file interfaces; The sys file system converts the scheduling control commands into the corresponding scheduling policies, and then adds the corresponding scheduling policies to the deterministic rule engine.

2. The operating method of the Linux interactive process calling system according to claim 1, characterized in that It includes the following steps: S1: Initialize and set the deterministic rule engine and the sys file system for the Linux system respectively; S2: When the cfs scheduler executes scheduling to switch processes, it traverses the entire process ready queue according to the existing cfs scheduling policy in the Linux system; S3: The cfs scheduler sequentially selects a process from the process ready queue as the process to be regulated to be determined currently; S4: If the process to be regulated is empty, it means that there are no more processes available for scheduling and execution currently, so directly jump to S7; otherwise, it means that there are processes available for determination and scheduling currently, so continue with S5; S5: The deterministic rule engine sequentially uses each of the scheduling policies to determine the process to be regulated; S6: If the process to be regulated passes the determination of each of the scheduling policies, the cfs scheduler sets the process to be regulated as the next process to run in order and returns to S3; otherwise, skip the process to be regulated and return to S3; S7: The cfs scheduler schedules and executes the idle process.

3. The operating method according to claim 2, characterized in that, In the deterministic rule engine, scheduling functions corresponding to each of the scheduling policies are registered; When the deterministic rule engine determines the process to be regulated through each of the scheduling policies, the corresponding scheduling function will judge whether the process to be regulated meets the requirements of the scheduling policy; if it meets, it will pass; otherwise, it will not pass.

4. The operating method according to claim 2, characterized in that In S3, the cfs scheduler sequentially selects a process from the process ready queue through the pick_next_entity() function; Inside the pick_next_entity() function, the scheduling entity of the first - sorted process in the process ready queue is obtained through the __pick_first_entity() function, and the scheduling entities of subsequent processes in the process ready queue are sequentially obtained according to the sorting through the __pick_next_entity() function, so as to enable the cfs scheduler to select a process in order from the process ready queue.

5. The operating method according to claim 2, characterized in that The deterministic rule engine supports adding custom scheduling policies. By modifying Linux, the corresponding custom scheduling policies are implemented and registered into the deterministic rule engine. The deterministic rule engine supports adding custom scheduling policies. Users input custom scheduling control commands through the file interface of the sys file system. The sys file system converts the custom scheduling control commands into the custom scheduling policies and adds the custom policies to the deterministic rule engine.

6. The operating method according to claim 2, wherein The prohibition policy: Set the prohibition linked list skip_list. The deterministic rule engine checks whether the scheduling entity of the process to be regulated exists in the prohibition linked list skip_list. If so, it is not passed; otherwise, it is passed. The priority policy: Set the priority list priority_list. The priority list priority_list is used to maintain the priority order of processes in the current runnable queue. The deterministic rule engine checks whether the priority of the current process to be regulated exists in the priority list priority_list and is the same as the priority recorded in the priority list priority_list. If so, it is passed; otherwise, it is not passed.

7. The operation method according to claim 1, wherein Through the sys file system, corresponding file interfaces are generated for each of the scheduling policies. The file interfaces include read and write functions. Users write the corresponding process information, including the process ID, to the file interface. Since there is a one - to - one correspondence between the file interface and the scheduling policy, the association relationship between the process represented by the process information and the scheduling policy is established, and then the corresponding scheduling policy is applied to the corresponding process. The read operation of the file interface returns the process information of all processes associated with the scheduling policy it maps.

8. The running method according to claim 7, wherein The read operation of the prohibition policy interface returns the process IDs pid of all processes associated with the prohibition policy. By writing the process ID pid through the prohibition policy interface, the prohibition policy is applied to the process represented by the process ID pid. The read operation of the priority policy interface returns the process IDs pid and priorities priority of all processes associated with the priority policy. By writing the combination of (pid, priority) through the priority policy interface, the priority policy is applied to the process represented by pid, and the priority priority is set for the process represented by pid.

9. The control method according to claim 8, wherein For the read and write operations of each of the said file interfaces, the following sub-steps are executed: S2.1: The user fills in input information into the said file interface and verifies the user's permissions; if the user has the permissions, proceed to S2.2; otherwise, after prompting that the current user has no operation permissions, jump to S2.5; S2.2: Determine whether the input information is legal; if it is, proceed to S2.3; otherwise, jump to S2.5; S2.3: Determine whether the input information meets the requirements of the corresponding scheduling policy; if it does, proceed to S2.4; otherwise, jump to S2.5; S2.4: The user selects or fills in the said process information, and associates the process represented by the process information with the scheduling policy corresponding to the file interface, so that the process represented by the process information can apply the scheduling policy corresponding to the file interface; S2.5: End the input operation.

10. The running method according to claim 2, wherein The deterministic rule engine is respectively connected to the process ready queue and the process suspended queue in the Linux system, monitors the process ready queue and the process suspended queue respectively, transfers the processes that resume the ready state in the process suspended queue to the process ready queue, transfers the processes that change to the non-ready state in the process ready queue to the process suspended queue, and removes the terminated processes in the process suspended queue and the process ready queue.