Multi-task scheduling method, device and equipment for embedded time-sharing operating system and storage medium
By obtaining pending task information and real-time tasks for current limit, determining the status set of current limit task, and dynamically adjusting the task scheduling strategy, the problem of unreasonable task scheduling in the embedded time-sharing operating system is solved, and the real-time performance and the stability.
Patent Information
- Application Number
- CN202411340996.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-27
AI Technical Summary
The existing embedded time-sharing operating system is difficult to adapt to different task characteristics and system states in intelligent driving systems, resulting in unreasonable task scheduling and affecting the real-time and stability of the system.
By obtaining pending tasks information, including pending tasks and current limiting real-time tasks, determining the current limiting task status set, dynamically adjusting task scheduling strategies, optimizing processor scheduling efficiency, intelligently determining whether to limit real-time tasks to ensure timely real-time tasks Responsive and non-real-time tasks are properly scheduled.
It improves the CPU throughput and computing power, ensures the smooth operation of intelligent driving services, prevents system-level failures caused by individual tasks, and enhances the stability and reliability of the system.
Smart Images

Figure CN119201397A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of embedded system technology, and in particular to a multi-task scheduling method, device, equipment and storage medium for an embedded time-sharing operating system. Background Art
[0002] In intelligent assisted driving systems, embedded time-sharing operating systems play a vital role. They need to handle multiple real-time and non-real-time tasks at the same time, such as sensor data processing, decision making, vehicle control, etc. These tasks have different requirements for time sensitivity and processing efficiency. With the rapid development of intelligent driving technology, the number and complexity of tasks are increasing, which puts higher requirements on the multi-task scheduling capabilities of the operating system. Therefore, how to effectively schedule these tasks, ensure real-time performance and system stability, and improve CPU utilization has become a must-do task in the design of intelligent driving systems.
[0003] At present, the existing practice is to adopt priority-based scheduling strategies, such as round-robin scheduling, fixed priority scheduling, and dynamic priority scheduling. These methods assign a priority to each task, and the scheduler determines the execution order of tasks based on the priority. For example, real-time operating systems often use fixed priority scheduling to ensure that high-priority tasks can be processed in a timely manner. Time-sharing operating systems may use a time slice rotation method to assign a fixed time slice to each task to achieve fair scheduling between tasks.
[0004] However, the existing fixed priority scheduling may cause low-priority tasks to starve, that is, they will not get the opportunity to execute for a long time. Secondly, although round-robin scheduling is fair, it cannot guarantee the response time requirements of real-time tasks. In addition, as the number of tasks increases, the decision complexity of the scheduler increases, which may lead to scheduling delays. In the intelligent driving scenario, these methods may not fully consider the data dependencies and processing characteristics between tasks, resulting in unreasonable resource allocation and affecting the overall performance and stability of the system. Therefore, how to adaptively schedule multi-tasks in embedded time-sharing operating systems based on different task characteristics and system states has become an urgent problem to be solved.
[0005] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0006] The main purpose of the present application is to provide a method, device, equipment and storage medium for multi-task scheduling of an embedded time-sharing operating system, aiming to solve the technical problem of how to adaptively perform multi-task scheduling of an embedded time-sharing operating system based on different task characteristics and system states.
[0007] To achieve the above object, the present application proposes a multi-task scheduling method for an embedded time-sharing operating system, the method comprising:
[0008] Obtaining pending task information, wherein the pending task information includes pending tasks and current-limited real-time tasks;
[0009] Determine a current limiting task state set based on the pending task and the current limiting real-time task;
[0010] The system scheduling is controlled based on the tasks to be processed, the current-limited real-time tasks and the current-limited task state set to optimize the processor scheduling efficiency.
[0011] In one embodiment, the step of obtaining information of tasks to be processed includes:
[0012] Get task attribute information;
[0013] Performing data preprocessing based on the task attribute information to obtain a normalized value;
[0014] determining a real-time priority based on the normalized value;
[0015] Determine and obtain information about tasks to be processed based on the real-time priority.
[0016] In one embodiment, the step of obtaining task attribute information includes:
[0017] Obtaining task running feature codes, data flow dependency information, network delay information, scheduling delay information, external device transmission delay information, network bandwidth information, scheduling strategy information, scheduling priority information, intensive task operation delay information, intensive task transmission delay information, periodic task status information and periodic task time information;
[0018] Task attribute information is determined based on the task running feature code, the data flow dependency information, the network delay information, the scheduling delay information, the external device transmission delay information, the network bandwidth information, the scheduling policy information, the scheduling priority information, the intensive task operation delay information, the intensive task transmission delay information, the periodic task status information and the periodic task time information.
[0019] In one embodiment, the step of determining the current-limiting task state set based on the to-be-processed task and the current-limiting real-time task includes:
[0020] Determine a current-limiting task execution state set based on the pending task and the current-limiting real-time task;
[0021] Determine a task state set for releasing current limiting based on the current limiting task execution state set;
[0022] A current limiting task state set is obtained based on the current limiting task execution state set and the current limiting release task state set.
[0023] In one embodiment, the step of controlling system scheduling and optimizing processor scheduling efficiency based on the to-be-processed tasks, the current-limited real-time tasks, and the current-limited task state set comprises:
[0024] When the current limiting task execution state set in the current limiting task state set indicates that there is no current limiting task in the ready queue or the current limiting task release state set in the current limiting task state set indicates release failure, the control system enters an idle state;
[0025] When the current limiting task execution status set in the current limiting task status set indicates that there is a current limiting task in the ready queue and the current limiting task release status set in the current limiting task status set indicates that release is successful, the current limiting task is released based on the pending tasks and the current limiting real-time task control system to obtain the current limiting release real-time task and run the system task.
[0026] In one embodiment, the step of controlling the system based on the task to be processed and the current-limited real-time task to release the current-limited task, obtain the current-limited real-time task, and run the system task includes:
[0027] Acquire operation bandwidth information and a scheduling entity, wherein the operation bandwidth information includes a time period and an operation time limit period;
[0028] Obtaining a real-time task based on the to-be-processed task, the current-limited real-time task and the current-limit-released real-time task, and determining a real-time task running time based on the real-time task;
[0029] Initiate bandwidth control based on the scheduling entity, the time period and the run time limit period, and calculate the total actual run time in the real-time run queue;
[0030] Determine a timeout state set based on the real-time task running time and the total actual running time;
[0031] The system task execution is controlled based on the timeout status set.
[0032] In one embodiment, the step of controlling the execution of a system task based on the timeout state set comprises:
[0033] Get ready queue information;
[0034] When the timeout status set indicates that the actual running time is not higher than the real-time task running time, running the real-time task;
[0035] When the timeout status set is that the actual running time is higher than the real-time task running time, the system timer timeout module is triggered. If the ready queue information shows that there are pending tasks, the scheduling module will remove the real-time task from the ready queue, give priority to the pending tasks, and the current-limited real-time task will continue to be limited. If the ready queue information shows that there are no pending tasks, the ready queue running time will be recalculated, and the real-time task that is no longer limited will be added to the running queue to optimize the processor scheduling efficiency.
[0036] In addition, to achieve the above-mentioned purpose, the present application also proposes an embedded time-sharing operating system multi-task scheduling device, the embedded time-sharing operating system multi-task scheduling device comprising:
[0037] An acquisition module is used to acquire information of pending tasks, wherein the pending tasks include pending tasks and current-limited real-time tasks;
[0038] A processing module, used to determine a current limiting task state set based on the task to be processed and the current limiting real-time task;
[0039] An execution module is used to control system scheduling and optimize processor scheduling efficiency based on the tasks to be processed, the current-limited real-time tasks and the current-limited task state set.
[0040] In addition, to achieve the above-mentioned purpose, the present application also proposes an embedded time-sharing operating system multi-task scheduling device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the embedded time-sharing operating system multi-task scheduling method as described above.
[0041] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the embedded time-sharing operating system multi-task scheduling method as described above are implemented.
[0042] One or more technical solutions proposed in this application have at least the following technical effects:
[0043] The present application proposes a multi-task scheduling method for an embedded time-sharing operating system, which obtains pending task information, wherein the pending task information includes pending tasks and current-limited real-time tasks; determines a current-limited task state set based on the pending tasks and the current-limited real-time tasks; and controls system scheduling to optimize processor scheduling efficiency based on the pending tasks, the current-limited real-time tasks, and the current-limited task state set. The present application obtains pending tasks and current-limited real-time tasks, determines the state of the current-limited tasks based on the pending tasks and the current-limited real-time tasks, and thus dynamically adjusts the task scheduling strategy, thereby optimizing the multi-task scheduling of the embedded time-sharing operating system, and can intelligently determine whether it is necessary to limit the current of real-time tasks, especially to avoid unnecessary current limiting when the system is idle, thereby improving the throughput and computing power of the CPU, and through meticulous task attribute analysis and priority normalization processing, ensures the timely response of real-time tasks and the reasonable scheduling of non-real-time tasks, and ensures the smooth operation of intelligent driving services. In addition, by normalizing the priority management of key tasks, a comprehensive scheduling strategy is formed, which effectively prevents system-level failures caused by individual task anomalies, and ensures the stable and reliable operation of the entire intelligent driving system. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0045] 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0046] Figure 1 A flowchart diagram of a multi-task scheduling method for an embedded time-sharing operating system provided in Embodiment 1 of the present application;
[0047] Figure 2 A schematic diagram of a simplified process of a multi-task scheduling method for an embedded time-sharing operating system provided in an embodiment of the present application;
[0048] Figure 3 A schematic diagram summarizing normalized priorities of a multi-task scheduling method for an embedded time-sharing operating system provided in an embodiment of the present application;
[0049] Figure 4 A flowchart diagram of a second embodiment of a multi-task scheduling method for an embedded time-sharing operating system of the present application;
[0050] Figure 5This is a schematic diagram of the principle of the adaptive bandwidth scheduling module of the multi-task scheduling method of the embedded time-sharing operating system of this application;
[0051] Figure 6 This is a schematic diagram of the module structure of a multi-task scheduling device for an embedded time-sharing operating system according to an embodiment of the present application;
[0052] Figure 7 This is a schematic diagram of the device structure of the hardware operating environment involved in the embedded time-sharing operating system multi-task scheduling method in the embodiment of the present application.
[0053] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0054] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0055] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0056] The main solution of the embodiment of the present application is: obtaining information of pending tasks, wherein the pending task information includes pending tasks and current-limited real-time tasks; determining a current-limited task status set based on the pending tasks and the current-limited real-time tasks; and controlling system scheduling based on the pending tasks, the current-limited real-time tasks and the current-limited task status set to optimize processor scheduling efficiency.
[0057] In this embodiment, for the convenience of description, the following description is made by taking the identification of the embedded time-sharing operating system scheduler as the execution subject.
[0058] The existing fixed priority scheduling may cause low-priority tasks to starve, that is, they will not get the opportunity to execute for a long time. Secondly, although round-robin scheduling is fair, it cannot guarantee the response time requirements of real-time tasks. In addition, as the number of tasks increases, the decision complexity of the scheduler increases, which may lead to scheduling delays. In the intelligent driving scenario, these methods may not fully consider the data dependencies and processing characteristics between tasks, resulting in unreasonable resource allocation and affecting the overall performance and stability of the system.
[0059] The present application provides a solution to obtain information about pending tasks, wherein the pending task information includes pending tasks and current-limited real-time tasks; determine a current-limited task status set based on the pending tasks and the current-limited real-time tasks; and control system scheduling based on the pending tasks, the current-limited real-time tasks, and the current-limited task status set to optimize processor scheduling efficiency.
[0060] It can be seen from the above embodiments that the present application obtains pending tasks and current-limited real-time tasks, determines the status of the current-limited tasks based on the pending tasks and the current-limited real-time tasks, and thereby dynamically adjusts the task scheduling strategy, thereby optimizing the multi-task scheduling of the embedded time-sharing operating system, and can intelligently determine whether it is necessary to limit the current of real-time tasks, especially to avoid unnecessary current limiting when the system is idle, thereby improving the CPU throughput and computing power, and through detailed task attribute analysis and priority normalization processing, it ensures the timely response of real-time tasks and the reasonable scheduling of non-real-time tasks, and ensures the smooth operation of intelligent driving services. In addition, by normalizing the priority management of key tasks, a comprehensive scheduling strategy is formed, which effectively prevents system-level failures caused by individual task abnormalities and ensures the stable and reliable operation of the entire intelligent driving system.
[0061] Based on this, the embodiment of the present application provides a multi-task scheduling method for an embedded time-sharing operating system, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the multi-task scheduling method of the embedded time-sharing operating system of the present application.
[0062] In this embodiment, the embedded time-sharing operating system multi-task scheduling method includes steps S10 to S30:
[0063] Step S10, obtaining information of pending tasks, wherein the pending tasks information includes pending tasks and current-limited real-time tasks;
[0064] It should be noted that the pending tasks reflect the characteristics of the tasks that are about to be scheduled for execution in the system, including but not limited to the type of task, priority, required resources and estimated execution time, and the current-limited real-time tasks reflect the characteristics of tasks that are temporarily restricted from execution due to system resource limitations or priority adjustments.
[0065] It is understandable that if Figure 2 As shown, Figure 2A brief flow chart of the multi-task scheduling method of the embedded time-sharing operating system provided in the embodiment of the present application includes four core modules: a task attribute collection module, a normalized priority module, an adaptive bandwidth scheduling module, and a multi-core SOC scheduling dynamic monitoring module. The task attribute collection module is used to classify and collect real-car intelligent driving business applications in the form of a configuration file. The normalized priority module is used to normalize the priority according to the collected information. The normalized priority normalizes the priority of the pending tasks and the current-limited real-time tasks. The higher the normalization value, the higher the priority. The adaptive bandwidth scheduling module is used to enable the current core of the CPU to continuously run real-time tasks when there are only real-time tasks and no non-real-time tasks, to ensure the normal operation of real-time tasks. At the same time, it can enable the current core of the CPU to constrain the running time of real-time tasks when the running time of real-time tasks reaches the bandwidth limit when there are both real-time tasks and non-real-time tasks, so as to avoid the inability of non-real-time tasks to be executed. Ensure that the overall intelligent driving business module runs normally, and the multi-core SOC scheduling dynamic monitoring module is used to monitor and dynamically adjust task scheduling in a multi-core environment in real time.
[0066] In addition, it should be noted that if Figure 3 As shown, Figure 3 A schematic diagram of the normalized priority summary of the embedded time-sharing operating system multi-task scheduling method provided in the embodiment of the present application. For ordinary application tasks, the normalized value is set to 0-39, and the scheduling is fair scheduling, and the CPU is evenly distributed. In addition to ordinary tasks, other tasks are scheduled according to the system default scheduling method. For low-priority kernel ordinary threads, the normalized value is set to 40-41, which is suitable for tasks with higher priority than ordinary application tasks, including heterogeneous core communication threads, callback processing threads, and block device speed limit threads. For tasks with higher real-time requirements, the normalized value is set to 42-85, and the RR or FIFO scheduling strategy is adopted. At this time, the tasks with higher real-time requirements depend on the upstream and downstream data flow relationship of the previous module, and are interdependent tasks. The priority setting is consistent, and the CPU intensive Tasks that access the same memory resources are placed on the same CPU core. For kernel threads that need to be processed as quickly as possible, the normalized value is set to 86-89. This type of real-time requirement is lower than threaded interrupts, but needs to be higher than general real-time applications to prevent real-time applications from consuming the CPU for a long time without being processed. For fast processing and high-priority applications of intelligent driving services, the normalized value is set to 90-138. Priority tasks within this range can be executed periodically with a fast response time, that is, there will be no dead loops or long-term CPU consumption scenarios. Otherwise, threaded interrupts will not be processed in a timely manner, affecting the stability of the entire system. For key monitoring high-priority tasks, the normalized value is set to 139, which is mainly used by watchdog threads and load balancing threads. Such threads are responsible for monitoring the operating status of the entire system.
[0067] For ease of understanding, the example of obtaining information of tasks to be processed is used for explanation, wherein the information collection device is an information collection module, and the storage device is a memory.
[0068] The information collection module obtains the task running feature code, data flow dependency information, network delay information, scheduling delay information, external device transmission delay information, network bandwidth information, scheduling strategy information, scheduling priority information, intensive task operation delay information, intensive task transmission delay information, periodic task status information and periodic task time information, so as to determine the task attribute information, perform data preprocessing based on the task attribute information to obtain a normalized value, and determine the real-time priority based on the normalized value. If the normalized value is 0-39, the real-time priority is none, and the thread situation is the ordinary task priority, intelligent driving ordinary task, scheduling is fair scheduling, and CPU is evenly distributed. If the normalized value is 41, the real-time priority is 1, and the thread situation is that most low-priority kernel threads use this priority, which is suitable for tasks that just want to have a higher priority than ordinary tasks. If the normalized value is 42-85, the real-time priority is 2-45, and the thread situation is an intelligent driving task that can be used. The real-time task priority setting is a task priority range that requires higher real-time performance. If the normalized value is 86-89, the real-time priority is 46-49, and the thread situation is a kernel thread priority that needs to be processed as soon as possible, the real-time requirement is lower than the threaded interrupt, but needs to be higher than the real-time application to prevent the real-time application from consuming the CPU for a long time and not being processed. If the normalized value is 90-138, the real-time priority is 139, and the thread situation is a high-priority thread, the priority tasks within this range can be executed periodically with a fast response time, that is, there will be no dead loop or long-term CPU consumption scenario, otherwise it will cause the threaded interrupt to be processed in a timely manner. If the normalized value is 90-138, the real-time priority is 99, and the thread situation is used for watchdog threads and load balancing threads, the system's key threads need to run at a high priority, and the pending task information is obtained based on the real-time priority, and subsequent processing is performed based on the pending task information.
[0069] In a feasible implementation, step S10 may include steps A11 to A14:
[0070] Step A11, obtaining task attribute information;
[0071] It should be noted that the task attribute information reflects the characteristics of information collected by classifying real-vehicle intelligent driving business applications in the form of configuration files.
[0072] It is understandable that by analyzing task attribute information, the behavior and resource requirements of tasks can be predicted, so that optimization can be performed in advance, such as by adjusting the scheduling order of tasks, optimizing the execution time of tasks, etc., to improve the overall performance of the system.
[0073] In a feasible implementation, step A11 may include steps B11 to B12:
[0074] Step B11, obtaining task running feature codes, data flow dependency information, network delay information, scheduling delay information, external device transmission delay information, network bandwidth information, scheduling strategy information, scheduling priority information, intensive task operation delay information, intensive task transmission delay information, periodic task status information and periodic task time information;
[0075] It should be noted that the task running feature code reflects the characteristics of the unique identification of the task, the data flow dependency information reflects the characteristics of the dependency between tasks in data exchange, the network delay information reflects the characteristics of the delay encountered by the task during network communication, the scheduling delay information reflects the characteristics of the waiting time experienced by the task from submission to scheduling execution, the external device transmission delay information reflects the characteristics of the delay encountered by the external device when performing data transmission, the network bandwidth information reflects the characteristics of the task's demand for network bandwidth during execution, the scheduling strategy information reflects the characteristics of the algorithm or rule for task scheduling, the scheduling priority information reflects the characteristics of the priority of the task during scheduling, the intensive task operation delay information reflects the characteristics of the calculation delay generated by the intensive task during execution, the intensive task transmission delay information reflects the characteristics of the delay encountered by the intensive task during data transmission, the periodic task status information reflects the characteristics of the current status of the periodic task, and the periodic task time information reflects the characteristics of the execution cycle time of the periodic task.
[0076] Step B12, determining the task attribute information based on the task running feature code, the data flow dependency information, the network delay information, the scheduling delay information, the external device transmission delay information, the network bandwidth information, the scheduling policy information, the scheduling priority information, the intensive task operation delay information, the intensive task transmission delay information, the periodic task status information and the periodic task time information.
[0077] It can be understood that the task running feature code is used to distinguish different tasks, the data flow dependency information is used to control the order between the tasks scheduled by the scheduler, the network delay information is used to monitor the delays encountered by the task during network communication, the scheduling delay information is used to evaluate the efficiency and response speed of the scheduling system, the external device transmission delay information is the time for data to be transmitted to the sensor or received from the sensor, and is used to determine the delay required by the external device, the network bandwidth information is used to schedule network resources, the scheduling policy information is used for task scheduling policies, including fair scheduling, round-robin scheduling and priority scheduling, the scheduling priority information is used to determine the order in which tasks are scheduled for execution when resources are limited, the intensive task operation delay information is used by the scheduler to determine the task's demand for CPU resources, the intensive task transmission delay information is used by the scheduler to consider I / O resources when allocating resources, the periodic task status information is used by the scheduler to manage the execution plan of periodic tasks, and the periodic task time information is used by the scheduler to schedule the execution time of periodic tasks.
[0078] Step A12, performing data preprocessing based on the task attribute information to obtain a normalized value;
[0079] It should be noted that the normalized value reflects the relative priority of the task and the characteristics of resource requirements.
[0080] It can be understood that by performing data preprocessing and normalization processing on multiple attribute information of the task, a quantified value, ie, a normalized value, can be obtained, and the normalized value is used to determine the real-time priority of the task.
[0081] In addition, it should be noted that the normalized value can reflect the urgency of how quickly the task needs to be executed. A higher normalized value means that the task is more urgent and needs to be scheduled for execution as soon as possible. The normalized value can enable the scheduler to schedule tasks more accurately, optimize the scheduling efficiency of the processor, and meet the requirements of real-time and system stability.
[0082] Step A13, determining the real-time priority based on the normalized value;
[0083] It should be noted that the real-time priority reflects the scheduling priority of the task and the characteristics of its time sensitivity.
[0084] It can be understood that real-time priority can distinguish different types of real-time tasks, thereby determining the order in which tasks are executed. High-priority tasks will be scheduled for execution before low-priority tasks, ensuring that critical tasks are processed in a timely manner, thereby allowing the system to operate normally.
[0085] Step A14: obtaining information of tasks to be processed based on the real-time priority.
[0086] It should be noted that the to-be-processed task information reflects the characteristics of the tasks to be scheduled for execution in the system.
[0087] It can be understood that the system will select tasks from the pending task information and put them into the scheduling queue for execution according to the real-time priority of the tasks, ensuring that critical tasks are scheduled first while not neglecting those tasks that are not so time-critical, thereby improving the response speed and processing efficiency of the entire system and improving the performance and reliability of the embedded time-sharing operating system.
[0088] Step S20, determining a current limiting task state set based on the pending task and the current limiting real-time task;
[0089] It should be noted that the current limiting task state set reflects the characteristics of the system adjusting the current limiting task state.
[0090] It is understandable that based on the pending tasks and current-limiting tasks in the system, it can be determined whether the current-limiting task has the conditions for releasing the current limit. If conditions permit, the system will try to release the current limit of the current-limiting task. Subsequently, the system obtains the current-limiting release status, so that the system can dynamically adjust the current-limiting status of the task, optimize the scheduling efficiency of the processor, ensure the timely response of key tasks, and make full use of system resources, improve the flexibility of scheduling and the stability of the intelligent assisted driving system, prevent the system performance degradation caused by unreasonable resource allocation, and ensure the smooth operation and stability of the entire intelligent driving system.
[0091] For ease of understanding, the acquisition of the to-be-processed task and the current-limited real-time task is taken as an example for explanation, wherein the information collection device is an information collection module, the storage device is a memory, and the processing device is a processing module.
[0092] The information acquisition module obtains the pending tasks and the current-limiting real-time tasks and stores them in the memory, determines the current-limiting task execution status set based on the pending tasks and the current-limiting real-time tasks, releases the current limiting task based on the current-limiting task execution status set and determines the current-limiting task status set for releasing the current limiting task; when the current-limiting task execution status set in the current-limiting task status set is that there is no current-limiting task in the ready queue or the current-limiting task status set for releasing the current-limiting task in the current-limiting task status set is a release failure, the control system enters an idle state; when the current-limiting task execution status set in the current-limiting task status set is that there is a current-limiting task in the ready queue and the current-limiting task status set for releasing the current-limiting task in the current-limiting task status set is a release success, the control system releases the current limiting task based on the pending tasks and the current-limiting real-time tasks, obtains the current-limiting real-time task for releasing the current limiting, and runs the system tasks.
[0093] When the CPU is scheduling, it selects the next task to be executed. If the CPU has no executable tasks at this time, it checks whether there is a real-time task that is limited on the CPU. If there is no real-time task in a limited state on the CPU, it directly enters the idle state. If there is a real-time task in a limited state, it tries to release the limited state of the real-time task. If the release fails, the system directly enters the idle state. If the real-time task current limiting is released successfully, the task that has released the current limiting state will be re-added to the ready queue. The real-time task that has been released from the limited state will be selected for execution. If the system does not have a real-time task that is limited and there is no non-real-time task in the ready state, the CPU enters the idle state.
[0094] In a feasible implementation, step S20 may include steps C11 to C13:
[0095] Step C11, determining a current-limiting task execution state set based on the task to be processed and the current-limiting real-time task;
[0096] It should be noted that the current limiting task execution state set reflects the characteristics of the existence state of the current limiting tasks in the ready queue.
[0097] It can be understood that checking whether there is a current-limiting task in the ready queue and obtaining the execution status set of the current-limiting task indicates that the current-limiting task exists, thereby trying to release the current limiting of the current-limiting task, ensuring the reasonable allocation of system resources and the effectiveness of task scheduling.
[0098] Step C12, releasing the current limiting task current limiting based on the current limiting task execution status set and determining the current limiting task status set;
[0099] It should be noted that the current limiting release task state set reflects the characteristics of the current limiting release state of the current limiting task.
[0100] It is understandable that the system resources, such as CPU time and memory, are checked to determine whether they are sufficient to support the execution of the current limiting task. If the system determines that the current limiting task has the execution conditions, such as sufficient resources and appropriate task priority, a current limiting task status set will be obtained, indicating that the current limiting task can be released and is ready to be executed, thereby ensuring the timely execution of the current limiting task.
[0101] Step C13, obtaining a current limiting task state set based on the current limiting task execution state set and the current limiting release task state set.
[0102] It should be noted that the current limiting task state set reflects the characteristics of determining the current limiting task state in combination with the current limiting task execution state set and the current limiting task release state set.
[0103] It can be understood that by comprehensively considering the current task status and resource status of the system, the timely execution of real-time tasks is guaranteed, thereby improving the performance and stability of the entire embedded time-sharing operating system.
[0104] Step S30, controlling system scheduling to optimize processor scheduling efficiency based on the tasks to be processed, the current-limited real-time tasks and the current-limited task state set.
[0105] It can be understood that the scheduling strategy can be dynamically adjusted based on the pending tasks, the current-limited real-time tasks and the current-limited task status set to adapt to various changes in the system, such as the sudden increase of tasks or the temporary release of resources, so that the system can respond more flexibly to various emergencies and maintain the stability and efficiency of the system.
[0106] For ease of understanding, the acquisition of the pending tasks, the current limiting real-time tasks and the current limiting task status set is taken as an example for explanation, wherein the information collection device is an information collection module, the storage device is a memory, and the execution device is an execution module.
[0107] The information acquisition module obtains the pending tasks, the current-limiting real-time tasks and the current-limiting task status set and stores them in the memory. When the current-limiting task execution status set in the current-limiting task status set is that there is no current-limiting task in the ready queue or the current-limiting task release status set in the current-limiting task status set is a release failure, the control system enters an idle state; when the current-limiting task execution status set in the current-limiting task status set is that there is a current-limiting task in the ready queue and the current-limiting task release status set in the current-limiting task status set is a release success, based on the pending tasks and the current-limiting real-time tasks, the control system releases the current-limiting task, obtains the current-limiting real-time task, and runs the system tasks.
[0108] The embedded time-sharing operating system multi-task scheduling method proposed in this embodiment obtains pending task information, wherein the pending task information includes pending tasks and current-limited real-time tasks; determines the current-limited task status set based on the pending tasks and the current-limited real-time tasks; and controls system scheduling based on the pending tasks, the current-limited real-time tasks, and the current-limited task status set to optimize the processor scheduling efficiency. The technical problem of how to adaptively perform multi-task scheduling based on different task characteristics and system states is solved. Compared with the prior art, the present application obtains pending task information, including pending tasks and current-limited real-time tasks, and determines the current-limited task status, thereby dynamically adjusting task priorities and resource allocation, thereby optimizing the multi-task scheduling of the embedded time-sharing operating system, effectively improving the processor scheduling efficiency, ensuring the rapid response of real-time tasks and the rational use of system resources, and thus enhancing the stability and performance of the intelligent assisted driving system.
[0109] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction and will not be repeated later.
[0110] In this embodiment, refer to Figure 4 , Figure 4 This is a flow chart of the second embodiment of the multi-task scheduling method for an embedded time-sharing operating system of the present application, wherein step S30 specifically includes steps S31 to S32:
[0111] Step S31, when the current limiting task execution state set in the current limiting task state set indicates that there is no current limiting task in the ready queue or the current limiting task release state set in the current limiting task state set indicates release failure, the control system enters an idle state;
[0112] It is understandable that the ready queue is checked to determine the state of the current-limited task. If there is no current-limited task to be executed in the ready queue, or there is a current-limited task but the attempt to release the current-limited task fails, the system will put the processor in an idle state to reduce unnecessary energy consumption and reserve resources for possible emergency tasks. In the idle state, the system will still maintain the ability to respond to external events so that the scheduling and execution of tasks can be quickly resumed when the task conditions are met or resources are available.
[0113] For ease of understanding, the acquisition of the current limiting task execution status set and the current limiting release task status set is taken as an example for explanation, wherein the information collection device is an information collection module, the storage device is a memory, and the execution device is an execution module.
[0114] The information acquisition module obtains the pending tasks, the current limiting real-time tasks and the current limiting task status set and stores them in the memory. When the current limiting task execution status set in the current limiting task status set is that there is no current limiting task in the ready queue or the current limiting task release status set in the current limiting task status set is release failure, the control system enters an idle state.
[0115] Step S32, when the current limiting task execution status set in the current limiting task status set is that there is a current limiting task in the ready queue and the current limiting task release status set in the current limiting task status set is release success, based on the pending tasks and the current limiting real-time task control system releases the current limiting task, obtains the current limiting release real-time task, and runs the system task.
[0116] It should be noted that if Figure 5 As shown, Figure 5This is a schematic diagram of the principle of the adaptive bandwidth scheduling module of the multi-task scheduling method of the embedded time-sharing operating system of this application. The bandwidth control is started, the real-time task scheduling cycle and the real-time task running time are obtained in advance, the bandwidth control is started, the total actual running time in the real-time running queue is calculated, and it is determined whether the total actual running time is greater than the real-time task running time, so as to dynamically control the system to release the current limiting task, obtain the real-time task that releases the current limiting, and run the system task.
[0117] For ease of understanding, the acquisition of the current limiting task execution status set and the current limiting release task status set is taken as an example for explanation, wherein the information collection device is an information collection module, the storage device is a memory, and the execution device is an execution module.
[0118] The information acquisition module obtains the pending tasks, the current-limiting real-time tasks and the current-limiting task status set and stores them in the memory. When the current-limiting task execution status set in the current-limiting task status set is that there is no current-limiting task in the ready queue or the current-limiting task release status set in the current-limiting task status set is a release failure, the control system enters an idle state; when the current-limiting task execution status set in the current-limiting task status set is that there is a current-limiting task in the ready queue and the current-limiting task release status set in the current-limiting task status set is a release success, based on the pending tasks and the current-limiting real-time tasks, the control system releases the current-limiting task, obtains the current-limiting real-time task, and runs the system tasks.
[0119] Initialize the running bandwidth and high-precision timer, set the time period and running time limit period to the default values for the system module to call, and implement the execution module when the timer expires. At the same time, trigger the timer work, determine the current process scheduling class, traverse the scheduling entities of this real-time process, add the RT scheduling entity to the scheduling work queue, start bandwidth control, set the real-time task running time rt_runtime and the real-time task scheduling period rt_period, calculate the total actual running time in the real-time running queue, and determine whether the actual running time is greater than the real-time task running time. If not, continue to run the real-time task. If it is greater, trigger the timer timeout module. At this time, determine whether there are ordinary scheduling tasks to be executed in the CPU ready queue. If so, the scheduling module will remove the real-time task from the CPU ready queue, give priority to ordinary tasks, and the RT task will continue to be limited. If there is no ordinary scheduling task, recalculate the RT queue running time and add it to the running queue so that the RT task is not affected by the limited flow and improve CPU utilization.
[0120] In a feasible implementation, step S32 may include steps D11 to D15:
[0121] Step D11, obtaining operating bandwidth information and a scheduling entity, wherein the operating bandwidth information includes a time period and an operating time limit period;
[0122] It should be noted that the operating bandwidth information reflects the characteristics of the amount of network resources for task execution, and the scheduling entity reflects the characteristics of the logical or physical unit scheduled by the scheduler.
[0123] It can be understood that the running bandwidth information includes the running time period and the running time limit period, which determines the maximum amount and maximum time of network resources that a task can use within a specific time, so that the system can reasonably allocate network resources, avoid network congestion and data transmission delays, and ensure that tasks can exchange data efficiently and stably. Scheduling entities include threads, processes or CPU cores, which affect the allocation, execution order and execution efficiency of tasks.
[0124] Step D12, obtaining a real-time task based on the to-be-processed task, the current-limited real-time task and the current-limited released real-time task, and determining a real-time task running time based on the real-time task;
[0125] It should be noted that the real-time task running time reflects the characteristics of the time when the task needs to be executed within a specific time.
[0126] It is understandable that the real-time task running time can complete its execution cycle according to the predetermined time requirements. It is crucial to ensure the timely response of the real-time task and the overall performance of the system. By determining the real-time task running time, the scheduler can make task scheduling decisions more accurately, optimize the allocation of processor resources, and ensure that key real-time tasks can be processed within the specified time and meet the real-time requirements. It can effectively avoid system failures or performance degradation caused by task execution delays.
[0127] Step D13, starting bandwidth control based on the scheduling entity, the time period and the run time limit period, and calculating the total actual run time in the real-time run queue;
[0128] It should be noted that the total actual running time reflects the characteristics of the sum of the time required for all tasks in the ready queue.
[0129] It is understandable that the activation of bandwidth control is to ensure that real-time tasks can obtain sufficient processor resources within the specified time to meet their time sensitivity requirements. By calculating the total actual running time of all tasks in the real-time run queue, it is possible to evaluate whether the current scheduling strategy can meet the time constraints of all real-time tasks and determine whether there is a risk of timeout, so as to take corresponding measures to adjust the scheduling order of tasks or resource allocation to ensure the real-time performance of the system.
[0130] In addition, it should be noted that bandwidth control involves monitoring and limiting the running time of each real-time task to prevent any single task from taking up too much processor time and affecting the execution of other tasks. This is usually done by allocating a time slice or bandwidth to each task to ensure that each task can only run for a specified amount of time in each time period. If the running time of a task exceeds the bandwidth allocated to it, the system will take measures, such as reducing the priority of the task or removing it from the ready queue, to ensure that other tasks can be executed on time, improve the flexibility and responsiveness of the system, and ensure that critical real-time tasks can be processed in a timely manner even under high load conditions.
[0131] Step D14, determining a timeout state set based on the real-time task running time and the total actual running time;
[0132] It should be noted that the timeout state set reflects the characteristics of the time state in which the real-time task is expected to complete execution.
[0133] It is understandable that if the total actual running time exceeds the scheduled real-time task running time, that is, there is a risk of timeout, measures need to be taken to adjust the task scheduling or resource allocation, such as clock interruption, adjusting time slice allocation, limiting the execution time of the task or rescheduling the task to ensure that the task can meet its time constraints and optimize the processor scheduling efficiency to prevent timeout.
[0134] Step D15, controlling the execution of the system task based on the timeout status set.
[0135] It can be understood that the running tasks are interrupted according to the timeout status set to ensure the reasonable allocation of system resources. When there is a risk of timeout, the system will trigger the timer timeout module. According to the status of pending tasks in the ready queue, it will decide to suspend the real-time task to give priority to ordinary tasks or readjust the task queue to optimize the scheduling efficiency of the processor and ensure system stability and real-time execution of tasks.
[0136] In a feasible implementation, step D15 may include steps E11 to E13:
[0137] Step E11, obtaining ready queue information;
[0138] It should be noted that the ready queue information reflects the characteristics of a set of tasks in the system that are in a ready state and waiting to be scheduled and executed by the processor.
[0139] It is understandable that obtaining ready queue information can monitor the status of tasks to be executed in real time, so that the scheduler can make more reasonable and efficient scheduling decisions, optimize resource allocation, ensure timely response to key tasks, and maintain the smooth operation of the entire system.
[0140] Step E12, when the timeout status set indicates that the actual running time is not higher than the real-time task running time, running the real-time task;
[0141] It is understandable that when the system confirms through the timeout status set that the current total actual running time does not exceed the scheduled real-time task running time, it means that the current scheduling strategy can effectively meet the time constraints of the real-time tasks. In this case, the system will allow these real-time tasks to continue to execute, ensuring the timely completion of tasks within a safe range, meeting real-time requirements, and reasonably allocating system resources to support the smooth completion of tasks within the specified time, thereby improving the real-time response capability and efficiency of the system.
[0142] Step E13, when the timeout status set is that the actual running time is higher than the real-time task running time, the system timer timeout module is triggered. If the ready queue information shows that there are pending tasks, the scheduling module will remove the real-time task from the ready queue, give priority to the pending tasks, and the current-limited real-time task will continue to be limited. If the ready queue information shows that there are no pending tasks, the ready queue running time is recalculated, and the real-time task that is released from current limiting is added to the running queue to optimize the processor scheduling efficiency.
[0143] It is understandable that when the system detects that the execution of a real-time task may exceed the predetermined time limit, it will take emergency measures to adjust the scheduling strategy to prevent task timeout from affecting system performance. For real-time tasks that were originally limited in flow, the system will continue to maintain their limited flow state to prevent them from occupying too many resources. In the absence of other tasks to be processed, the system will readjust the running time of tasks in the ready queue and add the real-time tasks that were previously released from flow limits to the running queue to optimize the scheduling efficiency of the processor and maintain efficient and stable operation.
[0144] The embedded time-sharing operating system multi-task scheduling method proposed in this embodiment, when the current limiting task status set in the current limiting task status set is that there is no current limiting task in the ready queue or the current limiting task status set in the current limiting task status set is a release failure, the control system enters an idle state; when the current limiting task execution status set in the current limiting task status set is that there is a current limiting task in the ready queue and the current limiting task status set in the current limiting task status set is a release success, based on the task to be processed and the current limiting real-time task control system releases the current limiting task, obtains the current limiting release real-time task, and runs the system task. The present invention solves the technical problem of how to perform multi-task scheduling based on a control system of a current-limiting task status set. Compared with the prior art, the present application intelligently determines whether there is a current-limiting task in the ready queue and the release status of the current-limiting task. When there is an unlimited current task or the release of the current limit fails, the system enters an energy-saving idle state. When there is a current-limiting task and the release of the current limit is successful, the system responds quickly, releases the current limit and adds it to the ready queue for execution, thereby improving the real-time performance of the system and the utilization rate of processor resources, ensuring the timely processing of key tasks, and reducing resource consumption when the system is idle, thereby improving the efficiency and stability of the entire system.
[0145] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the multi-task scheduling method of the embedded time-sharing operating system of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0146] This application also provides an embedded time-sharing operating system multi-task scheduling device, please refer to Figure 6 , the embedded time-sharing operating system multi-task scheduling device comprises:
[0147] An acquisition module 10 is used to acquire information of pending tasks, wherein the pending tasks include pending tasks and current-limited real-time tasks;
[0148] A processing module 20, configured to determine a current limiting task state set based on the task to be processed and the current limiting real-time task;
[0149] The execution module 30 is used to control the system scheduling and optimize the processor scheduling efficiency based on the tasks to be processed, the current-limited real-time tasks and the current-limited task state set.
[0150] The acquisition module 10 is also used to acquire task attribute information;
[0151] Performing data preprocessing based on the task attribute information to obtain a normalized value;
[0152] determining a real-time priority based on the normalized value;
[0153] Determine and obtain information about tasks to be processed based on the real-time priority.
[0154] The acquisition module 10 is also used to acquire task running feature codes, data flow dependency information, network delay information, scheduling delay information, external device transmission delay information, network bandwidth information, scheduling strategy information, scheduling priority information, intensive task operation delay information, intensive task transmission delay information, periodic task status information and periodic task time information;
[0155] Task attribute information is determined based on the task running feature code, the data flow dependency information, the network delay information, the scheduling delay information, the external device transmission delay information, the network bandwidth information, the scheduling policy information, the scheduling priority information, the intensive task operation delay information, the intensive task transmission delay information, the periodic task status information and the periodic task time information.
[0156] The processing module 20 is further configured to determine a current limiting task execution state set based on the task to be processed and the current limiting real-time task;
[0157] Determine a task state set for releasing current limiting based on the current limiting task execution state set;
[0158] A current limiting task state set is obtained based on the current limiting task execution state set and the current limiting release task state set.
[0159] The execution module 30 is further configured to control the system to enter an idle state when the current limiting task execution state set in the current limiting task state set indicates that there is no current limiting task in the ready queue or the current limiting task release state set in the current limiting task state set indicates that the release has failed;
[0160] When the current limiting task execution status set in the current limiting task status set indicates that there is a current limiting task in the ready queue and the current limiting task release status set in the current limiting task status set indicates that release is successful, the current limiting task is released based on the pending tasks and the current limiting real-time task control system to obtain the current limiting release real-time task and run the system task.
[0161] The execution module 30 is further used to obtain operation bandwidth information and a scheduling entity, wherein the operation bandwidth information includes a time period and an operation time limit period;
[0162] Obtaining a real-time task based on the to-be-processed task, the current-limited real-time task and the current-limit-released real-time task, and determining a real-time task running time based on the real-time task;
[0163] Initiate bandwidth control based on the scheduling entity, the time period and the run time limit period, and calculate the total actual run time in the real-time run queue;
[0164] Determine a timeout state set based on the real-time task running time and the total actual running time;
[0165] The system task execution is controlled based on the timeout status set.
[0166] The execution module 30 is also used to obtain ready queue information;
[0167] When the timeout status set indicates that the actual running time is not higher than the real-time task running time, running the real-time task;
[0168] When the timeout status set is that the actual running time is higher than the real-time task running time, the system timer timeout module is triggered. If the ready queue information shows that there are pending tasks, the scheduling module will remove the real-time task from the ready queue, give priority to the pending tasks, and the current-limited real-time task will continue to be limited. If the ready queue information shows that there are no pending tasks, the ready queue running time will be recalculated, and the real-time task that is no longer limited will be added to the running queue to optimize the processor scheduling efficiency.
[0169] The embedded time-sharing operating system multi-task scheduling device provided by the present application adopts the embedded time-sharing operating system multi-task scheduling method in the above embodiment, which can solve the technical problem of how to perform embedded time-sharing operating system multi-task scheduling based on adaptive different task characteristics and system states. Compared with the prior art, the embedded time-sharing operating system multi-task scheduling device provided by the present application has the same beneficial effects as the embedded time-sharing operating system multi-task scheduling method provided by the above embodiment, and other technical features in the embedded time-sharing operating system multi-task scheduling device are the same as the features disclosed in the above embodiment method, which will not be described in detail here.
[0170] The present application provides an embedded time-sharing operating system multi-task scheduling device, which includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the embedded time-sharing operating system multi-task scheduling method in the above-mentioned embodiment one.
[0171] Reference below Figure 7, which shows a schematic diagram of the structure of an embedded time-sharing operating system multi-task scheduling device suitable for implementing the embodiment of the present application. The embedded time-sharing operating system multi-task scheduling device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The embedded time-sharing operating system multi-task scheduling device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0172] like Figure 7 As shown, the embedded time-sharing operating system multi-task scheduling device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the embedded time-sharing operating system multi-task scheduling device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the embedded time-sharing operating system multitasking scheduling device to communicate wirelessly or wired with other devices to exchange data. Although the figure shows an embedded time-sharing operating system multitasking scheduling device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0173] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0174] The embedded time-sharing operating system multi-task scheduling device provided by the present application adopts the embedded time-sharing operating system multi-task scheduling method in the above embodiment, which can solve the technical problem of how to adaptively perform embedded time-sharing operating system multi-task scheduling based on different task characteristics and system states. Compared with the prior art, the beneficial effects of the embedded time-sharing operating system multi-task scheduling device provided by the present application are the same as the beneficial effects of the embedded time-sharing operating system multi-task scheduling method provided by the above embodiment, and other technical features in the embedded time-sharing operating system multi-task scheduling device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0175] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0176] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0177] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the embedded time-sharing operating system multi-task scheduling method in the above-mentioned embodiment.
[0178] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0179] The computer-readable storage medium may be included in the embedded time-sharing operating system multi-task scheduling device; or may exist independently without being assembled into the embedded time-sharing operating system multi-task scheduling device.
[0180] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by an embedded time-sharing operating system multi-task scheduling device, the embedded time-sharing operating system multi-task scheduling device: obtains information about pending tasks, wherein the pending task information includes pending tasks and current-limited real-time tasks; determines a current-limited task status set based on the pending tasks and the current-limited real-time tasks; and controls system scheduling based on the pending tasks, the current-limited real-time tasks and the current-limited task status set to optimize processor scheduling efficiency.
[0181] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0182] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0183] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0184] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned embedded time-sharing operating system multi-task scheduling method, and can solve the technical problem of how to perform multi-task scheduling of the embedded time-sharing operating system in accordance with different task characteristics and system states. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the embedded time-sharing operating system multi-task scheduling method provided by the above-mentioned embodiment, and will not be described in detail here.
[0185] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A multi-task scheduling method for an embedded time-sharing operating system, characterized in that: The method includes: Obtaining pending task information, wherein the pending task information includes pending tasks and current-limited real-time tasks; Determine a current limiting task state set based on the pending task and the current limiting real-time task; The system scheduling is controlled based on the tasks to be processed, the current-limited real-time tasks and the current-limited task state set to optimize the processor scheduling efficiency.
2. The method according to claim 1, characterized in that The step of obtaining the task information to be processed includes: Get task attribute information; Performing data preprocessing based on the task attribute information to obtain a normalized value; determining a real-time priority based on the normalized value; Determine and obtain information about tasks to be processed based on the real-time priority.
3. The method according to claim 2, characterized in that The step of obtaining task attribute information includes: Obtaining task running feature codes, data flow dependency information, network delay information, scheduling delay information, external device transmission delay information, network bandwidth information, scheduling strategy information, scheduling priority information, intensive task operation delay information, intensive task transmission delay information, periodic task status information and periodic task time information; Task attribute information is determined based on the task running feature code, the data flow dependency information, the network delay information, the scheduling delay information, the external device transmission delay information, the network bandwidth information, the scheduling policy information, the scheduling priority information, the intensive task operation delay information, the intensive task transmission delay information, the periodic task status information and the periodic task time information.
4. The method according to claim 1, characterized in that The step of determining the current limiting task state set based on the to-be-processed task and the current limiting real-time task comprises: Determine a current-limiting task execution state set based on the pending task and the current-limiting real-time task; Determine a task state set for releasing current limiting based on the current limiting task execution state set; A current limiting task state set is obtained based on the current limiting task execution state set and the current limiting release task state set.
5. The method according to claim 1, characterized in that The step of controlling system scheduling and optimizing processor scheduling efficiency based on the tasks to be processed, the current-limited real-time tasks and the current-limited task state set comprises: When the current limiting task execution state set in the current limiting task state set indicates that there is no current limiting task in the ready queue or the current limiting task release state set in the current limiting task state set indicates release failure, the control system enters an idle state; When the current limiting task execution status set in the current limiting task status set indicates that there is a current limiting task in the ready queue and the current limiting task release status set in the current limiting task status set indicates that release is successful, the current limiting task is released based on the pending tasks and the current limiting real-time task control system to obtain the current limiting release real-time task and run the system task.
6. The method according to claim 5, characterized in that The steps of controlling the system based on the task to be processed and the current-limited real-time task to release the current-limited task, obtain the current-limited real-time task, and run the system task include: Acquire operation bandwidth information and a scheduling entity, wherein the operation bandwidth information includes a time period and an operation time limit period; Obtaining a real-time task based on the to-be-processed task, the current-limited real-time task and the current-limit-released real-time task, and determining a real-time task running time based on the real-time task; Initiate bandwidth control based on the scheduling entity, the time period and the run time limit period, and calculate the total actual run time in the real-time run queue; Determine a timeout state set based on the real-time task running time and the total actual running time; The system task execution is controlled based on the timeout status set.
7. The method according to claim 6, characterized in that The step of controlling the execution of the system task based on the timeout state set comprises: Get ready queue information; When the timeout status set indicates that the actual running time is not higher than the real-time task running time, running the real-time task; When the timeout status set is that the actual running time is higher than the real-time task running time, the system timer timeout module is triggered. If the ready queue information shows that there are pending tasks, the scheduling module will remove the real-time task from the ready queue, give priority to the pending tasks, and the current-limited real-time task will continue to be limited. If the ready queue information shows that there are no pending tasks, the ready queue running time will be recalculated, and the real-time task that is no longer limited will be added to the running queue to optimize the processor scheduling efficiency.
8. A multi-task scheduling device for an embedded time-sharing operating system, characterized in that: The device comprises: An acquisition module is used to acquire information of pending tasks, wherein the pending tasks include pending tasks and current-limited real-time tasks; A processing module, used to determine a current limiting task state set based on the task to be processed and the current limiting real-time task; An execution module is used to control system scheduling and optimize processor scheduling efficiency based on the tasks to be processed, the current-limited real-time tasks and the current-limited task state set.
9. An embedded time-sharing operating system multi-task scheduling device, characterized in that: The device comprises: a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the embedded time-sharing operating system multi-task scheduling method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the embedded time-sharing operating system multi-task scheduling method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Real-time task scheduling optimization method, device and system for FreeRTOS
CN120256063A