Resource scheduling method and apparatus, and system

By inserting stubs into autonomous driving applications, computing resources are dynamically allocated at the function level, combined with thread dependencies and processor core binding, solving the problem of unreasonable resource scheduling in autonomous driving systems and achieving low-latency and high-security resource scheduling.

WO2025256541A1PCT designated stage Publication Date: 2025-12-18YINWANG INTELLIGENT TECHNOLOGIES CO LTD

Patent Information

Application Number
PCT/CN2025/100335
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-06-13
Filing Date
2025-06-11
Publication Date
2025-12-18

AI Technical Summary

Technical Problem

Existing technologies struggle to allocate resources effectively in autonomous driving systems, resulting in excessively long end-to-end latency, failing to meet low-latency requirements, and impacting the safety of vehicles and pedestrians.

Method used

By inserting stubs into autonomous driving applications, computing resources are dynamically allocated at the function level, combined with thread dependencies and processor core binding, to achieve dynamic, fine-grained resource scheduling and ensure rapid processing of critical data streams.

Benefits of technology

It effectively reduces end-to-end latency and latency jitter, improves the safety and user experience of autonomous driving systems, and ensures the safety of passengers inside the vehicle, pedestrians outside the vehicle, and other vehicles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025100335_18122025_PF_FP_ABST
    Figure CN2025100335_18122025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the field of intelligent driving. Provided are a resource scheduling method and apparatus, and a system. The method comprises: running a first application program, wherein the first application program comprises a first critical data stream, the first critical data stream is used for determining the output of the first application program, the first critical data stream is associated with N threads under M processes, the M processes comprise a first process, the first process is associated with a first thread, a first function and a first stub, and the first thread is used for running the first function, M and N being positive integers; and on the basis of the first stub, allocating a first computing resource to the first thread, wherein the first computing resource is used for the first thread to run the first function. On the basis of the method, computing resources can be reasonably allocated to threads under application nodes corresponding to different critical data streams in autonomous driving applications, thereby helping to reduce the end-to-end latency and latency jitter of critical data streams in autonomous driving systems, and further ensuring the safety of vehicle owners and pedestrians outside vehicles.
Need to check novelty before this filing date? Find Prior Art

Description

Method, device and system for resource scheduling

[0001] The present application claims priority to the Chinese patent application No. 202410765274.3, filed on June 13, 2024, and entitled "Method, device and system for resource scheduling", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD

[0002] The present application relates to the field of intelligent driving, in particular to a method, device and system for resource scheduling. BACKGROUND

[0003] In the automatic driving business, the end-to-end latency of the data flow link of the automatic driving system is a key indicator for measuring the corresponding speed of the automatic driving, and a low end-to-end latency (e.g., less than 100 ms) can greatly improve the safety factor of the vehicle and the pedestrian, and is a key target for optimization of the automatic driving system and application.

[0004] In the process of running the automatic driving application, the automatic driving system needs to allocate corresponding computing resources to realize different data flow link corresponding businesses, and how to reasonably schedule resources for different data flow link application nodes in the automatic driving application is a problem to be solved at present. SUMMARY

[0005] The embodiments of the present application provide a method, device and system for resource scheduling, which can reasonably allocate computing resources for threads under the application nodes corresponding to different key data flows in the automatic driving application, thereby helping to reduce the end-to-end latency and latency jitter of the key data flow of the automatic driving system, and further ensuring the safety of the vehicle owner and the pedestrian outside the vehicle.

[0006] In a first aspect, a method for resource scheduling is provided, the method comprising: running a first application program, the first application program comprising a first key data flow, the first key data flow being used to determine an output of the first application program, the first key data flow being associated with N threads under M processes, the M processes comprising a first process, the first process being associated with a first thread, a first function and a first stub point, the first thread being used to run the first function, M and N being positive integers; and allocating a first computing resource for the first thread according to the first stub point, the first computing resource being used for the first thread to run the first function.

[0007] By way of example, the method can be performed by an operating system.

[0008] Based on the above technical solution, after the operating system runs to the first stake point of the first application program, not only can the first function associated with the first stake point be determined as a key function, but also the first thread for running the first function can be allocated sufficient computing resources, i.e., the first computing resources, so that the first thread can efficiently and quickly run the first function with sufficient computing resources, and when the first thread runs other functions, the operating system can re-allocate computing resources to the first thread instead of continuing to allocate the first computing resources to the first thread, so that the operating system can dynamically allocate computing resources to the thread in function granularity, which helps to allocate more remaining resources to other threads running key functions, thereby helping to reduce the end-to-end latency of the first key data flow. Especially in the case of the first application program being an automatic driving application program, the user's driving experience can be effectively improved, and the safety of passengers in the vehicle, pedestrians outside the vehicle, and other vehicles can be ensured.

[0009] In combination with the first aspect, in some implementations of the first aspect, according to the first stake point, the capacity of the first computing resources is determined, and the first computing resources are allocated to the first thread according to the capacity of the first computing resources; or, according to the first stake point, the order of the first computing resources is determined, and the first computing resources are allocated to the first thread according to the order of the first computing resources; or, according to the first stake point, the first occupancy rate is determined, the first occupancy rate is used to represent the occupancy rate of the first computing resources in all computing resources, and the first computing resources are allocated to the first thread according to the first occupancy rate.

[0010] It should be understood that all the computing resources mentioned above refer to computing resources allocated within a first time range, and the first time range refers to a time range in which the running time of other threads overlaps with that of the first thread. Further, all the computing resources mentioned above refer to computing resources allocated to the first thread and other threads within the first time range. Based on this, since the first occupancy rate is calculated by a fraction, the denominator of the fraction can be used to represent the sum of the computing resources allocated to the other threads and the first computing resources within the first time range, and the numerator of the fraction is the first computing resources.

[0011] For example, after the first thread finishes running the first function, the operating system can retrieve the first computing resources allocated to the first thread or reduce the allocation of computing resources, and then re-allocate or adjust the computing resources allocated to the first thread for the first thread based on the method when the first thread runs other functions.

[0012] For example, the operating system can schedule the computing resources based on the priority, and the priority can be used to represent the capacity, order, or weight of the first computing resources allocated to the first thread.

[0013] Based on the technical solution, the first stake point indicates the capacity, sequence or weight of the first computing resource allocated by the operating system for the first thread, so that the first thread can obtain sufficient computing resources when running the first function corresponding to the first stake point, thereby enabling the operating system to implement function-granularity resource scheduling.

[0014] In some implementations of the first aspect, the first stake point is added to the first application during running of the first application, or the first stake point is added to the first application in advance before running of the first application.

[0015] For example, the first stake point described above can be a dynamic stake point or a static stake point, or can be replaced by a custom application programming interface (API).

[0016] Based on the technical solution, the stake point can be inserted into the first application in various ways, thereby increasing the flexibility of the stake point.

[0017] In some implementations of the first aspect, the first application further includes a second critical data flow for determining an output of the first application, the second critical data flow being associated with N threads in M processes, the M processes further including a second process, the second process being associated with a second thread, a second function and a second stake point, the second thread being used to run the second function, a first dependency relationship between the second thread and the first thread being determined according to a first configuration file, the first configuration file being used to indicate a dependency relationship between the M processes and / or the N threads; the second thread allocates a second computing resource according to the second stake point and the first dependency relationship, the second computing resource being used for the second thread to run the second function, in a case where the first dependency relationship is that the running of the first thread depends on the second thread, the first computing resource being more than the second computing resource, or in a case where the first dependency relationship is that the running of the second thread depends on the first thread, the first computing resource being less than the second computing resource.

[0018] It should be understood that the processes associated with the first critical data flow and the second critical data flow are the same, and it can also be understood that the second critical data flow is a mirror image of the first critical data flow.

[0019] For example, the first configuration file can be obtained by pre-experiment. For example, in an automatic driving application scenario, the first application is a program for implementing automatic driving services, and the first application is loaded on an automatic driving system. After deploying the first application on the automatic driving system, the vehicle can be controlled to run based on the first application. In this process, historical data of each thread running each function in the first application is generated. The historical data can include stub point information, timing of each thread running a function, dependency relationship between threads during the running of the function, and the like. By analyzing the historical data, the first configuration file can be determined to provide the operating system for subsequent resource scheduling. It should be understood that the automatic driving system is an application system, and the application system runs in the environment provided by the operating system.

[0020] Based on the above technical solution, by judging the dependency relationship between parallel threads, relatively more computing resources are provided for the dependent threads, which can reduce the end-to-end latency of the critical data flow where the dependent threads are located as much as possible, and can effectively avoid allocating sufficient computing resources to multiple parallel threads corresponding to multiple critical data flows at the same time, which leads to the problem that other parallel threads cannot run in a short period of time due to insufficient resources, thereby reducing the jitter of the end-to-end latency of multiple parallel critical data flows.

[0021] In combination with the first aspect, in some implementations of the first aspect, the first process is further associated with a third stub point, the third stub point is adjacent to the first stub point and located before the first stub point in the running timing of the first process, and the third computing resource is allocated to the first thread according to the third stub point, the third computing resource is less than or equal to the first computing resource, and the third computing resource is used to ensure that the first thread runs the first function.

[0022] For example, the third stub point can be set at the exit position of a third function before the first function in the timing. In the case that an exit stub point is set at the exit of the third function, the third stub point can be an exit stub point associated with the third function, that is, after executing the third function, the third stub point is directly run, thereby allocating the third computing resource to the first thread in advance.

[0023] Based on the above technical solution, the computing resources of the critical function can be effectively avoided from being preempted by other non-critical threads in advance, which leads to the situation that the critical function cannot be run as soon as possible. This is helpful to further reduce the end-to-end latency of the critical data flow transmission.

[0024] With reference to the first aspect, in some implementations of the first aspect, the first thread is bound to the first processor core and the second processor core respectively, the first processor core and the second processor core are configured to provide the first computing resource for the first thread respectively, a first resource occupancy rate of the first processor core providing the first computing resource for the first thread is predicted, if the first resource occupancy rate is less than or equal to a first threshold, the first computing resource is provided for the first thread by the first processor core, and if the first resource occupancy rate is greater than the first threshold, a second resource occupancy rate of the second processor core providing the first computing resource for the first thread is predicted, and if the second resource occupancy rate is less than or equal to the first threshold, the first computing resource is provided for the first thread by the second processor core.

[0025] With reference to the first aspect, in some implementations of the first aspect, if the second resource occupancy rate is greater than the first threshold, a third resource occupancy rate of a third processor core providing the first computing resource for the first thread is predicted, the third processor core is not bound to the first thread, and if the third resource occupancy rate is less than or equal to the first threshold, the first computing resource is provided for the first thread by the third processor core.

[0026] For example, the first threshold can be a threshold preset according to hardware performance of an operating system.

[0027] Based on the above technical solution, the situation that multiple threads preempt the computing resource of a processor core can be avoided, which helps to improve the efficiency of the system running the first application program and reduce the end-to-end delay of data flow transmission in the key process link.

[0028] With reference to the first aspect, in some implementations of the first aspect, at a starting time of the first thread running the first function, a first timer is started, and a time length set by the first timer is greater than or equal to a time length required for running the first function completely, and in a case that the first timer expires and the first function is not run completely, the first computing resource allocated to the first thread is reduced.

[0029] Based on the above technical solution, the situation that the thread bound to the key function preempts the processor resource for a long time due to the key function falling into a dead loop or other abnormal state can be effectively avoided, so that the allocation of computing resources is more reasonable.

[0030] With reference to the first aspect, in some implementations of the first aspect, the first application program further includes a fourth function, a first running time period is obtained, the first running time period is greater than or equal to a time length required for running the fourth function completely, and within the first running time period from a time of running the fourth function, a fourth computing resource is allocated to a thread for running the fourth function, the fourth computing resource is greater than or equal to the first computing resource.

[0031] For example, the first running period can be obtained through external input or preset before system running.

[0032] Based on the above technical solution, the computing resources for running the non-critical function can be prevented from being preempted by the thread where the critical function is located for a long time, so that the non-critical function is prevented from failing. Thus, the functional integrity of the first application program is guaranteed, and especially when the first application program is an automatic driving application program, the driving experience of the user can be improved.

[0033] In a second aspect, a method for processing an application program is provided. The method is used for processing a first application program, and the first application program is run by an operating system. The operating system is configured to assign a first computing resource to a thread for running a function in the first application program by default. The method comprises the following steps: adding N number of stakes in the first application program, N is a positive integer, the N number of stakes are respectively associated with N number of critical functions in the first application program, the critical function is associated with a critical data flow, the critical data flow is used to determine an output of the first application program, the critical function is used to determine an output of the critical data flow, and the stake is used to instruct to assign a second computing resource to the thread for running the critical function, and the second computing resource is more than the first computing resource.

[0034] For example, the operating system can be a Linux operating system or a Windows system, and the embodiments of the present application do not limit this.

[0035] For example, the operating system can set a priority for the thread for running the first application program, and the priority corresponding to the thread determines how much computing resource is assigned to the thread by the operating system. Therefore, the operating system can realize the scheduling of the computing resource of the thread by setting the priority of the thread.

[0036] Based on the above technical solution, by adding the stake corresponding to the critical function in the first application program, when the system runs to the stake, the thread for running the critical function can be dynamically scheduled in real time, or the thread for running the critical function can be assigned with a specified computing resource, so that the thread can have sufficient computing resource to complete the running of the critical function. Thus, the operating system can dynamically assign the computing resource to the thread in function granularity, and the critical process link in the application program can be run as soon as possible, and the end-to-end delay of the data flow in the critical link is reduced.

[0037] In some implementations of the second aspect, in combination with the second aspect, a first warm-up probe point is added between the first pre-function and the first probe point, wherein the runtime sequence of the first pre-function is before and adjacent to the first function, the first function is one of the N critical functions, the first function is associated with the first probe point, the first probe point is one of the N probes, and the first warm-up probe point is used to instruct to allocate a third computing resource for a thread used to run the first function, the third computing resource being less than or equal to the second computing resource.

[0038] Based on the above technical solution, due to the introduction of the warm-up probe point, after the first pre-function is executed, the operating system can run to the first warm-up probe point before running to the first function as a critical function, so as to allocate corresponding computing resources for a thread used to run the first function in advance based on the instruction of the first warm-up probe point, so as to ensure that the thread has computing resources for running the first function, thereby effectively avoiding that the computing resources used to run the first function are preempted by other critical functions when the system runs to the first function, thereby ensuring the running of the first function.

[0039] In some implementations of the second aspect, in combination with the second aspect, the first application program is run to obtain historical data, the historical data being used to indicate the runtime sequence of a plurality of processes and / or a plurality of threads participating in running the first application program; and the first configuration file is generated according to the historical data, the first configuration file being used to indicate the dependency relationship between the plurality of processes and / or the plurality of threads, and the first configuration file being further used to determine the second computing resource.

[0040] In the third aspect, a resource scheduling apparatus is provided, which comprises: a running unit configured to run a first application program, the first application program comprising a first critical data flow, the first critical data flow being used to determine the output of the first application program, the first critical data flow being associated with N threads under M processes, the M processes comprising a first process, the first process being associated with a first thread, a first function, and a first probe point, the first thread being used to run the first function, M and N being positive integers; and a first operation unit configured to allocate a first computing resource for the first thread according to the first probe point, the first computing resource being used for the first thread to run the first function.

[0041] In some implementations of the third aspect, the first operation unit is configured to: determine a capacity of the first computing resource according to the first stake point, and allocate the first computing resource to the first thread according to the capacity of the first computing resource; or determine an order of the first computing resource according to the first stake point, and allocate the first computing resource to the first thread according to the order of the first computing resource; or determine a first occupancy rate according to the first stake point, the first occupancy rate indicating an occupancy rate of the first computing resource in all computing resources, and allocate the first computing resource to the first thread according to the first occupancy rate.

[0042] In some implementations of the third aspect, the first stake point is added to the first application during running of the first application, or the first stake point is added to the first application in advance before running of the first application.

[0043] In some implementations of the third aspect, the first application further comprises a second critical data flow used to determine an output of the first application, the second critical data flow being associated with N threads in M processes, the M processes further comprising a second process, the second process being associated with a second thread, a second function, and a second stake point, the second thread being used to run the second function, the apparatus further comprising a determination unit configured to determine a first dependency relationship between the first thread and the second thread according to a first configuration file, the first configuration file being used to indicate a dependency relationship between the M processes and / or the N threads, and the first operation unit is further configured to allocate a second computing resource to the second thread according to the second stake point and the first dependency relationship, the second computing resource being used for running the second function by the second thread, the first computing resource being more than the second computing resource in a case where the first dependency relationship is that running of the first thread depends on running of the second thread, or the first computing resource being less than the second computing resource in a case where the first dependency relationship is that running of the second thread depends on running of the first thread.

[0044] In some implementations of the third aspect, the first process is further associated with a third stake point, the third stake point being adjacent to the first stake point and being located before the first stake point in a running sequence of the first process, and the first operation unit is further configured to allocate a third computing resource to the first thread according to the third stake point, the third computing resource being less than or equal to the first computing resource, and the third computing resource being used to ensure running of the first function by the first thread.

[0045] In some embodiments of the third aspect, the first thread is bound to the first processor core and the second processor core respectively, the first processor core and the second processor core are configured to provide the first computing resource for the first thread, and the apparatus further includes a prediction unit configured to predict a first resource occupancy of the first processor core after the first processor core provides the first computing resource for the first thread; in a case where the first resource occupancy is greater than a first threshold, the prediction unit is further configured to predict a second resource occupancy of the second processor core after the second processor core provides the first computing resource for the first thread; in a case where the second resource occupancy is less than or equal to the first threshold, the first operation unit is specifically configured to provide the first computing resource for the first thread by the second processor core; or in a case where the second resource occupancy is greater than the first threshold, the prediction unit is further configured to predict a third resource occupancy of a third processor core after the third processor core provides the first computing resource for the first thread, the third processor core being unbound to the first thread; in a case where the third resource occupancy is less than or equal to the first threshold, the first operation unit is specifically configured to provide the first computing resource for the first thread by the third processor core.

[0046] In some embodiments of the third aspect, the apparatus further includes a second operation unit configured to start a first timer at a starting time point of the first thread running the first function, the first timer being set to a time period greater than or equal to a time period required for running the first function completely; and the first operation unit is further configured to reduce the first computing resource allocated to the first thread in a case where the first timer expires and the first function is not run completely.

[0047] In some embodiments of the third aspect, the first application further includes a fourth function, and the apparatus further includes an acquisition unit configured to acquire a preset first running time period, the first running time period being greater than or equal to a time period required for running the fourth function completely; and the first operation unit is further configured to allocate a fourth computing resource to a thread running the fourth function within the first running time period from a time point of running the fourth function, the fourth computing resource being greater than or equal to the first computing resource.

[0048] In a fourth aspect, an apparatus for processing an application is provided, the apparatus being configured to process a first application, the first application being run by an operating system, and the operating system being configured to allocate a first computing resource to a thread running a function in the first application by default, the apparatus including a patching unit configured to add N patches in the first application, N being a positive integer, the N patches being associated with N key functions in the first application respectively, a key function being associated with a key data flow, the key data flow being configured to determine an output of the first application, the key function being configured to determine an output of the key data flow, and the patch being configured to indicate that a second computing resource is allocated to a thread running the key function, the second computing resource being greater than the first computing resource.

[0049] In some embodiments of the fourth aspect, the inserting unit is further configured to insert a first warm-up probe point between the first pre-function and the first probe point, wherein the first pre-function is executed before and adjacent to a first function of the N critical functions, the first function is associated with the first probe point, the first probe point is one of the N probe points, and the first warm-up probe point is configured to indicate that a third computing resource is allocated to a thread for executing the first function, the third computing resource being less than or equal to the second computing resource.

[0050] In some embodiments of the fourth aspect, the apparatus further comprises an executing unit configured to execute the first application to obtain historical data, the historical data being configured to indicate a runtime sequence of a plurality of processes and / or a plurality of threads participating in executing the first application; and a processing unit configured to generate a first configuration file based on the historical data, the first configuration file being configured to indicate a dependency relationship between the plurality of processes and / or the plurality of threads, and the first configuration file being further configured to determine the second computing resource.

[0051] In the fifth aspect, an electronic device is provided, which comprises a processor and a memory, wherein the processor and the memory are connected, the memory is configured to store program code, and the processor is configured to invoke the program code to execute the method in any one of the possible implementation manners of the method design of the first aspect or the method in any one of the possible implementation manners of the method design of the second aspect.

[0052] In the sixth aspect, an automatic driving system is provided, which comprises a first operating system configured to execute the method in any one of the possible implementation manners of the method design of the first aspect.

[0053] In some embodiments of the sixth aspect, the first operating system is further configured to execute the first application to obtain historical data, the historical data being configured to indicate a runtime sequence of M processes and / or N threads participating in executing the first application; and generate a first configuration file based on the historical data, the first configuration file being configured to indicate a dependency relationship between the M processes and / or the N threads.

[0054] In the seventh aspect, a vehicle is provided, which comprises the automatic driving system in any one of the possible implementation manners of the system design of the sixth aspect.

[0055] In an eighth aspect, a chip system is provided, which is applied to an electronic device. The chip system comprises one or more interface circuits and one or more processors. The interface circuits and the processors are connected through lines. The interface circuits are configured to receive signals from a memory of the electronic device and send signals to the processors, the signals comprising computer instructions stored in the memory. When the processors execute the computer instructions, the electronic device executes the method in any possible implementation manner of the method design of the first aspect or executes the method in any possible implementation manner of the method design of the second aspect.

[0056] In a ninth aspect, a computer readable storage medium is provided, which stores computer programs or instructions for implementing the method in any possible implementation manner of the method design of the first aspect or implementing the method in any possible implementation manner of the method design of the second aspect.

[0057] In a tenth aspect, a computer program product is provided, which, when executed on a computer, causes the computer to execute the method in any possible implementation manner of the method design of the first aspect or execute the method in any possible implementation manner of the method design of the second aspect. BRIEF DESCRIPTION OF DRAWINGS

[0058] FIG. 1 is a functional schematic block diagram of a vehicle 100 according to an embodiment of the present application;

[0059] FIG. 2 is an architecture schematic diagram of an autonomous driving system 200 according to an embodiment of the present application;

[0060] FIG. 3 is a running schematic diagram of a timing perception layer and a resource regulation layer according to an embodiment of the present application;

[0061] FIG. 4 is a flow schematic diagram of a resource scheduling method 400 according to an embodiment of the present application;

[0062] FIG. 5 is a schematic diagram of another resource scheduling method 500 according to an embodiment of the present application;

[0063] FIG. 6 is a principle schematic diagram of another resource scheduling method 600 according to an embodiment of the present application;

[0064] FIG. 7 is a principle schematic diagram of a processor core binding method 700 according to an embodiment of the present application;

[0065] FIG. 8 is a schematic block diagram of a resource scheduling apparatus 800 according to an embodiment of the present application;

[0066] FIG. 9 is a schematic block diagram of an application processing apparatus 900 according to an embodiment of the present application. DETAILED DESCRIPTION

[0067] The technical solutions in the embodiments of the present application will be described below with reference to the drawings.

[0068] The embodiments of the present application will present various aspects, embodiments or features around a system including a plurality of devices, components, modules, etc. It should be understood and appreciated that each system can include additional devices, components, modules, etc., and / or can not include all of the devices, components, modules, etc. discussed in connection with the drawings. Furthermore, combinations of these aspects can also be used.

[0069] In addition, in the embodiments of the present application, the words "example" or "for example" are used to mean serving as an example, instance, or illustration. Any implementation described as "example" in the embodiments of the present application is not necessarily to be construed as preferred or advantageous over other implementations. Rather, use of the word example is intended to present concepts in a concrete manner.

[0070] The business scenarios described in the embodiments of the present application are to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, as technology evolves and new business scenarios appear, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.

[0071] In this specification, the reference "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrase "in one embodiment" or "in some embodiments" in various places in this specification are not necessarily all referring to the same embodiment, but can refer to one or more but not all embodiments, unless otherwise specified. The terms "including," "comprising," "having," and variations thereof, mean "including but not limited to," unless expressly specified otherwise.

[0072] In the embodiments of the present application, "at least one" means one or more, and "multiple" means two or more. The "and / or" describes the association relationship of the associated objects, which means that there can be three kinds of relationships, for example, A and / or B can represent: including the case of A alone, the case of A and B together, and the case of B alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the front and rear associated objects. "At least one of the following" or similar expressions means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, and c can be single or multiple.

[0073] The technical solutions in the embodiments of the present application can be applied to computing devices, such as servers, hosts, personal computers, notebook computers, desktop computers, and other devices with computing capabilities. The technical solutions in the embodiments of the present application can be applied to computing devices including heterogeneous chips or embedded chips.

[0074] For ease of understanding, the related terms and concepts related to the embodiments of the present application are introduced below. The terms used in the embodiments of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0075] Autonomous driving intelligent operating system: an operating system based on the portable operating system interface (POSIX) standard, suitable for high-performance computing and high-bandwidth communication required by autonomous driving, providing functions such as vehicle environment perception, intelligent decision-making, and path planning.

[0076] Application node: in the autonomous driving intelligent operating system, an application with specific autonomous driving functions (such as perception, fusion, and planning) encapsulated using a communication middleware, which is usually a collection of single-process, multi-threaded processes. Both parties or multiple parties of the node implement the transmission of messages and service calls between processes or components through the message sending and receiving API of the communication middleware. Among them, the communication middleware can be a communication management (CM) module in the robot operating system (ROS) and the automotive open system architecture (AUTOSAR CM).

[0077] Key link: Some process links connected by application nodes that determine the system or application output, for example, the link formed by the processes that process sensor signals to form controller signals in an autonomous driving system, which determines the control content included in the controller signals, and this link can be defined as a key link, or a key process link, or a key node link. The application nodes that make up the key link can be referred to as key nodes or key processes, and some threads in the key process that participate in the key link business can also be referred to as key threads, and some functions called by the key thread that participate in the key link business, such as subscription, callback, and publishing business functions in the autonomous driving system communication business, can be referred to as key functions.

[0078] It should be understood that, among all the process links included in the application program, the links other than the key link can be referred to as non-key links; among all the threads included in the key process / node, the threads other than the key thread can be referred to as non-key threads; among all the functions called by the key thread, the functions other than the key function can be referred to as non-key functions. Among them, the key process / node includes key threads and non-key threads, and the non-key process / node only includes non-key threads; the key thread can call key functions and non-key functions, and the non-key thread can only call non-key functions.

[0079] Message channel (topic): In the autonomous driving intelligent operating system, a designated communication channel between application nodes, which includes the sender's sending port, the receiver's receiving port, the channel name, the message format, etc.

[0080] End-to-end latency: In the autonomous driving system and application, in a broad sense, it refers to the time delay from the beginning of the sensor receiving the signal (such as an image) to the end of the chassis actuator executing a specific action (such as braking); in a narrow sense, it refers to the time delay from the beginning of the mobile data center (MDC) receiving the topic data packet sent by the sensor to the end of sending the data packet to the chassis control topic. The time delay of the data flow through the key link can be understood as the end-to-end latency.

[0081] Stake code: Code inserted at any position in an existing application program, which is used to provide a specific way to observe or modify the application program, and the position of the stake code inserted in the application program is called a stake or message stake. When the application program runs to the stake, it triggers the execution of the stake code, so that the application program performs the specific operation included in the stake code, so the stake can also be used to indicate the triggering of the specific operation in the stake code. Therefore, the stake code can also be referred to as the stake.

[0082] The action of inserting a probe into an application can be referred to as instrumentation. There are two main types of probes: dynamic probes and static probes. The action of inserting probes can be further referred to as dynamic instrumentation or static instrumentation, depending on the type of probes inserted. If the application is a binary program, the action of inserting probes can be referred to as binary instrumentation. The action of inserting probes can be further referred to as dynamic binary instrumentation or static binary instrumentation, depending on the type of probes inserted.

[0083] FIG. 1 is a functional schematic block diagram of a vehicle 100 according to an embodiment of the present application.

[0084] The vehicle 100 can include a perception system 120, a display device 130, and a computing platform 150. The perception system 120 can include several types of sensors that sense information about the environment surrounding the vehicle 100. For example, the perception system 120 can include a positioning system, which can be a global positioning system (GPS), a Beidou system, or other positioning system, an inertial measurement unit (IMU), a laser radar, a millimeter wave radar, an ultrasonic radar, and a camera.

[0085] Some or all of the functionality of vehicle 100 can be controlled by computing platform 150. Computing platform 150 can include processors 151-15n (n is a positive integer), which are circuits that have the capability to process signals. In one implementation, a processor can be a circuit that has the capability to read and execute instructions, such as a central processing unit (CPU), a microprocessor, a graphics processing unit (GPU) (which can be understood as a kind of microprocessor), or a digital signal processor (DSP). In another implementation, a processor can be a circuit that implements certain functionality through a fixed or reconfigurable logical relationship of hardware circuits, such as an application-specific integrated circuit (ASIC) or a programmable logic device (PLD) implemented hardware circuit, such as a field programmable gate array (FPGA). In a reconfigurable hardware circuit, a processor loads a configuration document to implement the configuration of the hardware circuit, which can be understood as a process in which the processor loads instructions to implement the functionality of some or all of the units described above. In addition, it can also be a hardware circuit designed for artificial intelligence, which can be understood as a kind of ASIC, such as a neural network processing unit (NPU), a tensor processing unit (TPU), a deep learning processing unit (DPU), etc. In addition, computing platform 150 can also include a memory for storing instructions, and some or all of processors 151-15n can call the instructions in the memory to implement the corresponding functions described in the embodiments of the present application.

[0086] The vehicle involved in the present application can include a road vehicle, a water vehicle, an air vehicle, an industrial device, an agricultural device, or an entertainment device, etc. For example, the vehicle can include an unmanned vehicle, which is a vehicle in a broad sense, and can be a vehicle (such as a commercial vehicle, a passenger vehicle, a motorcycle, a flying vehicle, a train, etc.), an industrial vehicle (such as a forklift, a trailer, a tractor, etc.), an engineering vehicle (such as an excavator, a bulldozer, a crane, etc.), an agricultural device (such as a mower, a harvester, etc.), an amusement device, a toy vehicle, etc. The type of vehicle is not limited in the embodiments of the present application. For the convenience of description, the embodiments of the present application will be described in detail taking an autonomous vehicle as an example.

[0087] In the automatic driving business, the end-to-end latency of the data flow link of the automatic driving system is a key indicator for measuring the corresponding speed of automatic driving. A low end-to-end latency (e.g., less than 100 ms) can greatly improve the safety factor of vehicles and pedestrians. Therefore, the end-to-end latency is a key target for optimization of the automatic driving system and application.

[0088] In the process of running the automatic driving application, the automatic driving system needs to allocate corresponding computing resources to realize different data flow links corresponding to the business. Whether the computing resource allocation is reasonable also affects the end-to-end latency of the overall data transmission of the automatic driving system.

[0089] The traditional vehicle machine system is usually based on the AUTOSAR classic (CP) platform application. The application function under this architecture is simple and the running time sequence is relatively determined. In order to maintain the end-to-end latency of the system and application data transmission at a low level, the original equipment manufacturer (OEM) host factory sets different static priority configurations for the application nodes under each key link in the system to ensure that the time sequence of the application nodes of all key links is not interrupted or affected, and finally achieves the goal of the lowest latency.

[0090] However, the above scheme is basically only for some common working conditions and universal environment, and pre-configures the parameters related to system resource scheduling. It is difficult to adaptively and dynamically adjust to different scenarios encountered by the automatic driving vehicle during driving. The generalization of the scheme is insufficient.

[0091] In order to better meet the real-time requirements of tasks, a solution has been proposed at the present stage. The solution estimates the running time of the application program on the embedded platform, and then maps the program to the hardware resources based on the application program automatic mapping algorithm. In the process of running the program, the system can allocate corresponding resources to each program according to the mapping relationship, and combine the simulated annealing algorithm and the earliest deadline first (EDF) scheduling simulation algorithm to generate a static task scheduling table and a task binding core scheme, so that each central processing unit (CPU) core of the system can smoothly run its own program, thereby better meeting the real-time requirements of tasks.

[0092] However, the above scheme only optimizes the resource scheduling scheme of the CPU and does not consider the scheduling optimization of other hardware resources such as graphics processing units (GPUs). Moreover, the above scheme is essentially a static scheduling scheme, and the automatic driving business is too complex. Mapping the business of different scenarios and resource configuration, making the scheduler perceive the processes corresponding to these businesses, and making the most reasonable resource scheduling for these processes, usually due to the limitations of the number of scenario samples and the limitations of the scheduling algorithm capability, the above mapping is distorted, and it is difficult to achieve the overall optimization of system resource scheduling.

[0093] Based on the above description, it can be seen that the resource scheduling technology in the automatic driving application scenario at the present stage has the following problems:

[0094] 1. A large amount of real vehicle measurement data is needed as a theoretical support to complete modeling, simulation and model optimization. This requires high precision of training data and high generalization degree of training scenarios, and it takes a long time from data acquisition to output of the scheduling model, which is difficult to execute and has high time cost.

[0095] 2. The object granularity of resource scheduling is too large, usually process or thread granularity, but in some processes, the importance of some threads is not high, or in some threads, the importance of some functions is not high, but after the corresponding process or thread is regarded as a key process or key thread in the system, these non-key threads associated with the key process or non-key functions associated with the key thread will also be allocated too much resources to run, so the resource scheduling is not overall optimal.

[0096] 3. Offline scheduling is difficult to fully meet the needs of dynamically adjusting resource scheduling strategies in various scenarios of automatic driving business.

[0097] Therefore, the embodiments of the present application propose a resource scheduling method, device and system, aiming to solve the above-mentioned problems from the bottom of system resource scheduling, and provide a dynamic and fine-grained resource scheduling mechanism.

[0098] FIG. 2 is an architecture diagram of an automatic driving system 200 according to an embodiment of the present application.

[0099] The system 200 can include an application layer, a platform layer and a hardware layer.

[0100] The application layer includes an autonomous driving node layer, which is configured to collect signals such as lidar, camera, radar, etc. from autonomous vehicle sensors, and perform data processing using autonomous driving algorithms to infer the current position, state and external state of the autonomous vehicle, and vehicle control signals or instructions.

[0101] The autonomous driving node layer further includes a perception node, a fusion node, a planning node and a control node.

[0102] The perception node is configured to execute processes related to sensor signals to obtain signals such as lidar, camera, radar, etc. The fusion node is configured to perform data fusion on data carried in the sensor signals using autonomous driving algorithms to infer the current position, state and external state of the autonomous vehicle. The planning node is configured to plan a control strategy for the vehicle for the next time period based on the data fusion result. The control node is configured to control corresponding vehicle controllers such as steering wheel, brake, throttle, etc. based on the control strategy to complete automatic control of the vehicle.

[0103] The platform layer, also referred to as the operating system (OS) layer, includes a timing awareness layer, a resource regulation layer and an OS subsystem related to autonomous driving applications.

[0104] The timing awareness layer is configured to determine the runtime state information of each application of the autonomous driving system through dynamic stubs, static stubs or business call APIs, etc. The runtime state information includes the running state of each thread in different applications, thread data, running dependency relationship between processes and threads, and the current computing resource occupation of each thread and / or process.

[0105] The resource regulation layer is configured to perform unified calling and distribution of various computing resources in the autonomous driving OS, wherein the computing resources also referred to as resources for computing, include CPU computing resources, GPU computing resources, memory resources, bus bandwidth resources, network bandwidth resources and input / output (IO) resources, etc.

[0106] The OS subsystem is configured to perform abstraction and management of autonomous driving hardware resources, and the OS subsystem includes an OS scheduling subsystem, a GPU driver, a DDR driver, a network driver, etc.

[0107] In the system 200, the following hardware modules are also involved: CPU, GPU, memory, network card and storage. The storage refers to external storage such as disk, etc.

[0108] The CPU and the GPU are used to provide computing power resources for the automatic driving system 200 and the in-system application; the memory is used to provide memory resources for the automatic driving system 200 and the in-system application; the network card is used to provide network communication resources for the automatic driving system 200 and the in-system application; and the storage is used to provide general storage resources for the automatic driving system 200 and the in-system application.

[0109] In some possible embodiments, the automatic driving application layer can obtain, through the automatic driving platform layer, resources such as CPU, GPU, memory, network card, and storage on the hardware platform to ensure that the vehicle can be automatically driven. The timing perception layer can obtain the running timing state information of each application in the automatic driving application layer, and then deliver the information to the resource regulation layer. The resource regulation layer can dynamically allocate computing resources to the application nodes of the critical data flow link in real time, so as to reduce the end-to-end delay of data flow transmission of the automatic driving system as much as possible.

[0110] For the convenience of understanding, the running mechanism of the timing perception layer and the resource regulation layer in the system 200 described above is described in detail below.

[0111] FIG. 3 is a running schematic diagram of the timing perception layer and the resource regulation layer according to an embodiment of the present application.

[0112] In some possible embodiments, before the application program of the automatic driving system is run, N piece of stub code can be added in the application program in advance, N being a positive integer, and the N piece of stub code being respectively used to indicate that the corresponding function needs to be given more resources by the automatic driving system to run.

[0113] In some possible embodiments, in the resource scheduling mechanism of the automatic driving system, the automatic driving system usually allocates computing resources to each thread based on the priority of the thread. When the automatic driving system initially runs the application program, the automatic driving system allocates resources to each thread for running the application program based on the fair scheduling method. However, the introduction of the stub code enables the automatic driving system to adjust the scheduling scheme of the thread for running the stub code associated function to privileged scheduling, that is, the resource scheduling priority (hereinafter referred to as priority) of the thread for running the function is improved, which is higher than the priority under the fair scheduling method. The higher the priority of the function, the more resources the automatic driving system allocates to the thread for running the function.

[0114] In some possible embodiments, the fair scheduling method described above can be a completely fair scheduler (CFS), and the privileged scheduling described above can be a round robin (RR) scheduling or a real time (RT) scheduling. The minimum priority of the privileged scheduling is greater than the maximum priority of the fair scheduling.

[0115] Referring to FIG. 3, the link under the automatic driving application layer shown in FIG. 3 is a key link (also referred to as a key data flow), and the perception node of the key link is taken as an example. The perception node is a key node, and the perception node includes three key threads for executing the subscription, callback, and publishing services in the communication service of the automatic driving system. The functions for executing the three services correspond to one stake point respectively. For convenience of description, the subscription function is denoted as function 1, the corresponding stake point is denoted as stake point 1, the callback function is denoted as function 2, the corresponding stake point is denoted as stake point 2, and the publishing function is denoted as function 3, and the corresponding stake point is denoted as stake point 3.

[0116] In some possible embodiments, the stake point can carry some stake point information in addition to being used to indicate that more resources are allocated to a specific function. Taking stake point information 1 as an example, the stake point information 1 can include a stake point identifier (ID), a time sequence frame ID of the stake point 1 in the entire time sequence of the system running application program, a thread identifier (TID) of the thread in which the stake point 1 is located, a process identifier (PID) of the process in which the stake point 1 is located, and a thread that depends on the thread 1 for running the function 1, for example, a thread 2 for running the function 2. The dependency relationship can be that the thread 2 depends on the thread 1, and so on. The stake point information 2 and the stake point information 3 are the same.

[0117] It should be understood that the value of the time sequence frame ID corresponds to the position of the time sequence frame in the entire application program running time sequence, for example, the smaller the time sequence frame ID, the earlier the time sequence frame in the entire application program running time sequence.

[0118] When the application program is run to the stake point 1 in the automatic driving application layer, the stake point information 1 carried by the stake point 1 can be added to the time sequence perception queue of the time sequence perception layer; similarly, when the application program is run to the stake point 2 in the automatic driving application layer, the stake point information 1 carried by the stake point 2 can be added to the time sequence perception queue of the time sequence perception layer; and when the application program is run to the stake point 3 in the automatic driving application layer, the stake point information 3 carried by the stake point 3 can be added to the time sequence perception queue of the time sequence perception layer.

[0119] In some possible embodiments, in the process of adding each stake point information to the time-aware queue at the time-aware layer, the running time of each stake point can be determined based on the time frame ID included in the stake point information, and then the running time information of the function corresponding to each stake point can be determined, and each stake point information can be inserted into the time-aware queue in the corresponding order according to the running time information.

[0120] For example, if stake point 1 is before stake point 2 and stake point 3 is after stake point 2, then in the time-aware queue, stake point information 1 is inserted before stake point information 2, and stake point information 3 is inserted after stake point information 2.

[0121] In some possible embodiments, the entity form of the time-aware queue can be a ring buffer, and can also be replaced by other data storage structures, which are not limited in the embodiments of the present application.

[0122] In some possible embodiments, the time-aware queue can be stored in a piece of memory space shared by the user state and the kernel state.

[0123] In some possible embodiments, the system 200 can also perceive whether the scenario of automatic driving of the vehicle is switched through the sensor, and when the scenario of automatic driving of the vehicle is switched, the scenario information after the switching can also be transmitted to the resource regulation layer as part of the basis for resource scheduling.

[0124] Further, the resource regulation layer reads the stake point information from the time-aware queue in sequence, and the running time information of the function corresponding to each stake point can be determined by reading the order of each stake point information. Then, the topology information between each stake point can be determined according to each stake point information. Then, the time-aware scheduler in the resource regulation layer can determine the resource scheduling scheme according to the running time information and the topology information, or according to the running time information, the topology information and the scenario information after the switching, for example, set the CPU scheduling priority for each function corresponding to the stake point, and then configure the corresponding computing resource for the thread where each function is located.

[0125] In some possible embodiments, the stake point can also be replaced by a corresponding custom API, and the function of the API can be defined as the same as the above-described stake point.

[0126] In some possible embodiments, considering that there are multiple key links in the automatic driving application, the key links are independent of each other or dependent of each other, or even the running of some key links depends on the running result of a thread or function of other key links. In order to realize reasonable allocation of resources for each key link by the automatic driving system, the resource regulation layer can maintain a data flow timing table for each key link according to the running timing and topological relationship of each process, each thread and each function under each key link, so as to reflect the running timing state of different key links, and then the timing-aware scheduler of the resource regulation layer can determine the overall resource scheduling scheme according to each data flow timing table, and then configure the corresponding computing resources for each thread corresponding to the function.

[0127] It should be understood that when the key function associated with the stake point is running, the system can allocate more computing resources to the thread running the key function based on the aforementioned resource scheduling scheme, and when the key function is completed, the system can actively withdraw the computing resources allocated to the thread, and determine whether to continue to provide more computing resources to the thread according to whether the function executed subsequently by the thread is associated with the stake point.

[0128] In some possible embodiments, the stake point information, the running timing information of the function, the topological information between the stake points, the data flow timing chain table and the resource scheduling scheme mentioned in the above embodiments can be in the form of a configuration file and delivered to the OS subsystem. When the OS subsystem starts, the OS subsystem can read the above-mentioned configuration file, so as to realize automatic collection and perception of the automatic driving application running timing information by the OS subsystem in the process of running the automatic driving system, and dynamically adjust the priority of each thread in the key thread group under the key link node in combination with the above-mentioned configuration file.

[0129] Based on the above technical solutions, the resource scheduling mechanism based on the system 200 ensures that the key thread group can obtain appropriate computing resources, thereby reducing the end-to-end delay of the data flow link of the automatic driving system. Moreover, the stake point indicates that more computing resources are allocated to the thread for implementing the key function, and it can be seen that the object of the resource scheduling optimization of the process is the function granularity, which avoids the problem that the key thread is also excessively allocated more resources when running a non-key function, and helps to make the system resource scheduling strategy optimal as a whole. In addition, because the automatic driving system needs to run different application programs in different application scenarios, and different application programs will correspondingly maintain a corresponding number of data flow timing tables, and these real-time maintained data flow timing tables are the basis for determining the resource scheduling scheme, the system 200 can realize real-time dynamic adjustment of the resource scheduling scheme, meet the demand of dynamically adjusting the resource scheduling strategy in various scenarios of the automatic driving business, and does not need a large amount of real vehicle measurement data as the basis for determining the resource scheduling scheme, which has low difficulty and time cost.

[0130] Based on the foregoing embodiments, during the running of the application program, the system 200 can adopt the corresponding resource scheduling strategy for some key thread groups of the application program. This is because the system 200 is pre-configured with the stub point code corresponding to the key functions in the key link in the application program before running the application program of the autonomous driving system, so as to instruct the system 200 to give sufficient computing resources to the key functions corresponding to the stub point code.

[0131] Therefore, the embodiments of the present application propose a method for processing an application program, so that the system can allocate computing resources to the corresponding key functions through the stub points in the application program when running the application program.

[0132] For example, the first application program is run by an operating system, which can be the operating system in the system 200 in the foregoing embodiments. The operating system allocates the first computing resources to the threads for running the functions in the first application program by default.

[0133] In some possible embodiments, N stub points can be added in the first application program, where N is a positive integer, the N stub points are respectively associated with N key functions in the first application program, the key functions are associated with key data streams, the key data streams are used to determine the output of the first application program, the key functions are used to determine the output of the key data streams, and the stub points are used to instruct to allocate the second computing resources to the threads for running the key functions, where the second computing resources are more than the first computing resources.

[0134] For example, the operating system can be a Linux operating system or a Windows system, and the embodiments of the present application do not limit this.

[0135] In some possible embodiments, the operating system can set the priority of the threads for running the first application program, and the priority corresponding to the threads determines how much computing resources are allocated to the threads by the operating system. Therefore, the operating system can schedule the computing resources of the threads by setting the priority of the threads.

[0136] Generally, at the initial time of running the first application program, the operating system will adopt a fair scheduling scheme by default. Under the fair scheduling scheme, the system also needs to set the priority of the threads for running the functions in the first application program to belong to the first priority interval. At the initial time of resource scheduling of the operating system, the priorities corresponding to the threads are the same default value. During the running of the first application program by the operating system, the logical functional units in the operating system can change the priorities corresponding to the threads. However, under the fair scheduling scheme, the scheduling priorities corresponding to the threads need to satisfy the first priority interval.

[0137] For example, in the CFS scheme, during the operation system running the first application, the operation system can set the priority corresponding to the thread for running each function in the first application to one in the interval [100, 139], which can be understood as the first priority interval. For example, at the initial moment of the operation system running the first application, the priority corresponding to the thread for running each function in the first application can be set to 120 by default.

[0138] It should be understood that the smaller the value corresponding to the priority, the higher the priority.

[0139] After the operation system runs to the stub point of the first application, the corresponding computing resource can be allocated to the function associated with the stub point according to the content indicated by the stub point.

[0140] In some possible embodiments, the stub point can indicate that the priority corresponding to the thread for running a certain function is adjusted to be within the second priority interval, and the lower bound of the second priority interval is higher than the upper bound of the first priority interval, which means that the function associated with the stub point is a critical function, and the operation system needs to take privileged scheduling for the thread for running the critical function, i.e., the priority corresponding to the thread for running the critical function is promoted to be within the second priority interval, for example, RR scheduling is taken to set the priority of the thread to one in [0-99], so that the operation system subsequently allocates more computing resources to the thread. Based on this, it can be known that the first computing resource allocated by the operation system to the thread corresponding to the default priority is less than the second computing resource allocated by the operation system according to the priority within the second priority interval.

[0141] Alternatively, the above-mentioned stub point can also directly indicate that the second computing resource is allocated to the thread for running a certain function. The second computing resource can be represented as the capacity of the second computing resource, or the allocation order of the second computing resource, or the weight of the second computing resource in all computing resources of the operation system. After the operation system runs to the stub point, the meaning represented by the second computing resource can be determined, and then the second computing resource is allocated to the corresponding thread.

[0142] Of course, the meaning represented by the above-mentioned second computing resource can also be embodied by the above-mentioned manner of setting the priority of the thread.

[0143] In some possible embodiments, the above-mentioned stub point can be a dynamic stub point, or a static stub point, or a self-defined API.

[0144] Based on the technical solution, by adding the stub corresponding to the key function in the first application program, when the system runs to the stub, the system can dynamically take the privilege scheduling scheme for the thread running the key function in real time, or allocate the specified computing resource for the thread running the key function, so that the thread can have sufficient computing resources to complete the running of the key function, so as to ensure that the key process link in the application program can be run as soon as possible, and reduce the end-to-end delay of data flow transmission in the key link.

[0145] In some possible embodiments, in the process of adding the stub to the first application program, a warm-up stub can also be set before the stub corresponding to the key function.

[0146] For example, the N key functions of the first application program include a first function, the first function is associated with a first stub, and the first stub is one of the N stubs added in the first application program. Based on this, a first warm-up stub can be added between the first pre-function and the first stub, wherein the running time sequence of the first pre-function is before the first function and adjacent to the first function, the first function is one of the N key functions, the first function is associated with the first stub, the first stub is one of the N stubs, and the first warm-up stub is used to indicate that the third computing resource is allocated to the thread running the first function, and the third computing resource is less than or equal to the second computing resource.

[0147] In some possible embodiments, in the case that the computing resource of the operating system is sufficient, the third computing resource allocated by the operating system to the thread running the first function according to the first warm-up stub can also be more than the second computing resource.

[0148] In some possible embodiments, the first warm-up stub can also be used to indicate that the priority of the thread running the first function is adjusted to the second priority interval.

[0149] In some possible embodiments, the first warm-up stub can further indicate that the priority of the thread running the first function is adjusted to the lower limit of the second priority interval, or can be set to other priorities, for example, the priority allocated by the operating system to the thread when the thread runs the first pre-function, wherein the first pre-function can be a key function or a non-key function.

[0150] In some possible embodiments, the warm-up stub can be set at the exit position of the first pre-function, or in the case that the exit stub is set at the end of the first pre-function, the warm-up stub is the exit stub of the first pre-function.

[0151] In some possible embodiments, when the first function is the first function entered by running the first application, the first function can not be added with the first pre-warming stub point before it.

[0152] Based on the technical solution, due to the introduction of the pre-warming stub point, after the first pre-function is executed, the operating system can run to the first pre-warming stub point before running to the first function as the key function, so as to allocate corresponding computing resources for the thread for running the first function in advance based on the indication of the first pre-warming stub point, so as to ensure that the thread has computing resources for running the first function, thereby effectively avoiding that the computing resources for running the first function are preempted by other key functions when the system runs to the first function, thereby ensuring the running of the first function.

[0153] In some possible embodiments, before the first application is put into actual application, the operating system can run the first application in advance to obtain historical data, the historical data being used to indicate the running time sequence of a plurality of processes and / or a plurality of threads participating in running the first application; according to the historical data, a first configuration file is generated, the first configuration file being used to indicate the dependency relationship between the plurality of processes and / or the plurality of threads, and the first configuration file being further used to determine the second computing resources.

[0154] In addition, the embodiment of the present application provides a resource scheduling method, which can be executed when the first application is obtained by running the method of processing the application.

[0155] FIG. 4 is a flow diagram of a resource scheduling method 400 according to an embodiment of the present application.

[0156] S410: running a first application, the first application including a first critical data flow, the first critical data flow being used to determine the output of the first application, the first critical data flow being associated with N threads under M processes, wherein the M processes include a first process, the first process being associated with a first thread, a first function and a first stub point, the first thread being used to run the first function, wherein M and N are positive integers.

[0157] It should be understood that the data flow of the application refers to the transmission path and process of data in the application, covering the process of data generation, transmission, storage and processing. The first key data flow refers to the data transmission path that determines the output of the first application. The data in the first key data flow will pass through multiple business processes during transmission, which determines the output of the application system corresponding to the multiple business processes. Accordingly, the first application can include multiple sub-applications, which are respectively used to implement the multiple businesses mentioned in the above embodiments, such as sensing business, fusion business, planning business and control business.

[0158] In addition, the meaning of the "first computing resource" referred to in the method 400 is different from the meaning of the "first computing resource" referred to in the corresponding embodiment of the method of processing the application. In the method 400, the first computing resource indicates the computing resource allocated for the first thread, while in the method of processing the application, the first computing resource indicates the computing resource allocated by the operating system for the thread running the function by default.

[0159] In some possible embodiments, the first stake point mentioned above can be added to the first application during the running of the first application, that is, the first stake point is inserted based on the dynamic binary instrumentation method; or the first stake point can also be added to the first application in advance before the running of the first application, that is, the first stake point is inserted based on the static binary instrumentation method. Based on this method, the stake point can be inserted into the first application in various instrumentation ways, thereby increasing the flexibility of instrumentation.

[0160] S420: According to the first stake point, the first computing resource is allocated for the first thread, and the first computing resource is used for the first thread to run the first function.

[0161] In some possible embodiments, the above S420 can further include the following steps:

[0162] S421: According to the first stake point, the capacity of the first computing resource is determined, and the first computing resource is allocated for the first thread according to the capacity of the first computing resource;

[0163] Or, S422: According to the first stake point, the order of the first computing resource is determined, and the first computing resource is allocated for the first thread according to the order of the first computing resource;

[0164] Or, S423: According to the first stake point, the first occupancy rate is determined, the first occupancy rate is used to represent the occupancy rate (or weight) of the first computing resource in all computing resources, and the first computing resource is allocated for the first thread according to the first occupancy rate.

[0165] It should be understood that the "all computing resources" in S423 above refers to the computing resources for allocation in the first time range, which refers to the time range in which there is an overlap between the running time of the first thread and the other threads, and further refers to the computing resources for allocation to the first thread and the other threads in the first time range. Based on this, since the first occupancy rate is calculated by a fraction, the denominator of the fraction can be used to represent the sum of the computing resources for allocation to the other threads and the first computing resources in the first time range, and the numerator of the fraction is the first computing resources.

[0166] It should be noted that the first process is associated with the first thread, the first function, and the first stub point, and the association relationship is as follows: the first process includes at least one thread, the first thread belongs to the at least one thread, and the first thread is used to run at least one function, the first function belongs to the at least one function, and the first function is a key function in the first application. Therefore, based on the method proposed in the embodiments of the present application, the first function is associated with the first stub point, so that when the operating system runs to the first stub point, the first computing resources allocated to the first thread for running the first function can be determined. For example, the first process can be a node in the application layer shown in FIG. 2, for example, a fusion node, and the fusion node can include thread 1, thread 2, and thread 3, wherein thread 1 is used to run a callback function, and the callback function is associated with the first stub point. Therefore, the callback function can be understood as the first function, and the thread 1 can be understood as the first thread. When the operating system runs to the first stub point, the computing resources allocated to the thread 1 can be determined.

[0167] In some possible embodiments, the first application also includes a non-key function, and the non-key function is not associated with the stub point mentioned in the method 400. When the operating system runs to the non-key function of the first application, the thread for running the non-key function is allocated a default computing resource, which is less than the first computing resource. After the first thread runs the first function based on the first computing resource, when the first thread is used to run the non-key function, the operating system does not continue to allocate the first computing resource to the first thread based on the method 400, but reduces the default computing resource.

[0168] In some possible embodiments, after the first thread runs the first function, the operating system can retrieve the first computing resource allocated to the first thread, or reduce the allocation of the computing resource, and then re-allocate or adjust the computing resource allocated to the first thread for the first thread to run other functions based on the method 400.

[0169] In some possible embodiments, the operating system can schedule the computing resources based on the priority, and the capacity, order or weight of the first computing resources allocated to the first thread can be represented by the priority. At the initial moment of running the first application, the operating system can default that the priority corresponding to each thread running the first application is in the first priority interval, and based on this, the first stake point can be used to indicate adjusting the priority of the first thread to the second priority interval, the lower bound of which is higher than the upper bound of the first priority interval. In this way, it is indicated that the operating system needs to allocate more first computing resources to the first thread than the default computing resources allocated to the first thread. Therefore, the operating system needs to schedule more computing resources for the first thread to ensure that the first function runs efficiently.

[0170] In this embodiment, the specific numerical values of the priority intervals are based on the corresponding scheduling scheme. In other schemes based on fair scheduling or privileged scheduling, the specific numerical intervals corresponding to the first priority interval and the second priority interval can be adjusted adaptively.

[0171] In some possible embodiments, the first stake point can be a dynamic stake point, a static stake point or a self-defined API. The stake points involved in the subsequent embodiments are the same as the first stake point.

[0172] It should be understood that the first function corresponding to the first stake point can be understood as a key function, that is, a function used to determine the output of the first application, so more computing resources need to be allocated to the first thread running the first function through the first stake point.

[0173] It should be noted that, in general, the first key data flow will also involve some functions not associated with the stake point, which means that these functions are non-key functions. However, based on the scheduling scheme of the prior art, because the first function running by the first thread is a key function, the first computing resources can be statically allocated to the first thread, but if the first thread runs a non-key function after running the first function, the operating system will still allocate the first computing resources to the first thread for running the non-key function, and for the first thread running the non-key function, the operating system does not need to allocate too many first computing resources to the first thread. This resource scheduling scheme can cause threads running other key functions to not get enough computing resources, resulting in an increase in the end-to-end latency of the first key data flow.

[0174] However, based on the above technical solution, after the operating system runs to the first stake point of the first application program, not only can the first function associated with the first stake point be determined as a key function, but also the first thread for running the first function can be allocated sufficient computing resources, i.e., the first computing resources, so that the first thread can efficiently and quickly run the first function with sufficient computing resources, and when the first thread runs other functions, the operating system can re-allocate computing resources to the first thread instead of continuing to allocate the first computing resources to the first thread, so that the operating system can dynamically allocate computing resources to threads in function granularity, which helps to allocate more remaining resources to other threads running key functions, thereby helping to reduce the end-to-end latency of the first key data flow. Especially in the case of the first application program being an automatic driving application program, the user's driving experience can be effectively improved, and the safety of passengers in the vehicle, pedestrians outside the vehicle, and other vehicles can be ensured.

[0175] FIG. 5 is a schematic diagram of another method 500 of resource scheduling according to an embodiment of the present application. In FIG. 5, (a) is a flowchart of the method 500 of resource scheduling according to an embodiment of the present application, and (b) is a schematic diagram of the principle of the method 500 of resource scheduling according to an embodiment of the present application.

[0176] Referring to FIG. 5, the first application program further includes a second key data flow for determining the output of the first application program, the second key data flow being associated with N threads under M processes, and the M processes further include a second process associated with a second thread, a second function, and a second stake point, and the second thread is used to run the second function. Based on this, the method 500 can include the following operations:

[0177] S510: determining a first dependency relationship between the second thread and the first thread according to a first configuration file, the first configuration file being used to indicate a dependency relationship between the M processes and / or the N threads.

[0178] In some possible embodiments, the above S510 can be performed when the operating system runs to the first stake point and the second stake point, where "runs to the first stake point and the second stake point" can be understood as running to the first stake point and the second stake point at the same time, or running to the second stake point after running to the first stake point and before the first function is run to completion. In other words, this scenario can be understood as the operating system needing to schedule computing resources for two parallel threads for running key functions.

[0179] In some possible embodiments, the first configuration file described above can be obtained in a pre-experimental manner. For example, in an automatic driving application scenario, the first application is a program for implementing an automatic driving service, and the first application is loaded on an automatic driving system. After the first application is deployed on the automatic driving system, the vehicle can be controlled to run based on the first application. In this process, historical data of running each function in the first application by each thread can be generated. The historical data can include stub point information, timing of running functions by each thread, dependency relationship between threads during running of the functions, and the like. Through statistical analysis of the historical data, the first configuration file can be determined to provide the operating system for subsequent resource scheduling. It should be understood that the automatic driving system is an application system, and the application system runs in an environment provided by the operating system.

[0180] S520: According to the second stub point and the first dependency relationship, a second computing resource for running the second function by the second thread is allocated to the second thread.

[0181] Further, in the case where the first dependency relationship is that the running of the first thread depends on the second thread, the first computing resource is more than the second computing resource, or in the case where the first dependency relationship is that the running of the second thread depends on the first thread, the first computing resource is less than the second computing resource, so as to ensure that the critical data flow entered by the operating system earlier can be smoothly output.

[0182] It should be understood that the processes associated with the first critical data flow and the second critical data flow are the same, and it can also be understood that the second critical data flow is a mirror image of the first critical data flow. The first dependency relationship described above is essentially a runtime sequence relationship between the first thread and the second thread. For example, in the case where the running of the first thread depends on the second thread, the dependency relationship means that the runtime sequence of the first thread is after the second thread, and at this time, the first thread associated with the first critical data flow and the second thread associated with the second critical data flow are parallel, the first thread associated with the first critical data flow has completed the running of the first function, and the second critical data flow has not entered the flow of running the first function by the first thread. As can be seen, the first critical data flow is a previous frame data flow of the second critical data flow, so based on the technical solution described above, in the case where the two critical data flows are parallel, the operating system can allocate more resources to the threads related to the first critical data flow to ensure that the previous frame data flow can be smoothly output. In order to avoid allocating sufficient computing resources to the threads of the two data flows at the same time, resulting in too much occupation of computing resources, so that other threads cannot obtain sufficient computing resources, and a large number of functions cannot be run to completion in a short period of time (for example, 100ms to 300ms).

[0183] In addition, the meaning of the "second computing resource" referred to in the method 500 is different from the meaning of the "second computing resource" referred to in the aforementioned method of processing the application program. In the method 500, the second computing resource indicates the computing resource allocated to the second thread, while in the method of processing the application program, the second computing resource indicates the computing resource allocated by the operating system to the thread for running the critical function according to the stake point.

[0184] In some possible embodiments, the first dependency relationship described above can be represented by the runtime sequence of the first thread and the second thread, or the first dependency relationship described above can be represented by the distance between the first thread and the endpoint of the first critical data flow and the distance between the second thread and the endpoint of the second critical data flow. The distance can be understood as the number of hops between the thread and the termination node of the business process, and after the thread is executed, the data flow jumps to the next thread until it jumps to the termination node, or the distance can also be understood as the time required from running the thread to the output of the data flow associated with the thread, which can be obtained through historical data generated by the operating system running the first application.

[0185] In some possible embodiments, the method 500 described above can be performed by using a graph theory algorithm, that is, after determining the dependency relationship between the threads of the critical link, the scheduling priority of the function associated with the stake point is set by using the graph theory algorithm. For example, the priority corresponding to the upper node of the directed graph is higher than the priority corresponding to the lower node, or the computing resource corresponding to the upper node of the directed graph is more than the computing resource corresponding to the lower node.

[0186] Based on the technical solutions described above, by judging the dependency relationship between the parallel threads, relatively more computing resources are provided for the dependent threads, which can reduce the end-to-end delay of the critical data flow in which the dependent thread is located as much as possible, and can also effectively avoid the problem that the same amount of sufficient computing resources are allocated to multiple parallel threads corresponding to multiple critical data flows, resulting in the problem that other parallel threads cannot be executed in a short period of time due to insufficient resources, thereby reducing the jitter of the end-to-end delay of multiple parallel critical data flows.

[0187] FIG. 6 is a schematic diagram of another method 600 of resource scheduling according to an embodiment of the present application.

[0188] Referring to FIG. 6, the first process is also associated with a third stake point, which is adjacent to the first stake point and located before the first stake point in the runtime sequence of the first process. The method 600 includes the following operation: allocating a third computing resource to the first thread according to the third stake point, the third computing resource being less than or equal to the first computing resource, and the third computing resource being used to guarantee the running of the first function by the first thread.

[0189] In some possible embodiments, the third stake point can be arranged at an exit position of a third function in time sequence before the first function, and in the case that an exit stake point is arranged at the exit of the third function, the third stake point can be an exit stake point associated with the third function, that is, after the execution of the third function is completed, the third stake point is directly run, so as to allocate the third computing resource in advance for the first thread.

[0190] In some possible embodiments, in the case that the computing resource is sufficient, the third computing resource can also be greater than the first computing resource.

[0191] In some possible embodiments, in the case that the operating system schedules the resource based on the priority corresponding to the thread, the third stake point can also be used to instruct to set the priority corresponding to the first thread as a first priority corresponding to the third computing resource.

[0192] In some possible embodiments, the first priority can be the lower limit of the second priority interval. Although the first priority is the lower limit of the second priority interval, at least the corresponding computing resource can be allocated in advance for the first thread, so that the computing resource can guarantee that the first function can be run to the end, and avoid that the computing resource is preempted by other critical threads when the first function is run, so that the first function cannot be normally run. Of course, the first priority can be other priority values in the second priority interval, and the embodiments of the present application do not limit this.

[0193] In some possible embodiments, when the third stake point is run, the operating system can allocate the third computing resource for the first thread (assuming that the third computing resource is less than the first computing resource), and when the first stake point is run, the operating system can first judge whether the current remaining computing resource satisfies a first condition that the remaining computing resource is greater than or equal to the difference between the first computing resource and the third computing resource. If the first condition is satisfied, the computing resource is supplemented and allocated for the first thread, so that the first thread can obtain the first computing resource; if the first condition is not satisfied, the computing resource is not supplemented and allocated for the first thread.

[0194] Based on the above technical solutions, the computing resource of the critical function can be effectively avoided from being preempted by other non-critical threads in advance, so that the critical function cannot be run to the end as soon as possible, which is helpful to further reduce the end-to-end delay of the critical data stream transmission.

[0195] Generally, an operating system can control the binding relationship between a process or a thread and a CPU core (also referred to as a processor core), which can be referred to as CPU binding. Based on the CPU binding technology, a key thread is bound to a CPU core with higher performance (also referred to as a CPU large core), so as to provide higher computing performance and faster response speed for the key thread. The key thread can fully utilize the computing capability of the CPU large core, and improve the running speed and response performance of an application program. Moreover, through the binding technology, it can be more accurate to control the process or thread running on which CPU core, effectively reducing the case that multiple threads occupy the computing resources of a CPU core when the operating system allocates computing resources for multiple threads, so as to make the system management more flexible and convenient. Based on this, the first thread mentioned in the embodiments of the present application can also be bound to a corresponding CPU core, so as to allocate computing resources for the first thread through the bound CPU core.

[0196] FIG. 7 is a flow diagram of a method 700 of processor binding according to an embodiment of the present application.

[0197] Referring to FIG. 7, the first thread is bound to the first processor core and the second processor core respectively, wherein the first processor core and the second processor core are respectively configured to provide the second computing resource for the first thread. Based on this, the method 700 includes the following steps:

[0198] S710: predicting a first resource occupancy rate of the first processor core providing the first computing resource for the first thread.

[0199] If the first resource occupancy rate is less than or equal to a first threshold, go to S720, otherwise, go to S730.

[0200] For example, the first threshold can be a threshold preset according to the hardware performance of the operating system used to run the first application program.

[0201] S720: providing the first computing resource for the first thread through the first processor core.

[0202] S730: predicting a second resource occupancy rate of the second processor core providing the first computing resource for the first thread.

[0203] If the second resource occupancy rate is less than or equal to the first threshold, go to S740, otherwise, go to S750.

[0204] S740: providing the first computing resource for the first thread through the second processor core.

[0205] S750: predicting a third resource occupancy rate of a third processor core providing the first computing resource for the first thread, wherein the third processor core is not bound to the first thread.

[0206] If the third resource occupancy is less than or equal to the first threshold, go to S760, otherwise, go to S770.

[0207] S760: providing the first thread with the first computing resource by the third processor core.

[0208] In some possible embodiments, before S760 is performed, the first thread is unbound from the first processor core and the second processor core, and then bound to the third processor core.

[0209] S770: predicting a fourth resource occupancy after the fourth processor core provides the first thread with the first computing resource, the fourth processor core being unbound from the first thread. The above steps are repeated.

[0210] In some possible embodiments, after the first thread is provided with the first computing resource by the third processor core, after a function of the first thread is run based on the first computing resource, the first thread is bound to the first processor core and the second processor core again.

[0211] Based on the above technical solutions, the situation that multiple threads preempt the computing resource of one processor core can be avoided, which helps to improve the efficiency of running the first application program by the system and reduce the end-to-end delay of data flow transmission in the critical process link.

[0212] In some possible embodiments, in order to avoid the situation that the computing resource occupied by a critical function cannot be released due to the abnormal state such as the critical function falling into a dead loop, or the situation that the processor core bound to the thread where the critical function is located is unavailable, an anti-timeout mechanism is provided to solve the problem. Taking running the first function as an example, the anti-timeout mechanism includes the following steps:

[0213] At the starting moment of running the first function by the first thread, a first timer is started, and the time length set by the first timer is greater than or equal to the time length required for running the first function completely; in the case that the first timer is timed out and the first function is not run completely, the first computing resource allocated to the first thread is reduced.

[0214] In some possible embodiments, the time length set by the first timer can be twice the time length required for running the first function completely.

[0215] It should be understood that the above method is also applicable to other functions associated with the stake point.

[0216] Based on the above technical solutions, the situation that the processor resource is preempted by the thread where the critical function is located for a long time due to the abnormal state such as the critical function falling into a dead loop can be effectively avoided, so that the allocation of computing resources is more reasonable.

[0217] In some possible embodiments, it is considered that some relatively important non-critical functions can be disabled due to the resource preemption of critical functions, causing the non-critical functions to be unable to obtain computing resources for a long time, thereby causing the non-critical functions to be disabled. In order to avoid the above situation, the non-critical function guarantee mechanism is proposed to solve the problem. Taking the fourth function included in the first application program as an example, the fourth function is not associated with the stub point proposed in the present application, which means that the fourth function is a non-critical function, and the non-critical function guarantee mechanism includes the following steps:

[0218] obtaining a preset first running time period, the first running time period being greater than or equal to a time length required for running the fourth function; and allocating, within the first running time period from a time of running the fourth function, a fourth computing resource for a thread for running the fourth function, the fourth computing resource being greater than or equal to the first computing resource.

[0219] In some possible embodiments, the fourth function can be associated with a critical data stream of the first application program, or can be associated with a non-critical data stream in the first application program, and the embodiments of the present application do not limit this.

[0220] It should be noted that although the fourth function is a non-critical function, the fourth function can be a function for implementing a relatively important business among all non-critical functions in the first application program. The fourth function does not need to be periodically run in a short period of time, but needs to trigger a corresponding important business at a specified time through the fourth function. Taking an automatic driving business as an example, the fourth function can be a function related to the chassis function of the vehicle. Although the fourth function can not be directly associated with a critical data stream (perception, fusion, planning or control) in the automatic driving business, the chassis function of the automatic driving system is also relatively important, so it is also important to guarantee the normal and timely running of the fourth function.

[0221] In some possible embodiments, the first running time period can be obtained through external input or can be preset before system running.

[0222] In some possible embodiments, since the fourth computing resource is more than the first computing resource, based on the priority scheduling scheme, the priority corresponding to the first thread when running the fourth function is higher than the priority corresponding to the first thread when running the first function.

[0223] Based on the above technical solution, the computing resource for running the non-critical function can be prevented from being preempted by the thread of the critical function for a long time, thereby avoiding the situation that the non-critical function is disabled. Therefore, the functional integrity of the first application program is guaranteed, and especially in the case that the first application program is an automatic driving application program, the driving experience of the user can be improved.

[0224] Further, an apparatus for implementing any of the above methods is provided, which includes units (or means) for implementing any of the above methods.

[0225] FIG. 8 is a schematic block diagram of an apparatus 800 for resource scheduling, according to an embodiment of the present application.

[0226] In some possible embodiments, the apparatus 800 is configured to constitute an operating system.

[0227] The apparatus 800 includes:

[0228] A running unit 810 is configured to run a first application, the first application including a first critical data flow, the first critical data flow being used to determine an output of the first application, the first critical data flow being associated with N threads under M processes, the M processes including a first process, the first process being associated with a first thread, a first function and a first breakpoint, the first thread being configured to run the first function, M and N being positive integers.

[0229] A first operation unit 820 is configured to allocate, according to the first breakpoint, a first computing resource to the first thread, the first computing resource being used for the first thread to run the first function.

[0230] In some possible embodiments, the first operation unit 820 is specifically configured to: determine a capacity of the first computing resource according to the first breakpoint, and allocate the first computing resource to the first thread according to the capacity of the first computing resource; or determine an order of the first computing resource according to the first breakpoint, and allocate the first computing resource to the first thread according to the order of the first computing resource; or determine a first occupancy rate according to the first breakpoint, the first occupancy rate being used to represent an occupancy rate of the first computing resource in all computing resources, and allocate the first computing resource to the first thread according to the first occupancy rate.

[0231] In some possible embodiments, the first breakpoint is added to the first application in a process of running the first application; or the first breakpoint is added to the first application in advance before running the first application.

[0232] In some possible embodiments, the first application further includes a second critical data flow, the second critical data flow being used to determine the output of the first application, the second critical data flow being associated with the N threads under the M processes, the M processes further including a second process, the second process being associated with a second thread, a second function and a second breakpoint, the second thread being configured to run the second function, and the apparatus 800 further includes:

[0233] The determining unit 830 is configured to determine a first dependency relationship between the second thread and the first thread according to a first configuration file, the first configuration file being used to indicate a dependency relationship between the M processes and / or the N threads.

[0234] The first operation unit 820 is further configured to allocate a second computing resource for the second thread according to the second stake point and the first dependency relationship, the second computing resource being used for the second thread to run the second function, and the first computing resource being more than the second computing resource in a case where the first dependency relationship is that the running of the first thread depends on the second thread, or the first computing resource being less than the second computing resource in a case where the first dependency relationship is that the running of the second thread depends on the first thread.

[0235] In some possible embodiments, the first process is further associated with a third stake point, the third stake point being adjacent to the first stake point and located before the first stake point in the running sequence of the first process, and the first operation unit 820 is further configured to allocate a third computing resource for the first thread according to the third stake point, the third computing resource being less than or equal to the first computing resource, and the third computing resource being used to guarantee the first thread to run the first function.

[0236] In some possible embodiments, the first thread is bound to a first processor core and a second processor core respectively, and the first processor core and the second processor core are respectively configured to provide the first computing resource for the first thread, and the apparatus 800 further includes:

[0237] The predicting unit 840 is configured to predict a first resource occupancy rate of the first processor core providing the first computing resource for the first thread.

[0238] In a case where the first resource occupancy rate is greater than a first threshold, the predicting unit 840 is further configured to predict a second resource occupancy rate of the second processor core providing the first computing resource for the first thread.

[0239] In a case where the second resource occupancy rate is less than or equal to the first threshold, the first operation unit 820 is specifically configured to provide the first computing resource for the first thread through the second processor core; or

[0240] In a case where the second resource occupancy rate is greater than the first threshold, the predicting unit 840 is further configured to predict a third resource occupancy rate of a third processor core providing the first computing resource for the first thread, the third processor core not being bound to the first thread.

[0241] In a case where the third resource occupancy rate is less than or equal to the first threshold, the first operation unit 820 is specifically configured to provide the first computing resource for the first thread through the third processor core.

[0242] In some possible embodiments, the apparatus 800 further includes a second operation unit 850, configured to start a first timer at a starting moment of running the first function by the first thread, the first timer being set to a time period greater than or equal to a time period required for running the first function completely; and the first operation unit 820 is further configured to reduce the first computing resource allocated to the first thread when the first timer expires and the first function is not run completely.

[0243] In some possible embodiments, the first application further includes a fourth function, and the apparatus 800 further includes an acquisition unit 860, configured to acquire a preset first running time period, the first running time period being greater than or equal to a time period required for running the fourth function completely; and the first operation unit 820 is further configured to allocate a fourth computing resource to a thread for running the fourth function within the first running time period from a moment of running the fourth function, the fourth computing resource being greater than or equal to the first computing resource.

[0244] FIG. 9 is a schematic block diagram of an apparatus 900 for processing an application according to an embodiment of the present application.

[0245] The apparatus 900 is configured to process a first application, the first application being run by an operating system, and the operating system being configured to allocate a first computing resource to a thread for running a function in the first application by default, and the apparatus 900 includes:

[0246] a patching unit 910, configured to add N patch points in the first application, N being a positive integer, the N patch points being associated with N key functions in the first application respectively, a key function being associated with a key data flow, the key data flow being used to determine an output of the first application, and the key function being used to determine an output of the key data flow, and the patch point being used to indicate that a second computing resource is allocated to a thread for running the key function, the second computing resource being greater than the first computing resource.

[0247] In some possible embodiments, the patching unit 910 is further configured to add a first warm-up patch point between a first preceding function and a first patch point, the first preceding function being run before the first function and adjacent to the first function, the first function being one of the N key functions, the first function being associated with the first patch point, the first patch point being one of the N patch points, and the first warm-up patch point being used to indicate that a third computing resource is allocated to a thread for running the first function, the third computing resource being less than or equal to the second computing resource.

[0248] In some possible embodiments, the apparatus 900 further includes:

[0249] The running unit 920 is configured to run the first application program to obtain historical data, the historical data being used to indicate a running time sequence of a plurality of processes and / or a plurality of threads participating in running the first application program.

[0250] The processing unit 930 is configured to generate a first configuration file according to the historical data, the first configuration file being used to indicate a running dependency relationship between the plurality of processes and / or the plurality of threads, and the first configuration file being further used to determine the second computing resource.

[0251] The embodiments of the present application also provide a vehicle, which comprises the device 800 and / or the device 900 provided by any of the above embodiments, or an automatic driving system configured to execute the resource scheduling method provided by the embodiments of the present application.

[0252] In some possible embodiments, the technical solutions provided by the present application are not limited to being executed by the operating system of the automatic driving system, and can also be extended to be executed by the operating system of other application systems, such as a smart robot system or a smart home system.

[0253] Those skilled in the art can understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solutions. Those skilled in the art can use different methods to implement the described functions for each specific application, but the implementation should not be considered beyond the scope of the present application.

[0254] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.

[0255] In the several embodiments provided by the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are only schematic. The division of the units is only a logical function division. There can be another division manner for actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.

[0256] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0257] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.

[0258] The functions, if realized in the form of software functional units and sold or used as independent products, can be stored in a computer readable storage medium. Based on such understanding, the technical scheme of the present application or the part of the present application which essentially contributes to the prior art or the part of the technical scheme can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application.

[0259] 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 can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method of resource scheduling, the method comprising: The method comprises: running a first application program, the first application program comprising a first critical data flow, the first critical data flow being used to determine an output of the first application program, the first critical data flow being associated with N threads under M processes, the M processes comprising a first process, the first process being associated with a first thread, a first function and a first breakpoint, the first thread being used to run the first function, the M and the N being positive integers; allocating, according to the first breakpoint, a first computing resource for the first thread, the first computing resource being used for the first thread to run the first function.

2. The method of claim 1, wherein, The allocating, according to the first breakpoint, of the first computing resource for the first thread comprises: determining, according to the first breakpoint, a capacity of the first computing resource, and allocating, according to the capacity of the first computing resource, the first computing resource for the first thread; or, determining, according to the first breakpoint, an order of the first computing resource, and allocating, according to the order of the first computing resource, the first computing resource for the first thread; or, determining, according to the first breakpoint, a first occupancy rate, the first occupancy rate being used to represent an occupancy rate of the first computing resource in all computing resources, and allocating, according to the first occupancy rate, the first computing resource for the first thread.

3. The method according to claim 1 or 2, characterized in that, The first breakpoint is added to the first application program in a process of running the first application program, or the first breakpoint is added to the first application program before running the first application program.

4. The method according to any one of claims 1 to 3, characterized in that, The first application program further comprises a second critical data flow, the second critical data flow being used to determine the output of the first application program, the second critical data flow being associated with the N threads under the M processes, the M processes further comprising a second process, the second process being associated with a second thread, a second function and a second breakpoint, the second thread being used to run the second function, and the method further comprises: determining, according to a first configuration file, a first dependency relationship between the second thread and the first thread, the first configuration file being used to indicate a dependency relationship between the M processes and / or the N threads; allocating, according to the second breakpoint and the first dependency relationship, a second computing resource for the second thread, the second computing resource being used for the second thread to run the second function, in a case that the first dependency relationship is that the running of the first thread depends on the running of the second thread, the first computing resource being more than the second computing resource, or in a case that the first dependency relationship is that the running of the second thread depends on the running of the first thread, the first computing resource being less than the second computing resource.

5. The method according to any one of claims 1 to 4, characterized in that, The first process is further associated with a third breakpoint, the third breakpoint being adjacent to the first breakpoint and being located before the first breakpoint in a running sequence of the first process, and the method further comprises: allocating, for the first thread, a third computing resource, the third computing resource being less than or equal to the first computing resource, the third computing resource being used to ensure the first thread to run the first function.

6. The method according to any one of claims 1 to 5, characterized in that, The first thread is bound to a first processor core and a second processor core respectively, the first processor core and the second processor core are configured to provide the first computing resource for the first thread respectively, the method further comprises: predicting a first resource occupancy rate of the first processor core providing the first computing resource for the first thread; in a case that the first resource occupancy rate is greater than a first threshold, predicting a second resource occupancy rate of a second processor core providing the first computing resource for the first thread, the second processor core is not bound to the first thread; in a case that the second resource occupancy rate is less than or equal to the first threshold, the allocating the first computing resource for the first thread comprises: providing the first computing resource for the first thread by the second processor core; or, in a case that the second resource occupancy rate is greater than the first threshold, predicting a third resource occupancy rate of a third processor core providing the first computing resource for the first thread, the third processor core is not bound to the first thread; in a case that the third resource occupancy rate is less than or equal to the first threshold, the allocating the first computing resource for the first thread comprises: providing the first computing resource for the first thread by the third processor core.

7. The method according to any one of claims 1 to 6, characterized in that, The method further comprises: starting a first timer at a starting time point of the first thread running the first function, the first timer is set to a time period greater than or equal to a time period required for running the first function completely; decreasing the first computing resource allocated for the first thread in a case that the first timer is expired and the first function is not run completely.

8. The method according to any one of claims 1 to 7, characterized in that, The first application further comprises a fourth function, the method further comprises: obtaining a preset first running time period, the first running time period being greater than or equal to a time period required for running the fourth function completely; allocating, for a thread running the fourth function, a fourth computing resource in a first running time period from a time point of running the fourth function, the fourth computing resource being greater than or equal to the first computing resource.

9. A method of processing an application program, characterized by, A method for processing a first application, the first application being run by an operating system, the operating system allocating a first computing resource for a thread running a function in the first application by default, the method comprises: adding N number of stake points in the first application, the N being a positive integer, the N number of stake points being associated with N number of key functions in the first application respectively, the key function being associated with a key data flow, the key data flow being used to determine an output of the first application, the key function being used to determine an output of the key data flow, the stake point being used to indicate allocating a second computing resource for a thread running the key function, the second computing resource being more than the first computing resource.

10. The method of claim 9, wherein, The method further comprises: adding a first warm-up probe between a first pre-function and a first probe, a runtime sequence of the first pre-function is before and adjacent to a first function, the first function is one of the N critical functions, the first function is associated with a first probe, the first probe is one of the N probes, the first warm-up probe is used to indicate that a third computing resource is allocated for a thread used to run the first function, the third computing resource is less than or equal to the second computing resource.

11. The method according to claim 9 or 10, characterized in that, The method further comprises: running the first application program to obtain historical data, the historical data is used to indicate a runtime sequence of a plurality of processes and / or a plurality of threads participating in running the first application program; generating a first configuration file according to the historical data, the first configuration file is used to indicate a dependency relationship between the plurality of processes and / or the plurality of threads, and the first configuration file is further used to determine the second computing resource.

12. An apparatus for resource scheduling, the apparatus comprising: The apparatus comprises: a running unit configured to run a first application program, the first application program comprising a first critical data flow, the first critical data flow being used to determine an output of the first application program, the first critical data flow being associated with N threads under M processes, the M processes comprising a first process, the first process being associated with a first thread, a first function and a first probe, the first thread being used to run the first function, the M and the N being positive integers; a first operation unit configured to allocate a first computing resource for the first thread according to the first probe, the first computing resource being used for the first thread to run the first function.

13. The apparatus of claim 12, wherein, The first operation unit is specifically configured to: determine a capacity of the first computing resource according to the first probe, and allocate the first computing resource for the first thread according to the capacity of the first computing resource; or determine an order of the first computing resource according to the first probe, and allocate the first computing resource for the first thread according to the order of the first computing resource; or determine a first occupancy rate according to the first probe, the first occupancy rate being used to represent an occupancy rate of the first computing resource in all computing resources, and allocate the first computing resource for the first thread according to the first occupancy rate.

14. The apparatus of claim 12 or 13, wherein, The first probe is added to the first application program during running of the first application program; or the first probe is added to the first application program before running of the first application program.

15. The apparatus of any one of claims 12-14, wherein, The first application program further comprises a second critical data flow, the second critical data flow being used to determine the output of the first application program, the second critical data flow being associated with the N threads under the M processes, the M processes further comprising a second process, the second process being associated with a second thread, a second function and a second probe, the second thread being used to run the second function, and the apparatus further comprises: determining, according to a first configuration file, a first dependency relationship between the second thread and the first thread, the first configuration file being used to indicate a dependency relationship between the M processes and / or the N threads; the first operation unit is further configured to allocate, according to the second stub point and the first dependency relationship, a second computing resource for the second thread, the second computing resource being used for the second thread to run the second function, in a case where the first dependency relationship is that the running of the first thread depends on the second thread, the first computing resource is more than the second computing resource, or, in a case where the first dependency relationship is that the running of the second thread depends on the first thread, the first computing resource is less than the second computing resource.

16. The apparatus of any one of claims 12-15, wherein, the first process is further associated with a third stub point, the third stub point being adjacent to the first stub point and located before the first stub point in a running sequence of the first process, and the first operation unit is further configured to: allocate, according to the third stub point, a third computing resource for the first thread, the third computing resource being less than or equal to the first computing resource, the third computing resource being used to guarantee the first thread to run the first function.

17. The apparatus of any one of claims 12-16, wherein, the first thread is bound to a first processor core and a second processor core respectively, the first processor core and the second processor core are respectively configured to provide the first computing resource for the first thread, and the apparatus further comprises: a prediction unit configured to predict a first resource occupancy rate of the first processor core after the first processor core provides the first computing resource for the first thread; in a case where the first resource occupancy rate is greater than a first threshold, the prediction unit is further configured to predict a second resource occupancy rate of a second processor core after the second processor core provides the first computing resource for the first thread; in a case where the second resource occupancy rate is less than or equal to the first threshold, the first operation unit is specifically configured to provide the first computing resource for the first thread through the second processor core; or in a case where the second resource occupancy rate is greater than the first threshold, the prediction unit is further configured to predict a third resource occupancy rate of a third processor core after the third processor core provides the first computing resource for the first thread, the third processor core not being bound to the first thread; in a case where the third resource occupancy rate is less than or equal to the first threshold, the first operation unit is specifically configured to provide the first computing resource for the first thread through the third processor core.

18. The apparatus of any one of claims 12-17, wherein, the apparatus further comprises: a second operation unit configured to start a first timer at a starting moment of the first thread running the first function, the first timer being set for a time length greater than or equal to a time length required for running the first function completely; the first operation unit is further configured to reduce the first computing resource allocated for the first thread in a case where the first timer is timed out and the first function is not run completely.

19. The apparatus of any one of claims 12-18, wherein, the first application program further comprises a fourth function, and the apparatus further comprises: The acquisition unit is configured to acquire a preset first running time period, the first running time period being greater than or equal to a time length required for running the fourth function. The first operation unit is further configured to allocate, within the first running time period from a time point at which the fourth function is run, a fourth computing resource for a thread for running the fourth function, the fourth computing resource being greater than or equal to the first computing resource.

20. An apparatus for processing an application program, characterized by: The apparatus is configured to process a first application program, the first application program being run by an operating system, the operating system being configured to allocate, by default, a first computing resource for a thread for running a function in the first application program, and the apparatus comprises: The instrumenting unit is configured to add N number of instrument points in the first application program, the N being a positive integer, the N number of instrument points being respectively associated with N number of critical functions in the first application program, the critical functions being associated with a critical data flow, the critical data flow being used to determine an output of the first application program, the critical functions being used to determine an output of the critical data flow, the instrument points being used to indicate that a second computing resource is allocated for a thread for running the critical functions, the second computing resource being more than the first computing resource.

21. The apparatus of claim 20, wherein, The instrumenting unit is further configured to: add a first warm-up instrument point between a first pre-function and a first instrument point, a running time sequence of the first pre-function being before a first function and adjacent to the first function, the first function being one of the N number of critical functions, the first function being associated with the first instrument point, the first instrument point being one of the N number of instrument points, the first warm-up instrument point being used to indicate that a third computing resource is allocated for a thread for running the first function, the third computing resource being less than or equal to the second computing resource.

22. The apparatus of claim 20 or 21, wherein, The apparatus further comprises: a running unit configured to run the first application program to obtain historical data, the historical data being used to indicate a running time sequence of a plurality of processes and / or a plurality of threads participating in running the first application program; a processing unit configured to generate a first configuration file according to the historical data, the first configuration file being used to indicate a dependency relationship between running the plurality of processes and / or the plurality of threads, the first configuration file being further used to determine the second computing resource.

23. An electronic device, comprising: A processor and a memory are included, wherein the processor and the memory are connected, wherein the memory is configured to store program code, and the processor is configured to invoke the program code to perform the method in any one of claims 1 to 8 or perform the method in any one of claims 9 to 11.

24. An autonomous driving system, characterized by A first operating system is included, the first operating system being configured to perform the method in any one of claims 1 to 8.

25. The automated driving system of claim 24, wherein, Before the first operating system is configured to perform the method in any one of claims 1 to 8, the first operating system is further configured to: run the first application program to obtain historical data, the historical data being used to indicate a running time sequence of the M number of processes and / or the N number of threads participating in running the first application program; According to the historical data, a first configuration file is generated, the first configuration file being used to indicate a running dependency relationship between the M processes and / or the N threads.

26. A vehicle characterized by The automatic driving system as claimed in claim 24 or 25.

27. A chip system, characterized by The chip system is applied to an electronic device; the chip system comprises one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through a circuit; the interface circuit is used to receive a signal from a memory of the electronic device and send the signal to the processor, the signal comprising computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device executes the method as claimed in any one of claims 1 to 8 or the method as claimed in any one of claims 9 to 11.

28. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method as claimed in any one of claims 1 to 8 or the method as claimed in any one of claims 9 to 11.

29. A computer program product, characterised in that, The computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method as claimed in any one of claims 1 to 8 or the method as claimed in any one of claims 9 to 11. The computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method as claimed in any one of claims 1 to 8 or the method as claimed in any one of claims 9 to 11.

Citation Information

Patent Citations

  • Compiler-based instrumentation method and system and related electronic equipment

    CN116483734A

  • Task management method and related equipment

    CN117519918A

  • Resource scheduling method and device, readable storage medium and chip system

    CN117891617A

  • Optimized thread scheduling via hardware performance monitoring

    US20110055838A1

  • Data transmission method, system, and computing node

    WO2022151970A1

Cited By

  • Task scheduling method and device for fully fair scheduler and electronic equipment

    CN121455648A

  • Task scheduling methods, apparatus, and electronic devices for a fully fair scheduler

    CN121455648B