Scheduling method of time-sharing partition operating system
By adopting two-level scheduling strategies in the time-sharing partition operating system, including partition scheduling and process scheduling, the problem of unclear system-level task scheduling is solved, the orderly operation of partitions and processes and the efficient utilization of system resources is achieved, and it is suitable for Key security areas.
Patent Information
- Application Number
- CN202411295064.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-15
- Publication Date
- 2024-11-29
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the time-sharing partitioned operating system, the scheduling problem of system-level tasks is not clearly specified, which makes it difficult to determine the assignment and scheduling of tasks, affecting the effective utilization of system resources.
Adopt a two-level scheduling strategy, including partition scheduling and process scheduling. The time window and partition order of each core are specified through the system scheduling table to ensure the orderly operation of partitions and processes, and introduce system partition management system-level tasks to make full use of processors. Free time for resources.
It realizes the certainty of the partition operation process and orderly operation of process priorities, improves the utilization rate of system resources, can quickly locate problem partitions, and is suitable for key security areas.
Smart Images

Figure CN119046013A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer software technology, and in particular to a scheduling method for a time-sharing and partitioned operating system. Background Art
[0002] A time-sharing partitioned operating system is a real-time operating system (RTOS) that divides the system time into multiple time slices (time sharing) and divides the system resources into multiple areas (partitions). Partitions can only run in the specified time slices, and the space of each partition is independent of each other and does not affect each other. A partition may contain multiple tasks, each task has its own resources and priority. Within the time slice of the partition, the partition will schedule the execution of tasks within the partition. This operating system structure can effectively improve the security of the system and is suitable for scenarios with high security requirements, such as the aerospace field.
[0003] In a time-sharing and partitioned operating system, a partition is the basic unit of scheduling and carries the business software developed by application vendors. The core attribute of a partition is the process, which is the basic unit of CPU execution. A partition can contain multiple processes. Partition operation actually refers to the operation of processes on the partition.
[0004] During system scheduling, there are some tasks that do not belong to any specific partition, but are indispensable in embedded systems, such as Shell tasks (used to obtain system information and debug), network protocol stack tasks, and disk background tasks (such as disk writeback). The ARINC 653 standard does not clearly define which partition these tasks should belong to and how to schedule them. Summary of the invention
[0005] The purpose of this application is to provide a scheduling method for a time-sharing and partitioned operating system to solve the technical problems raised in the above background technology.
[0006] To achieve the above-mentioned purpose, the present application discloses the following technical solutions: a scheduling method for a time-sharing and partitioned operating system, the method including partition scheduling and process scheduling;
[0007] The partition scheduling means executing the corresponding partition according to the system scheduling table, wherein the system scheduling table is used to specify the order in which each core executes the partition;
[0008] The process scheduling means executing the ready processes in the partition according to the priority;
[0009] The partition scheduling specifically includes:
[0010] The developer configures the system's scheduling table information in the system configuration file, wherein the scheduling table is provided with the scheduling plan of each core;
[0011] According to the configuration information of the scheduling table, a scheduling schedule module is created in the kernel, wherein the scheduling schedule module specifies the time window of each core;
[0012] During the partition execution process, partition scheduling is triggered;
[0013] When performing partition scheduling, the system schedule table is checked. Based on the current system time and the information in the system schedule table, it is analyzed whether the time is allocated. If the time is not allocated, the system will determine the system partition as the partition to be executed; if the time has been allocated, the system will determine the subsequent partition to be executed;
[0014] After determining the partition to be executed, the system saves the current partition context and then restores the context of the partition to be executed;
[0015] After the partition context switch is completed, the system executes the partition task and waits for subsequent scheduling requests.
[0016] Preferably, the triggering condition of the partition scheduling includes system activation or external event triggering.
[0017] Preferably, the external event trigger includes a timer interrupt.
[0018] Preferably, the process scheduling specifically includes:
[0019] The starting point of process scheduling is when the partition starts executing or when the process scheduling is triggered by an external event;
[0020] After the process starts scheduling, it analyzes whether there is a ready process in the ready table of the current running partition. If not, the system selects the ready process with the highest priority in the system partition as the process to be executed; if there is a ready process in the current running partition, the system schedules it according to the priority of the process and selects the process to be executed;
[0021] After selecting the process to be executed, the system saves the context of the process in the current partition runtime and switches to the scene of the process to be executed;
[0022] Start executing the process.
[0023] Preferably, the system is scheduled according to the priority of the process, specifically including:
[0024] The system selects a process with a higher priority than the currently running process as the process to be executed.
[0025] Beneficial effects: The scheduling method of the time-sharing partitioned operating system of the present application can not only determine the operation flow of the entire partition, but also ensure that the processes run in order according to priority. The processes of each partition are independent of each other and are not affected by each other. When a problem occurs, the problem partition can be quickly located, which is crucial in key security areas. At the same time, on the basis of two-level scheduling, system partition scheduling is introduced to make full use of the idle time of processor resources, which can effectively improve the utilization rate of system resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0027] Figure 1 A flowchart of the partition scheduling provided in the embodiment of the present application;
[0028] Figure 2 A schematic diagram of a partition scheduling table provided in an embodiment of the present application;
[0029] Figure 3 A flowchart of a process scheduling method provided in an embodiment of the present application;
[0030] Figure 4 An example of a scheduling table provided in an embodiment of the present application;
[0031] Figure 5 An example of a scheduling table module provided in an embodiment of the present application;
[0032] Figure 6 An example of system time printed in different partitions provided in an embodiment of the present application;
[0033] Figure 7 An example of system information provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] The technical solutions in the embodiments of the present application are described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0035] In this article, the term "comprising" is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, the elements defined by the sentence "comprising..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0036] In order to solve the problem of unclear affiliation of system-level tasks in time-sharing and partitioned operating systems and the problem of system-level task scheduling, this application cites the concept of "system partition" and abstracts system-level tasks into "system partitions". "System partitions" are responsible for managing system-level processes. Compared with ordinary partitions, system partition tasks do not have specific running times, while the running times of ordinary partition tasks are specified by the system schedule. Among them, the partition schedule specifies the time windows of each core (that is, a partition should be executed at a certain time). Figure 2 The following is a schedule table for a quad-core processor (distributed in Figure 2 The table in the upper part specifies the time window of Core 0, and the time line in the lower part indicates the time line of the core execution partition).
[0037] The scheduling method of the time-sharing partitioned operating system disclosed in this embodiment adopts a two-level scheduling overall strategy to ensure the determinism of the system, namely, partition scheduling and process scheduling. Partition scheduling means that the system executes the corresponding partition according to the scheduling table. The scheduling table of the operating system specifies the order in which each core executes the partition (in an execution cycle, the execution cycle is continuously cycled). At a certain moment, a specific partition must be executed.
[0038] The execution order of each application partition is strictly controlled through the scheduling table. Compared with the priority scheduling algorithm of the traditional time-sharing partition operating system, scheduling the execution of partitions according to the scheduling table is more controllable. When an error occurs in a partition, the error partition can be quickly located to ensure the determinism of the system.
[0039] Process scheduling will execute the ready processes in the partition according to their priority. Each partition may contain multiple processes, and process scheduling will select the ready process with the highest priority in the current partition for execution. If the priorities are the same, the FIFO rule will be followed. Process scheduling ensures that the high-priority ready tasks in the partition can be executed first, enhancing the controllability and real-time performance of the system.
[0040] After the operating system introduced the concept of "system partition", in order to solve the problems of system partition and system-level task scheduling, on the basis of two-level scheduling, the operating system will detect the unallocated time periods in the partition scheduling table and the partition idle time (that is, all tasks of the partition are in a non-ready state or there are no tasks available for scheduling in the current partition) for scheduling.
[0041] Specifically, in the scheduling method of the time-sharing and partitioning operating system of this embodiment, Figure 1 As shown in the figure, the specific process of partition scheduling includes:
[0042] (1) The developer configures the system's schedule information in the system configuration file. The schedule contains the schedule plans for each core (the schedule plan for each core includes the start time and duration of the partition assigned to the core, etc.);
[0043] (2) The operating system will create a scheduling table module in the kernel based on the configuration information of the scheduling table. The scheduling table module specifies the time window of each core, that is, the partition that should be executed at each moment;
[0044] (3) During the execution of the operating system partition, partition scheduling will be triggered (system activation or triggering of external events such as timer interrupts, etc.);
[0045] (4) When performing partition scheduling, the operating system will check the system schedule, analyze the current system time and the system schedule (which partition should be executed at this time), and analyze whether the time is allocated. If the time is not allocated, the system will determine the "system partition" as the partition to be executed; if the time has been allocated to a specific partition, the system will determine the subsequent partition to be executed;
[0046] (5) After determining the partition to be executed, the system will save the current partition context and then restore the scene of the partition to be executed;
[0047] (6) After the partition context switch is completed (system partition or ordinary partition), the partition switch is completed, the system executes the partition task, and waits for subsequent scheduling requests.
[0048] In the scheduling method of the time-sharing and partitioning operating system of this embodiment, Figure 3 As shown in the figure, the specific process of process scheduling includes:
[0049] (1) The starting point of process scheduling is when the partition starts executing or when an external event triggers the process scheduling (for example, setting the process priority, process sleep, etc. will cause the process to be rescheduled, interrupted, etc.);
[0050] (2) After the process starts to be scheduled, the operating system will analyze whether there is a ready process in the ready table of the current running partition. If not, the system will select the ready process with the highest priority in the "system partition" as the process to be executed; if there is a ready process in the current running partition, the system will schedule it according to the priority of the process (a high-priority process can preempt a low-priority process) and select the process to be executed;
[0051] (3) After the process to be executed is selected, the system will save the context of the process in the current partition runtime and switch to the scene of the process to be executed;
[0052] (4) Start executing the process.
[0053] The two-level scheduling mechanism of the operating system can not only determine the operation process of the entire partition, but also ensure that the processes run in order according to priority. The processes of each partition are independent of each other and are not affected by each other. When a problem occurs, the problematic partition can be quickly located, which is crucial in critical safety areas. At the same time, based on the two-level scheduling, the system partition scheduling is introduced. The operating system utilizes the idle time of the processor resources (this part of time is defined as system idling in the ARINC 653 specification), effectively improving the utilization of system resources.
[0054] In order to more clearly describe the technical solution described in this application, Matrix653 is used as the operating system and runs on the FT2004 platform (quad-core processor) for demonstration.
[0055] (1) Configure the schedule, such as Figure 4 As shown, in one cycle (200000000), the time intervals occupied by the two partitions in the scheduling table are [0, 100000000] (partition one) and [100000000, 200000000] (partition two), respectively, in nanoseconds.
[0056] (2) Start Matrix653, the system will create Figure 5 The schedule module shown.
[0057] (3) Each partition creates a process. After the partition is started, the process inside the partition will run. The process will print the current system time and then go into sleep. Figure 6 As shown, Figure 6 To print the current system time in two partitions, it can be found that the timestamp printed by each partition is within the time window of the schedule table's own partition.
[0058] (4) At the same time, the "system partition" that is not assigned a time window can also run normally (see the schedule table above, Partition 0 is not assigned a time window). You can use the Shell command to view the current system information (ls to view the files and directories under the current root directory, Matrix653 Partition 0 is the "system partition"). The system information is as follows: Figure 7 shown.
[0059] Based on the above, it can be seen that the technical solution provided by this embodiment has the following advantages:
[0060] (1) The partition operation window is controllable, and partition problems can be quickly located;
[0061] (2) Process scheduling within a partition ensures that processes run according to priority;
[0062] (3) Make full use of CPU idle time to improve the utilization of system resources.
[0063] In the embodiments provided in the present application, it should be understood that part or all of the processes of the embodiments can be completed by instructing the relevant hardware through a computer program. When implemented, the above-mentioned program can be stored in a computer-readable storage medium or transmitted as one or more instructions or codes on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein the communication media include any medium that is convenient for transmitting a computer program from one place to another. The storage medium can be any available medium that a computer can access. Computer-readable storage media can include but are not limited to RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer.
[0064] Finally, it should be noted that the above is only a preferred embodiment of the present application and is not intended to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A scheduling method for a time-sharing and partitioned operating system, characterized in that: The method includes partition scheduling and process scheduling; The partition scheduling means executing the corresponding partition according to the system scheduling table, wherein the system scheduling table is used to specify the order in which each core executes the partition; The process scheduling means executing the ready processes in the partition according to the priority; The partition scheduling specifically includes: The developer configures the system's scheduling table information in the system configuration file, wherein the scheduling table is provided with the scheduling plan of each core; According to the configuration information of the scheduling table, a scheduling schedule module is created in the kernel, wherein the scheduling schedule module specifies the time window of each core; During the partition execution process, partition scheduling is triggered; When performing partition scheduling, the system schedule table is checked. Based on the current system time and the information in the system schedule table, it is analyzed whether the time is allocated. If the time is not allocated, the system will determine the system partition as the partition to be executed; if the time has been allocated, the system will determine the subsequent partition to be executed; After determining the partition to be executed, the system saves the current partition context and then restores the context of the partition to be executed; After the partition context switch is completed, the system executes the partition task and waits for subsequent scheduling requests.
2. The scheduling method of the time-sharing and partitioning operating system according to claim 1, characterized in that: The triggering condition of the partition scheduling includes system activation or external event triggering.
3. The scheduling method of the time-sharing and partitioning operating system according to claim 2, characterized in that: The external event trigger includes a timer interrupt.
4. The scheduling method for a time-sharing and partitioned operating system according to claim 1, characterized in that: The process scheduling specifically includes: The starting point of process scheduling is when the partition starts executing or when the process scheduling is triggered by an external event; After the process starts scheduling, it analyzes whether there is a ready process in the ready table of the current running partition. If not, the system selects the ready process with the highest priority in the system partition as the process to be executed; if there is a ready process in the current running partition, the system schedules it according to the priority of the process and selects the process to be executed; After selecting the process to be executed, the system saves the context of the process in the current partition runtime and switches to the scene of the process to be executed; Start executing the process.
5. The scheduling method for a time-sharing and partitioned operating system according to claim 4, characterized in that: The system is scheduled according to the priority of the process, specifically including: The system selects a process with a higher priority than the currently running process as the process to be executed.
Citation Information
Patent Citations
Partition scheduling method based on two-stage operating system structure
CN104375893A
Subarea dispatching method
CN106681812A
Virtual ARINC 653 simulation verification platform
CN111813522A
