A task scheduling method and apparatus suitable for virtualized automotive electronic systems

By employing container-level and task-level scheduling methods in virtualized automotive electronic systems, and dynamically adjusting resource allocation and container migration, the hardware utilization and real-time performance issues in virtualized systems are resolved, achieving efficient and predictable task scheduling for the system.

CN119862031BActive Publication Date: 2026-03-13NANJING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing virtualized automotive electronic system task scheduling methods, while improving hardware utilization, cannot guarantee the real-time performance and predictability of the system, especially the context switching overhead and runtime sequence violations caused by task preemption between mixed critical tasks.

Method used

A container-based task management and scheduling approach is adopted. By obtaining the container's mapped kernel, time slices and runtime cycles are pre-allocated, resource allocation is dynamically adjusted, and container migration and resource preemption are implemented using the kernel controller and migration controller. This ensures container-level and task-level scheduling rules, optimizes resource utilization and system real-time performance.

Benefits of technology

It effectively reduces contention between containers, improves system performance, ensures hardware utilization and task real-time performance, enhances system compatibility and processing capabilities for different task types, and adapts to future technological changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862031B_ABST
    Figure CN119862031B_ABST
Patent Text Reader

Abstract

This invention discloses a task scheduling method and apparatus applicable to virtualized automotive electronic systems, relating to the field of real-time automotive task scheduling technology. The method includes: obtaining the mapping kernel of a container; pre-allocating time slices and runtime cycles to the container based on the mapping kernel, wherein the container is pre-allocated computing and storage resources; obtaining the resource usage of the container; periodically allocating or reclaiming resources for the container based on the resource usage; when the kernel has no resources, performing a migration operation on the container; if the migration fails, the kernel preempts the resources of other containers except the failed migration container and allocates the resources of the other containers to the failed migration container, and repeats the above operations to achieve task scheduling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of real-time scheduling technology for automotive tasks, specifically a task scheduling method and apparatus applicable to virtualized automotive electronic systems. Background Technology

[0002] As user demands for automotive functions increase, the computing power of automotive electronic systems is also constantly improving. This trend has led to a surge in the complexity of automotive electronic systems. Therefore, integrating multiple ECUs onto a high-performance computing platform, such as a multi-core processor, can reduce the number of physical hardware components, effectively simplifying the automotive's electronic and electrical architecture. Simultaneously, to improve the efficiency of hardware resource utilization, software and hardware compatibility, and system security of the high-performance computing platform, virtualization technology has been introduced into multi-processor hardware platforms. Each ECU is abstracted as a container running on this platform, with the hypervisor allocating hardware resources to each container to execute tasks. This is a platform virtualization-based solution that provides a well-isolated virtualization environment, allowing each ECU codebase to run almost without modification within the virtual machine. The application of virtualization technology has transformed automotive electronic systems into complex systems composed of applications with mixed criticality. Different critical tasks will execute on the same physical hardware, rendering traditional task allocation strategies inapplicable and necessitating the search for new allocation strategies.

[0003] In the aforementioned hybrid critical systems, ensuring predictability of system behavior while improving hardware utilization is a key challenge. Due to the limited isolation provided by container-based virtualization, preemption of tasks can occur between containers co-located on the same kernel. Excessive preemption not only introduces unexpected context switching overhead but also leads to runtime sequence violations, thereby degrading real-time performance. Using a Hierarchical Real-Time Scheduling framework (HRTS) allows for initial consideration of task scheduling rules at the container level (task-level scheduling), ensuring schedulability for each container. Then, resource allocation and scheduling are performed at the entire hardware platform level (container-level scheduling), effectively eliminating performance interference between containers and thus guaranteeing the real-time performance and predictability of the entire system.

[0004] In past research, scheduling methods built upon this framework have mostly been static, meaning they allocate resources relatively pessimistically to ensure the schedulability of each container, which limits hardware utilization to some extent. Furthermore, these scheduling methods can only guarantee sufficient CPU bandwidth allocated to a container, not that each task will complete within its deadline. Therefore, traditional real-time scheduling frameworks need optimization. This optimization should not only ensure that allocated resources meet the schedulability requirements of containers but also dynamically optimize at runtime based on the computing resource usage of each container, adaptively adjusting scheduling parameters for different containers and kernels. This approach improves hardware utilization while ensuring system real-time performance and predictability.

[0005] Currently, a considerable number of researchers have optimized the scheduling methods based on the above framework, giving them a certain degree of dynamism in resource allocation. However, the drawback is that most dynamic scheduling strategies are only applicable to soft real-time scenarios and do not have the ability to schedule hard real-time tasks. The dynamic adjustment strategies they adopt have obvious time lag and cannot be applied to hard real-time scenarios.

[0006] In summary, current research on task scheduling methods for virtualized automotive electronic systems is still inadequate. Therefore, it is necessary to propose a task scheduling method and system suitable for virtualized automotive electronic systems. Summary of the Invention

[0007] To address the shortcomings mentioned in the background section, the present invention aims to provide a task scheduling method and apparatus suitable for virtualized automotive electronic systems.

[0008] Firstly, the objective of this invention can be achieved through the following technical solution: a task scheduling method and apparatus suitable for virtualized automotive electronic systems, the method comprising the following steps:

[0009] Obtain the container's mapping kernel, and pre-allocate time slices and runtime cycles for the container based on the container's mapping kernel, wherein the container is pre-allocated computing and storage resources;

[0010] The kernel obtains the resource usage of containers and periodically allocates or reclaims resources for containers based on the resource usage. When the kernel has no more resources, it performs a migration operation on the container.

[0011] If the migration fails, the kernel preempts the resources of the containers other than the failed container and allocates the resources of the other containers to the failed container. This process is repeated to schedule the task.

[0012] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the resource adjustment during the dynamic scheduling phase of the container is a dynamic adjustment of time-slice resources, including periodic adjustment of time slices, time-slice preemption of LC containers, and container migration, wherein the periodic adjustment of time slices and time-slice preemption of LC containers are handled by the kernel controller.

[0013] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the migration of the container is the migration of an LC container that has been preempted from its time slice in a critical kernel, which is handled by a migration controller in the compute node.

[0014] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: assuming the automotive electronic system has a task set Γ, the task set Γ includes the HC task set Γ HI and LC mission set Γ LO Both types of tasks are periodically triggered tasks, and each task in the task set is denoted as τ. i ∈Γ is defined as:

[0015] τ i ={T i A i C i D i ,p i} Formula (1)

[0016] Among them, T i For task τ i The period, A i For task τ i Average execution time, C i For task τ i Worst execution time, D i For task τ i The deadline, p i It is a binary value representing task τ i The system's criticality;

[0017] For container π k The definition is as follows:

[0018] π k =(Γ k ,P k Q k CLM k Me k ) Formula (2)

[0019] Where, container π k Based on the different task sets included, they are divided into two categories: one category contains only HC task sets. HC container One type contains only the LC mission set. LC container P k For container π k The operating cycle, Q k For each running cycle P k Available time slice size within, CLM k It is a measure of the container π k Real-time parameters, Me k For container π k Memory usage;

[0020] For kernel N j The definition is as follows:

[0021]

[0022] Where m is the kernel N j The total number of containers assigned, for those mapped to kernel N j HC container on have Numbered from 1 to m h For mapping in kernel N j LC container on have Number m h +1 to m, f j Represents kernel N j memory capacity, Crt j It is a binary value representing kernel N. j Is it in a critical state?

[0023] The entire multi-core computing node is defined as follows: S:

[0024] S={n,Π HI ,Π LO MigCtrl} formula (4)

[0025] Where n is the total number of kernels in the entire node, Π HI and Π LO The mapping relationships between HC containers and LC containers and each kernel are recorded respectively. MigCtrl is the migration controller in the node responsible for container migration.

[0026] Container-level scheduling between containers is handled by the kernel controller, and the scheduling strategy is based on a rate-monotonic algorithm. Each container is scheduled in Q... k Once the kernel usage is complete, the kernel usage rights are relinquished. Task-level scheduling within the container is handled by the container controller, which uses a rate-monotonic algorithm to schedule tasks based on their cycle time. The kernel controller has a higher priority than the container controller.

[0027] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the process by which the container-based mapping kernel pre-allocates time slices and runtime cycles for containers is as follows:

[0028] Use binary variable set Indicates whether the container is mapped to kernel N j Above, there are:

[0029]

[0030] Among them, T overhead c1 and c2 are parameters for balancing the switching overhead in the system.

[0031] To ensure the schedulability of container-level scheduling, hardware resource constraints need to be incorporated into the model.

[0032]

[0033] When the system is running, To ensure that task τ1 to τ i To complete the task on time under the worst-case scenario, the following conditions must be met:

[0034]

[0035] Where, ρ i It is a set of time points, consisting of the deadlines of each task. If the time points satisfy formula (8), it indicates that the system has schedulability for the current task set, ρ i The possible values ​​are as follows:

[0036]

[0037] Get container π k The task set Γ k ={τ1,...,τ r The worst-case schedulable condition is:

[0038]

[0039] According to formula (10), the following constraints are obtained:

[0040]

[0041] Since multiple containers are deployed on each kernel, container π needs to be considered. k kernel utilization α k and delay Δ k Kernel utilization α k It can be made by αk =Q k / P k The calculation shows that the time delay Δ k Calculate based on the worst-case scenario that the system might encounter, i.e., Δ k =2·(P k -Q k Based on the above, formula (10) is improved to obtain:

[0042]

[0043] Formula (12) restricts Q k The lower bound and P k The upper bound;

[0044] Then, based on the above objective function and constraints, the time slice and memory allocation model of the container can be obtained, that is, with formula (5) as the objective function and formulas (6), (7) and (12) as constraints:

[0045] When allocating time slices and memory resources according to the above formula, it is necessary to consider ensuring the real-time performance of HC tasks in each single core under the worst-case scenario, as well as the optimization goal of maximizing single-core utilization, and allocate resources according to the ACET of the task.

[0046] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the process by which the kernel periodically allocates or reclaims resources for a container based on the container's resource usage includes the following steps:

[0047] During the dynamic scheduling phase, when allocating or reclaiming time slices, it is necessary to update the remaining available time slices on the kernel. To trace kernel N j The remaining available time slice is defined as follows:

[0048]

[0049] In formula (13), For kernel N j The total amount of available time slices, if updated That is, kernel N j If no remaining time slices are available, then Crt will be used. j A value of 1 indicates that kernel N j Entering a critical state, if after the update Then kernel N j Set the critical state to 0;

[0050] Using real-time parameter CLM k To measure the container π k Real-time performance, assuming container π kThe execution sequence of the task is τ1 to τ2. r Then we have:

[0051]

[0052] Among them, E i For task τ i Actual execution time, CLM k (i) represents task τ i Whether the actual execution time is ahead of schedule or exceeds the timeout, if there is a CLM. k If (r) > 0, it indicates that there are tasks that timed out. In this case, additional time slices need to be allocated, if there is a CLM. k (r) < 0 indicates that all tasks are completed ahead of schedule, so some time slices are reclaimed;

[0053] If CLM k If (r) < 0, the kernel controller will reclaim container resources based on the integral controller policy, that is:

[0054] Q k (λ)=K l *[Q k (λ-1)+CLM k (r)]+Q k (λ-1) Formula (15)

[0055] Among them, K l The parameter representing the response strength of the controller to the resource recycling process is expressed in the formula using container π. k Real-time parameters CLM of the previous running cycle k and available time slice Q k This is used to quantify the amount of resources that the kernel needs to reclaim;

[0056] CLM needs to be considered k When (r) > 0, the container π k Available time slice Q k When the time slice is exhausted, the kernel controller will allocate an additional time slice Q. tsp If it is an HC container, then Q tsp =CLM k (r) and the kernel controller will allow continued use of the kernel until the additional time slice Q. tsp It also runs out of space; if it's an LC container, then... However, continued use of the kernel is not permitted:

[0057] When a container's runtime cycle ends, the kernel controller will, based on the integral controller policy and referring to Q... tsp The value is used to update the Q of the container in the next runtime cycle. k The value of, i.e.:

[0058] Q k (λ)=K m *[Q k (λ-1)+Q tsp ]+Q k (λ-1) Formula (16)

[0059] Among them, K m Q is a parameter representing the strength of the controller's response during the time slice allocation phase. k (λ) represents the container π k The available time slice Q allocated to the λth running cycle k .

[0060] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the process by which the kernel preempts resources from other containers besides the failed migration container.

[0061] First, calculate the size Q of the time slice that needs to be forcibly removed. req The calculation formula is as follows:

[0062]

[0063] Identify the preemption targets and allocate the LC container according to the available time slice Q. k Sort by size, prioritizing Q. k The larger container is the object of deprivation;

[0064] Time slices are sequentially evicted until the time slice requirement Q can be met. req ;

[0065] Update the available time slice Q for each container based on the time slice preemption situation. k ;

[0066] View kernel N j Has it reached a critical state? If kernel N j When in a critical state, it is necessary not only to preempt the time slice of the LC container, but also to send a migration request to the node's container migration controller.

[0067] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the process of performing the container migration operation:

[0068] The node's container migration controller, MigCtrl, acquires the remaining available time slices for each core at the end of each runtime cycle. and remaining available memory Then, with the container π to be moved in k The resource requirements are compared. If there are no kernels with sufficient resources, the migration request is rejected. If the requirements are met, the process proceeds to the next step.

[0069] MigCtrl will and The kernel with the largest value is selected as the target kernel for migration, and the container π is recorded simultaneously. k The various parameters;

[0070] Before performing container migration, MigCtrl will migrate the container π to be migrated. k Available time slice Q k Setting the value to 0 blocks the container π. k Task execution within;

[0071] Before creating a new container, store the original container π. k Destroy and release the kernel resources it occupies;

[0072] MigCtrl will record according to the original container π. k The relevant parameters are retrieved from the target kernel and a new container π is started. k .

[0073] Secondly, in order to achieve the above objectives, the present invention discloses a task scheduling system suitable for virtualized automotive electronic systems, comprising:

[0074] The resource pre-allocation module is used to obtain the mapping kernel of the container and pre-allocate the time slice and running cycle of the container based on the container's mapping kernel, wherein the container is pre-allocated computing resources and storage resources;

[0075] The container migration module is used to obtain the resource usage of containers. The kernel periodically allocates or reclaims resources for containers based on their resource usage. When the kernel has no more resources, it performs a migration operation on the container.

[0076] The resource reallocation module is used to, if migration fails, preempt the resources of other containers except the failed container and allocate the resources of other containers except the failed container to the failed container, and repeat the above operations in a loop to achieve task scheduling.

[0077] In another aspect of the present invention, in order to achieve the above-mentioned objective, a terminal device is disclosed, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. The memory stores the computer program capable of running on the processor, and when the processor loads and executes the computer program, it employs a task scheduling method applicable to a virtualized automotive electronic system as described above.

[0078] The beneficial effects of this invention are:

[0079] This invention employs a container-based task management and scheduling method, effectively ensuring the security and isolation of automotive electronic systems while also exhibiting good scalability, easily adapting to future technological developments and changing needs. When pre-allocating resources for containers, scheduling rules are formulated at both the task and container levels. At the task level, schedulability within containers is guaranteed; at the container level, preemption between containers is reduced, unnecessary context switching overhead is minimized, and system performance is improved. For hybrid task sets consisting of HC and LC tasks, kernel utilization is improved while ensuring the schedulability of HC tasks and the QoS of LC tasks, thereby enhancing the system's compatibility and processing capabilities for different task types. The kernel controller periodically monitors container resource usage, enabling dynamic allocation and adjustment of resources based on real-time container demands, making resource utilization more flexible and effectively addressing potential task load changes during system operation. A migration controller is implemented on the computing platform to implement a container migration mechanism. When a container's resource demands exceed the current kernel's processing capacity, the system automatically migrates the task to other idle kernels, ensuring not only task real-time performance but also load balancing among kernels. By employing a redundant resource preemption mechanism, resources are preempted from the LC container under high system load to ensure that the system can still guarantee the real-time performance of hard real-time constraint tasks even in extreme cases. Attached Figure Description

[0080] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0081] Figure 1 This is a schematic diagram of the method flow of the present invention;

[0082] Figure 2 This is a schematic diagram of the system model architecture of the present invention.

[0083] Figure 3 This is a schematic diagram of the container scheduling mechanism of the present invention.

[0084] Figure 4 This is a schematic diagram of the container migration process of the present invention.

[0085] Figure 5 This is a schematic diagram of the system modules of the present invention;

[0086] Figure 6 This is a schematic diagram of the system structure of the present invention. Detailed Implementation

[0087] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0088] Example 1:

[0089] like Figure 1 As shown, a task scheduling method suitable for virtualized automotive electronic systems includes the following steps:

[0090] Obtain the container's mapping kernel, and pre-allocate time slices and runtime cycles for the container based on the container's mapping kernel, wherein the container is pre-allocated computing and storage resources;

[0091] Specifically, this includes: the system design phase and the dynamic scheduling phase;

[0092] The system design phase is responsible for pre-allocating computing and storage resources for containers, including mapping containers to various kernels of the computing platform and allocating a certain length of time slice and running cycle for each container.

[0093] The dynamic scheduling phase is responsible for real-time time slice periodic adjustment, LC container time slice preemption, and container migration. These three steps optimize resource allocation and ensure the real-time performance of the system.

[0094] When the method works, firstly, during the system design phase, time slices and memory resources are pre-allocated to each container. Then, during the dynamic scheduling phase, the kernel controller monitors the execution time of the container in real time using the container's real-time parameters. If the actual execution time is less than the pre-allocated value, it indicates that the container has completed execution ahead of schedule; otherwise, it has completed execution after a timeout. The kernel controller reclaims or allocates a portion of the time slice according to the specific value of the ahead-scheduled or time-out completion. HC containers that have timed out will be allowed to execute for an additional period of time. If the time slice requirements of HC containers cannot be met, the kernel controller will not only allocate all remaining time slices but also preempt the time slices of LC containers to fully meet their requirements. If the kernel has no remaining available time slices, the kernel enters a critical state. If time slice preemption occurs in a kernel in a critical state, the kernel controller requests the migration controller of the compute node to migrate the LC containers whose time slices have been preempted. The migration controller responds to and processes the migration request based on the remaining time slices and memory resources of each kernel.

[0095] First, assume that the automotive electronic system has a task set Γ, which includes the HC task set Γ. HI and LC mission set Γ LOBoth types of tasks are periodically triggered tasks, and each task in the task set is denoted as τ. i ∈Γ is defined as:

[0096] τ i ={T i A i C i D i ,p i}Formula (1)

[0097] In the middle, T i For task τ i The period, A i For task τ i Average Case Execution Time (ACET), C i For task τ i Worst-Case Execution Times (WCET), D i For task τ i The deadline, p i It is a binary value representing task τ i The system's criticality;

[0098] Secondly, for container π k The definition is as follows:

[0099] π k =(Γ k ,P k Q k CLM k Me k )Formula (2)

[0100] Where, container π k Based on the different task sets included, they are divided into two categories: one category contains only HC task sets. HC container One type contains only the LC mission set. LC container The set of tasks contained in each container is predetermined, P k For container π k The operating cycle, Q k For each running cycle P k Available time slice size within, CLM k It is a measure of the container π k Real-time parameters, primarily used for time slice allocation and redistribution, will be defined later. k For container π k Memory usage;

[0101] Next, for kernel N j The definition is as follows:

[0102]

[0103] Where m is the kernel N j The total number of containers assigned, for those mapped to kernel N j HC container on have Numbered from 1 to m h For mapping in kernel N j LC container on have Number m h +1 to m, f j Represents kernel N j For homogeneous multi-core processors, the memory capacity is the same for each core. j It is a binary value representing kernel N. j Is it in a critical state?

[0104] The entire multi-core computing platform is then defined as follows: S:

[0105] S={n,Π HI ,Π LO MigCtrl}Formula (4)

[0106] Where n is the total number of kernels in the entire node, Π HI and Π LO The mapping relationships between HC containers and LC containers and each kernel are recorded respectively. MigCtrl is the migration controller in the node responsible for container migration.

[0107] Finally, container-level scheduling between containers is handled by the kernel controller, which uses a rate monotonic scheduling (RMS) algorithm. Each container is scheduled in Q... k Once the kernel is no longer in use, the kernel usage rights are relinquished. The task-level scheduling within the container is the responsibility of the container controller, which follows the RMS principle and prioritizes the task's lifecycle. The kernel controller has a higher priority than the container controller.

[0108] First, the objective function of the model needs to be determined. In this method, the optimization objective in the system design phase is to maximize the utilization of each single core. Therefore, the objective function needs to consider two requirements: one is the need for a container π. k Available time slice Q k The first requirement is to keep it as small as possible to avoid wasting the total capacity of a single core; the second is the π container. k Operating cycle Pk It should be as large as possible; otherwise, too many context switches will be performed on each single core, as we will discuss below. k The lower bound and P k The upper bound of Q is limited by the task-level schedulability condition, thus obtaining Q. k and P k To ensure both system real-time performance and maximize single-core utilization, a binary variable set can be used. Indicates whether the container is mapped to kernel N j Above, there are:

[0109]

[0110] Among them, T overhead c1 and c2 are the context switching overhead in the system, which is a fixed constant. c1 and c2 are parameters that balance the two requirements mentioned above. These parameters can be flexibly adjusted in biased systems.

[0111] Secondly, it is necessary to ensure the schedulability of container-level scheduling, which means incorporating hardware resource constraints into the model, namely:

[0112]

[0113] Formula (6) guarantees the availability of memory resources for each kernel, and formula (7) guarantees that the utilization rate of each single core is less than 1.

[0114] Next, to ensure the schedulability of task-level scheduling, before conducting schedulability analysis, we need to make the following four assumptions: First, we assume the system starts at time zero; second, for container π... k The task set Γ k ={τ1,...,τ r}, assuming task set Γ k All tasks have arrived at time zero. Thirdly, since the task set is scheduled according to a fixed priority by the RMS algorithm, we can assume the task execution order is τ1 to τ2. r Fourth, the running time of all tasks will not exceed their WCET;

[0115] When the system is running, To ensure that task τ1 to τ i To complete the task on time under the worst-case scenario, the following conditions must be met:

[0116]

[0117] Where, ρ i It is a set of time points, consisting of the deadlines of each task. If formula (8) is satisfied at these time points, it indicates that the system has schedulability for the current task set, ρi The possible values ​​are as follows:

[0118]

[0119] From this, we can obtain the container π. k The task set Γ k ={τ1,...,τ r The worst-case schedulable condition is:

[0120]

[0121] According to formula (10), the following constraints can be obtained:

[0122]

[0123] Since multiple containers are deployed on each kernel, container π also needs to be considered. k kernel utilization α k and delay Δ k Kernel utilization α k It can be made by α k =Q k / P k The calculation shows that the time delay Δ k Calculate based on the worst-case scenario that the system might encounter, i.e., Δ k =2·(P k -Q k Based on the above, formula (8) is improved to obtain:

[0124]

[0125] Formula (12) restricts Q k The lower bound and P k The upper bound, Q k Too small and P k Excessively large allocation results cannot satisfy the constraints of formula (12) and will be discarded by the model;

[0126] Then, based on the above objective function and constraints, the time slice and memory allocation model of the container can be obtained, that is, with formula (5) as the objective function and formulas (6), (7) and (12) as constraints:

[0127] Finally, based on the above model, time slices and memory resources can be allocated. When allocating, we need to consider two steps. The first step is to ensure the real-time performance of HC tasks in each single core under the worst case. The second step is to consider the optimization goal of maximizing single core utilization and allocate the above resources according to the ACET of the task.

[0128] Specifically, the first step is to ensure that the total kernel utilization of the HC containers allocated to each single core is less than 1 under the worst-case scenario. To guarantee this, we allocate all resources to the HC containers according to the worst-case scenario, resulting in a pre-allocation scheme, namely the binary variable set. arrive The value (j = 1, ..., n) can be solved by the Satisfiability Modulo Theories (SMT) solver according to the model in S24. The pre-allocation scheme mainly limits the number of HC containers allocated to each single core, which makes it possible for the resources of each single core to meet the needs of these containers even if all tasks in all HC containers run in the worst case.

[0129] The second step aims to minimize the number of kernels used. The model established in S24 is still used for the solution, but WCET in formula (7) is replaced with ACET. This ensures the schedulability of containers under average conditions. The container allocation scheme and the Q of each container are derived based on the ACET of the task. k and P k value;

[0130] The kernel obtains the resource usage of containers and periodically allocates or reclaims resources for containers based on the resource usage. When the kernel has no more resources, it performs a migration operation on the container.

[0131] First, when allocating or reclaiming time slices, the remaining available time slices on the kernel need to be updated. We use To trace kernel N j The remaining available time slices are defined as follows:

[0132]

[0133] in, For kernel N j The total amount of available time slices, if updated That is, kernel N j If no remaining time slices are available, then Crt will be used. j A value of 1 indicates that kernel N j Entering a critical state, if after the update Then kernel N j Set the critical state to 0;

[0134] Secondly, use the real-time parameter CLM. k To measure the container π k The real-time performance of the container π is indicated by this value. k The time it takes for a task to execute ahead of or exceed the expected execution time is denoted by container π. kThe execution sequence of the task is τ1 to τ2. r Then we have:

[0135]

[0136] Among them, E i For task τ i Actual execution time, CLM k (i) represents task τ i Whether the actual execution time is ahead of schedule or exceeds the timeout, if there is a CLM. k If (r) > 0, it indicates that there are tasks that timed out. In this case, additional time slices need to be allocated, if there is a CLM. k (r) < 0 indicates that all tasks are completed ahead of schedule, and some time slices can be recovered.

[0137] Then if CLM k If (r) < 0, the kernel controller will reclaim container resources based on the integral controller policy, that is:

[0138] Q k (λ)=K l *[Q k (λ-1)+CLM k (r)]+Q k (λ-1) Formula (15)

[0139] Among them, K l The parameter representing the strength of the controller's response in the resource recycling process is expressed in the formula using container π. k Real-time parameters CLM of the previous running cycle k and available time slice Q k This is used to quantify the amount of resources that the kernel needs to reclaim;

[0140] Then we consider CLM k When (r) > 0, the container π k Available time slice Q k When the time slice is exhausted, the kernel controller will allocate an additional time slice Q. tsp If it is an HC container, then Q tsp =CLM k (r) and the kernel controller will allow it to continue using the kernel until the additional time slice Q. tsp It will also run out of space, if it is an LC container. However, continued use of the kernel is not permitted:

[0141] Finally, when a cycle of the container ends, the kernel controller will, based on the integral controller policy and referring to Q... tsp The value is used to update the Q of the container in the next runtime cycle. k The value of, i.e.:

[0142] Q k (λ)=K m *[Q k (λ-1)+Q tsp ]+Q k (λ-1) Formula (16)

[0143] Among them, K m Q represents the controller's response strength during time slice allocation, and its value ranges from (0,1). k (λ) represents the container π k The available time slice Q allocated to the λth running cycle k ;

[0144] For HC containers, in addition to allocating all remaining time slices, the kernel controller will also preempt time slices from LC containers to fully satisfy their needs.

[0145] First, calculate the size Q of the time slice that needs to be forcibly removed. req The calculation formula is as follows:

[0146]

[0147] Next, determine the preemption targets and divide the LC container according to the available time slice Q. k Sort by size, prioritizing Q. k The larger container is the object of deprivation;

[0148] Then, time slices are forfeited sequentially until the time slice requirement Q can be met. req ;

[0149] Then, based on the time slice preemption situation, update the available time slice Q for each container. k ;

[0150] Finally, check kernel N. j Has it reached a critical state? If kernel N j When in a critical state, it is necessary not only to preempt the LC container's time slice, but also to send a migration request to the node's container migration controller.

[0151] If time slice preemption occurs in a kernel that is in a critical state, the kernel controller requests the migration controller of the compute node to migrate the LC container whose time slice has been preempted. The migration controller responds to and processes the migration request based on the remaining time slice and memory resource status of each kernel.

[0152] First, the node's container migration controller, MigCtrl, obtains the remaining available time slices for each core at the end of each runtime cycle. and remaining available memory Then it is combined with the container π to be moved in. k The resource requirements are compared, and if there are no kernels with sufficient resources, the migration request is rejected; if the requirements are met, the process continues.

[0153] MigCtrl will then and The kernel with the largest value is selected as the target kernel for migration, and the container π is recorded simultaneously. k Various parameters

[0154] Before performing container migration, to avoid adverse effects on system stability, MigCtrl will check the container to be migrated (π). k Available time slice Q k Set the value to 0, thus blocking the container π. k Task execution within;

[0155] To prevent deadlock, the original container π needs to be cleared before creating a new container. k Destroy and release the kernel resources it occupies;

[0156] Finally, MigCtrl will record the original container π. k The relevant parameters are used to pull and start a new container π' in the target kernel. k ;

[0157] Example 2: In a second aspect, to achieve the above objectives, the present invention discloses a task scheduling system suitable for virtualized automotive electronic systems, comprising:

[0158] The resource pre-allocation module 11 is used to obtain the mapping kernel of the container and pre-allocate the time slice and running cycle of the container based on the container's mapping kernel, wherein the container is pre-allocated computing resources and storage resources.

[0159] The container migration module 12 is used to obtain the resource usage of the container. The kernel periodically allocates or reclaims resources for the container based on the resource usage. When the kernel has no more resources, it performs a migration operation on the container.

[0160] Resource reallocation module 13 is used to, if migration fails, preempt the resources of other containers except the failed container and allocate the resources of other containers except the failed container to the failed container, and repeat the above operations in a loop to achieve task scheduling.

[0161] Based on the same inventive concept, this invention also provides a computer device, comprising: one or more processors, and a memory for storing one or more computer programs; the programs include program instructions, and the processor executes the program instructions stored in the memory. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, used to implement one or more instructions, specifically for loading and executing one or more instructions stored in a computer storage medium to implement the above-described method.

[0162] It should be further explained that, based on the same inventive concept, the present invention also provides a computer storage medium storing a computer program, which, when executed by a processor, performs the above-described method. This storage medium can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0163] In the description of this specification, references to terms such as "an embodiment," "example," "specific example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0164] The foregoing has shown and described the basic principles, main features, and advantages of this disclosure. Those skilled in the art should understand that this disclosure is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of this disclosure. Various changes and modifications can be made to this disclosure without departing from its spirit and scope, and all such changes and modifications fall within the scope of this disclosure as claimed.

Claims

1. A task scheduling method suitable for virtualized automotive electronic systems, characterized in that, The method includes the following steps: Obtain the container's mapping kernel, and pre-allocate time slices and runtime cycles for the container based on the container's mapping kernel, wherein the container is pre-allocated computing and storage resources; The process by which the container-based mapping kernel pre-allocates time slices and runtime cycles for containers is as follows: Use binary variable set Indicates whether the container is mapped to the kernel. Above, there are: Official (5) in, For the switching overhead in the system, and Parameters to balance the two requirements; To ensure the schedulability of container-level scheduling, hardware resource constraints need to be incorporated into the model. Official (6) Official (7) When the system is running, To ensure the task arrive To complete the task on time under the worst-case scenario, the following conditions must be met: Official (8) in, It is a set of time points, consisting of the deadlines of each task. If the time points satisfy formula (8), it indicates that the system has schedulability for the current task set. The possible values ​​are as follows: Official (9) Get the container task set in The worst-case schedulability condition is: Official (10) According to formula (10), the following constraints are obtained: Official (11) Since multiple containers are deployed on each kernel, container... kernel utilization and latency Among them, kernel utilization It can be by The calculation shows that the delay Calculate based on the worst-case scenario that the system might encounter, i.e. Based on the above, formula (10) is improved to obtain: Official (12) Formula (12) restricts The lower bound and The upper bound; Then, based on the above objective function and constraints, the time slice and memory allocation model of the container can be obtained, that is, with formula (5) as the objective function and formulas (6), (7) and (12) as constraints: When allocating time slices and memory resources according to the above formula, it is necessary to consider ensuring the real-time performance of HC tasks in each single core under the worst case, as well as the optimization goal of maximizing single-core utilization, and allocate resources according to the ACET of the task. The kernel obtains the resource usage of containers and periodically allocates or reclaims resources for containers based on the resource usage. When the kernel has no more resources, it performs a migration operation on the container. The kernel's process of periodically allocating or reclaiming resources for containers based on their resource usage includes the following steps: During the dynamic scheduling phase, when allocating or reclaiming time slices, it is necessary to update the remaining available time slices on the kernel. To trace the kernel The remaining available time slice is defined as follows: Official (13) In formula (13), For kernel The total amount of available time slices, if updated kernel If there are no remaining available time slices, then A value of 1 indicates the kernel. Entering a critical state, if after the update Then the kernel Set the critical state to 0; Using real-time parameters To measure containers Real-time performance, setting up containers The execution sequence of the task is as follows arrive Then we have: Official (14) in, For the task The actual execution time Indicates task Whether the actual execution time is ahead of schedule or exceeds the timeout period, if so. This indicates that there are tasks that have timed out, and additional time slices need to be allocated in this case. If all tasks are completed ahead of schedule, then a portion of the time slice will be reclaimed. like The kernel controller will reclaim container resources based on the integral controller policy, that is: Official (15) in, The parameter representing the strength of the controller's response in the resource recycling process is expressed in the formula using a container. Real-time parameters of the previous running cycle and available time slices This is used to quantify the amount of resources that the kernel needs to reclaim; Need to be considered In the case of containers Available time slices When the time slice is exhausted, the kernel controller will allocate an additional time slice. If it is an HC container, then Furthermore, the kernel controller will allow continued kernel use until an additional time slice is available. It will also run out of space; if it is an LC container, then... However, continued use of the kernel is not permitted: When a container's runtime cycle ends, the kernel controller will, based on the integral controller policy and referring to... The value is used to update the container in the next runtime cycle. The value of, that is: Official (16) in, The parameter representing the strength of the controller's response during the time slice allocation phase. Represents a container No. The available time slices allocated to each running cycle ; If the migration fails, the kernel preempts the resources of the containers other than the failed container and allocates the resources of the other containers to the failed container. This process is repeated to schedule the task.

2. The task scheduling method for a virtualized automotive electronic system according to claim 1, characterized in that, The resource adjustment during the dynamic scheduling phase of the container is a dynamic adjustment of time-slice resources, including periodic time-slice adjustment, time-slice preemption of LC containers, and container migration. The periodic time-slice adjustment and time-slice preemption of LC containers are handled by the kernel controller.

3. The task scheduling method for a virtualized automotive electronic system according to claim 1, characterized in that, The migration of containers refers to the migration of LC containers that have been preempted from their time slice in the kernel and are in a critical state, which is handled by the migration controller in the compute node.

4. A task scheduling method for virtualized automotive electronic systems according to claim 1, characterized in that, Assume that the automotive electronic system has a task set Task set Including HC task set and LC mission set Both types of tasks are periodically triggered tasks, and each task in the task set is denoted as... Defined as: Official (1) in, For the task The cycle, For the task Average execution time For the task Worst execution time For the task The deadline It is a binary value representing the task. The system's criticality; For containers The definition is as follows: Official (2) Among them, containers Based on the different task sets included, they are divided into two categories: one category contains only HC task sets. HC container One type contains only the LC mission set. LC container , For containers The operating cycle, For each running cycle Available time slice size within, It is a measure of the container Real-time parameters, For containers Memory usage; For the kernel The definition is as follows: Official (3) in, For kernel The total number of containers allocated, for those mapped in the kernel. HC container on have Numbered from 1 to For mapping in the kernel LC container on have Number arrive , Represents kernel memory capacity, It is a binary value representing the kernel. Is it in a critical state? The definition of the entire multi-core computing node is as follows: : Official (4) in, This represents the total number of cores in the entire node. and The mapping relationships between the HC container and the LC container and each kernel are recorded respectively. It is the migration controller in the node responsible for container migration; Container-level scheduling between containers is handled by the kernel controller, and the scheduling strategy is based on a rate-monotonic algorithm. Each container... Once the kernel usage is complete, the kernel usage rights are relinquished. Task-level scheduling within the container is handled by the container controller, which uses a rate-monotonic algorithm to schedule tasks based on their cycle time. The kernel controller has a higher priority than the container controller.

5. A task scheduling method for virtualized automotive electronic systems according to claim 1, characterized in that, The process by which the kernel preempts resources from containers other than those that failed to migrate: First, calculate the size of the time slice that needs to be preempted. The calculation formula is as follows: Official (17) Identify the preemption targets and allocate the LC containers according to their available time slices. Sort by size and select first. The larger container is the object of deprivation; Time slices are extracted sequentially until the time slice requirement can be met. ; Update the available time slices for each container based on the time slice preemption situation. ; View kernel Has it entered a critical state? If the kernel... When in a critical state, it is necessary not only to preempt the time slice of the LC container, but also to send a migration request to the node's container migration controller.

6. A task scheduling method for virtualized automotive electronic systems according to claim 1, characterized in that, The process of migrating the container: Node's container migration controller At the end of each running cycle, the remaining available time slices for each kernel are obtained. and remaining available memory Then with the container to be moved in The resource requirements are compared. If there are no kernels with sufficient resources, the migration request is rejected. If the requirements are met, the process proceeds to the next step. Will and The kernel with the largest value is used as the target kernel for migration, and the container is recorded at the same time. The various parameters; Before performing container migration, Container to be migrated Available time slices Setting the value to 0 blocks the container. Task execution within; Before creating a new container, store the original container. Destroy and release the kernel resources it occupies; It will be recorded according to the original container. The relevant parameters are retrieved from the target kernel and a new container is started. .

7. A task scheduling system suitable for virtualized automotive electronic systems, employing a task scheduling method suitable for virtualized automotive electronic systems as described in any one of claims 1 to 6, characterized in that, include: The resource pre-allocation module is used to obtain the mapping kernel of the container and pre-allocate the time slice and running cycle of the container based on the container's mapping kernel, wherein the container is pre-allocated computing resources and storage resources; The container migration module is used to obtain the resource usage of containers. The kernel periodically allocates or reclaims resources for containers based on their resource usage. When the kernel has no more resources, it performs a migration operation on the container. The resource reallocation module is used to, if migration fails, preempt the resources of other containers except the failed container and allocate the resources of other containers except the failed container to the failed container, and repeat the above operations in a loop to achieve task scheduling.

8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, The memory stores a computer program that can run on the processor. When the processor loads and executes the computer program, it employs a task scheduling method suitable for virtualized automotive electronic systems as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Electric power system supercomputing platform task scheduling method based on Docker container

    CN110457131A

  • Container cloud scheduling method based on periodic characteristics

    CN111367632A