Task processing method, device and computing equipment of multi-core operating system

By determining processing cores for task groups in multi-core operating systems and using mutexes to ensure periodic and sequential execution of sub-function tasks, the problem of disrupted task processing logic is solved and the success rate of task processing is improved.

CN117806789BActive Publication Date: 2024-10-11CONTEMPORARY AMPEREX INTELLIGENCE TECHNOLOGY (SHANGHAI) LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202311444868.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-01
Publication Date
2024-10-11
Estimated Expiration
2043-11-01

AI Technical Summary

Technical Problem

In a multi-core operating system, the sequential relationship between tasks may cause task processing failures and disrupt the normal logic of tasks.

Method used

By determining the first processing core of the task to be processed for each task group in the multi-core operating system, processing the sub-functional tasks according to the processing cycle and order, and adding a mutex to the callback function to ensure that the sub-functional tasks Periodic and sequential execution.

Benefits of technology

Ensure that task processing conforms to task logic, improve the success rate of task processing, and reduce task processing failures caused by multiple processing core preemptions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117806789B_ABST
    Figure CN117806789B_ABST
Patent Text Reader

Abstract

The present application discloses a task processing method, device and computing equipment of a multi-core operating system, which belongs to the field of task processing technology. The method includes: for each task group, determining the pending tasks in the task group; when the processing of the predecessor task of the pending task is completed, determining the first processing core for processing the pending task, wherein the predecessor task is the task processed before the pending task; through the first processing core, processing each sub-function task according to the processing cycle and the first processing order of each sub-function task in the pending task. The present application adopts different processing cores in a multi-core operating system to process the tasks in the task group in sequence, and can ensure the periodic sequential processing of the sub-function tasks during the processing process, that is, to ensure that the task processing complies with the task logic, thereby ensuring the normal processing of the pending task and improving the success rate of task processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of task processing technology, and in particular to a task processing method, device and computing equipment for a multi-core operating system. Background Art

[0002] In a multi-core operating system, tasks are usually processed by each processing core preempting resources. That is, when a processing core is processing a task, other idle processing cores will process other tasks in parallel. However, if there is a sequence relationship between tasks, this method may cause tasks that need to be processed later to be processed in advance, disrupting the normal logic of the task and causing task processing failure. Summary of the invention

[0003] To this end, the present application proposes a task processing method for a multi-core operating system, and also proposes a task processing device for a multi-core operating system, a computing device and a computer-readable storage medium, aiming to at least to some extent solve the technical problem in the related technology that the normal logic of the task is disrupted, resulting in the failure of task processing.

[0004] In a first aspect, the present application provides a task processing method for a multi-core operating system, comprising: for each task group, determining a to-be-processed task in the task group; when processing of a predecessor task of the to-be-processed task is completed, determining a first processing core for processing the to-be-processed task, wherein the predecessor task is a task processed before the to-be-processed task; and processing each sub-functional task in the to-be-processed task according to the processing cycle and a first processing order of each sub-functional task through the first processing core.

[0005] In the technical solution of the embodiment of the present application, different processing cores in a multi-core operating system are used to process the tasks in the task group in sequence, and during the processing, the periodic processing and sequential processing of sub-functional tasks can be guaranteed, that is, the task processing is guaranteed to comply with the task logic, thereby ensuring the normal processing of the tasks to be processed, improving the success rate of task processing, and reducing the problem of task processing failure caused by multiple processing cores preempting tasks.

[0006] In some embodiments of the present application, the first processing core includes multiple timers, and each sub-function task is processed by the first processing core according to the processing cycle and the first processing order of each sub-function task in the task to be processed, including: determining the calling rules of the sub-function functions corresponding to each sub-function task according to the processing cycle and the first processing order of each sub-function task; calling the sub-function functions corresponding to each sub-function task according to the calling rules through the callback functions of the timers corresponding to each sub-function task to process each sub-function task, wherein the callback function adds a mutex.

[0007] In an embodiment of the present application, the sub-function tasks of the task to be processed include tasks that need to be processed periodically. In order to ensure the periodic execution of the sub-function tasks, a timer can be assigned to each sub-function task, and each sub-function task can be processed by calling a function of the timer corresponding to the sub-function task, that is, the periodic sequential operation of the sub-function tasks is achieved on the basis of retaining the original task logic of the task to be processed; and, in order to prevent the uncertainty of the execution time of the callback function itself from affecting the sequential execution of the sub-function tasks, a mutex is added to the callback function to achieve the effect of doubly protecting the sequential execution of the sub-function tasks, thereby improving the success rate of task processing.

[0008] In some embodiments of the present application, the calling rules of the sub-function functions corresponding to each sub-function task are determined based on the processing cycle of each sub-function task and the first processing order, including: determining the calling order and calling cycle of the sub-function functions corresponding to each sub-function task based on the first processing order and the processing cycle, and taking the calling order and the calling cycle as the calling rules.

[0009] In an embodiment of the present application, the calling order and calling cycle of the sub-function function are determined according to the processing order and processing cycle of the sub-function task, so that the calling rules that conform to the processing logic of the sub-function task can be obtained, and the periodic sequential calling of the sub-function function can be realized, thereby realizing the periodic sequential execution of the sub-function task.

[0010] In some embodiments of the present application, before determining the tasks to be processed in each task group, the process further includes: allocating a corresponding subslot to each sub-function task; and recording the subslot number corresponding to each sub-function task in a linked list according to the first processing order.

[0011] In the embodiment of the present application, a corresponding subslot is allocated to each sub-function task, and the subslots are associated with each other using a linked list, so that the sub-function tasks can be processed according to the subslot numbers, thereby improving the processing efficiency of the sub-function tasks.

[0012] In some embodiments of the present application, the method also includes: receiving a modification instruction for the task to be processed; in response to the modification instruction, modifying the sub-slot number in the linked list; and redetermining the first processing order based on the modified sub-slot number to modify the task to be processed.

[0013] In the embodiment of the present application, when it is necessary to modify the task to be processed, the sub-function tasks can be added, deleted and the order can be adjusted by modifying the sub-slot number, thereby improving the flexibility of task modification.

[0014] In some embodiments of the present application, the modification instruction includes adding a sub-function task, and the modification of the sub-slot number in the linked list in response to the modification instruction includes: generating a new sub-function task in response to the modification instruction, and allocating a corresponding new sub-slot to the new sub-function task; and adding the sub-slot number corresponding to the new sub-slot in the linked list according to the first dependency relationship between the new sub-function task and each sub-function task.

[0015] In an embodiment of the present application, by adding the sub-slot number of the newly added sub-function task at the appropriate position in the linked list, the sub-function tasks in the task to be processed are reordered, that is, the sub-function task required to be executed to process the task to be processed is changed, thereby achieving the effect of dynamically creating a new sub-function task and improving the flexibility of task modification.

[0016] In some embodiments of the present application, the modification instruction also includes deleting a sub-function task, and the modification of the sub-slot number in the linked list in response to the modification instruction includes: deleting the sub-function task to be deleted in response to the modification instruction, wherein the sub-function task to be deleted is an original sub-function task in the task to be processed; and deleting the sub-slot number corresponding to the sub-function task to be deleted in the linked list.

[0017] In an embodiment of the present application, by deleting the sub-slot number of the sub-function task to be deleted in the linked list, the sub-function tasks in the task to be processed are reordered, that is, the sub-function task required to be executed to process the task to be processed is changed, thereby achieving the effect of dynamically deleting the sub-function task and improving the flexibility of task modification.

[0018] In some embodiments of the present application, the modification instruction also includes modifying the task logic, and the modification of the sub-slot number in the linked list in response to the modification instruction includes: modifying the task logic of the task to be processed in response to the modification instruction; redetermining the first processing order of each sub-function task according to the modified task logic; and modifying the sub-slot number corresponding to each sub-function task in the linked list according to the redetermined first processing order.

[0019] In an embodiment of the present application, by changing the sub-slot number corresponding to each sub-function task in the linked list, the sub-function tasks in the task to be processed are reordered, that is, the sub-function tasks required to be executed to process the task to be processed are changed, thereby achieving the effect of dynamically modifying the task logic of the task to be processed and improving the flexibility of task modification.

[0020] In some embodiments of the present application, before processing each sub-functional task in the task to be processed by the first processing core according to the processing cycle and the first processing order of each sub-functional task, it also includes: determining the first dependency relationship between the sub-functional tasks according to the task logic of the task to be processed; and determining the first processing order of the sub-functional tasks according to the first dependency relationship.

[0021] In an embodiment of the present application, the first processing order of multiple sub-function tasks included in the task to be processed is determined according to the task logic of the task to be processed, so that each sub-function task can be processed according to the first processing order, thereby ensuring that the processing of the task to be processed complies with the task logic and ensuring that the task to be processed is successfully processed.

[0022] In some embodiments of the present application, when the processing of the predecessor task of the task to be processed is completed, before determining the first processing kernel to process the task to be processed, it also includes: determining the predecessor task processed before the task to be processed according to the second processing order of multiple tasks in the task group; determining the second processing kernel to process the predecessor task; processing each sub-function task in the predecessor task according to the processing cycle and the first processing order of each sub-function task in the predecessor task through the second processing kernel, and generating processing completion information; when receiving the processing completion information, determining that the processing of the predecessor task of the task to be processed is completed.

[0023] In an embodiment of the present application, before processing the task to be processed, the predecessor task of the task to be processed is processed first, and the task to be processed is processed after the processing of its predecessor task is completed. This can ensure that the task processing in the task group meets the task group logic and realize the sequential processing of tasks in the same task group.

[0024] In some embodiments of the present application, before determining the predecessor task to be processed before the task to be processed based on the second processing order of the multiple tasks in the task group, it also includes: determining the second dependency relationship between the tasks in the task group based on the task group logic of the task group; and determining the second processing order of the tasks in the task group based on the second dependency relationship.

[0025] In an embodiment of the present application, a second processing order of tasks in the task group is determined based on the task group logic of the task group, so that the tasks in the task group are processed according to the second processing order, thereby ensuring that the task processing in the task group complies with the task group logic and realizes the business functions corresponding to the task group.

[0026] In a second aspect, the present application provides a task processing device for a multi-core operating system, the device comprising:

[0027] A first determination module is configured to determine, for each task group, a task to be processed in the task group;

[0028] A second determining module is configured to determine a first processing core for processing the task to be processed if the processing of a predecessor task of the task to be processed is completed, wherein the predecessor task is a task processed before the task to be processed;

[0029] The processing module is configured to process each sub-function task in the task to be processed according to the processing cycle and the first processing sequence of each sub-function task through the first processing core.

[0030] In a third aspect, the present application provides a computing device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the task processing method of a multi-core operating system as described in any one of the first aspects above.

[0031] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the task processing method of a multi-core operating system as described in any one of the first aspects above.

[0032] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 is a flowchart of a task processing method of a multi-core operating system provided according to an embodiment of the present application;

[0034] Figure 2 It is a schematic diagram of an overall architecture of a task group provided according to an embodiment of the present application;

[0035] Figure 3 is a schematic diagram of allocating slots to functional groups according to an embodiment of the present application;

[0036] Figure 4 is a schematic diagram of an overall architecture of a functional group provided according to an embodiment of the present application;

[0037] Figure 5 It is a schematic diagram of allocating slots and setting execution cycles for sub-functional units according to an embodiment of the present application;

[0038] Figure 6 It is a structural schematic diagram of a task processing device of a multi-core operating system provided according to an embodiment of the present application;

[0039] Figure 7 It is a structural diagram of a computing device provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0040] The following embodiments of the technical solution of the present application will be described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.

[0041] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.

[0042] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.

[0043] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0044] In the description of the embodiments of the present application, the term "and / or" is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0045] In the description of the embodiments of the present application, the term "multiple" refers to more than two (including two). Similarly, "multiple groups" refers to more than two groups (including two groups), and "multiple pieces" refers to more than two pieces (including two pieces).

[0046] In the description of the embodiments of the present application, the technical terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the embodiments of the present application and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the embodiments of the present application.

[0047] In the description of the embodiments of the present application, unless otherwise clearly specified and limited, technical terms such as "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal connection of two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to the specific circumstances.

[0048] In order to be compatible with multiple scheduling strategies, current operating systems have multiple schedulers at the same time. The scheduling algorithms also take into account the full utilization of the CPU (Central Processing Unit) computing power and use load balancing methods for scheduling. In mainstream Linux systems, the sequential execution FIFO (First Input First Output) scheduling strategy and the RR (Round Robin) time slice scheduling strategy are provided. These two strategies can respectively solve the sequential execution of threads and time slice polling.

[0049] When migrating traditional periodic tasks based on function calls to the current multi-core operating system architecture, the following situation will occur: when the FIFO scheduling strategy is adopted, sequential execution is possible but periodic execution is not possible; if the RR scheduling strategy is adopted to ensure periodic execution, sequential execution is not possible. If both are to be maintained, not only is it necessary to create a task for each periodic function, but it is also necessary to achieve sequential execution of tasks through mutual exclusion between tasks. The entire framework is complex, and it is difficult to achieve true periodic sequential execution. In addition, due to resource limitations, the number of threads is also limited. Based on this, the present application provides a mechanism using a thread pool to retain the traditional function call method to achieve periodic sequential execution of functions.

[0050] As processors become more complex, the operating systems that come with them will also have multiple schedulers and scheduling strategies for various situations. However, this will bring challenges to the original business design. Because most of the original businesses were deployed on single-core operating systems, there will not be a situation in a multi-core operating system where other processing cores intervene to run subsequent tasks during the task execution due to the scheduler load balancing strategy. This situation will cause the tasks to not be executed sequentially, which will lead to task processing failure.

[0051] In solving the problem of sequential execution of tasks, this application proposes the concept of task pool, establishes the concept of task group from the perspective of processing core, loads the tasks to be processed into the task group, and subdivides the sub-function tasks in the tasks to be processed, so that each sub-function task can be run periodically in sequence from the perspective of function call. In this way, it is ensured that the task processing complies with the task logic, thereby ensuring the normal processing of the tasks to be processed, improving the success rate of task processing, and reducing the problem of task processing failure caused by multiple processing cores preempting tasks.

[0052] The task processing method of the multi-core operating system provided in the embodiment of the present application can be applied to the autonomous driving scenario. The task group corresponds to autonomous driving. The tasks to be processed can be functions configured by the autonomous driving system, that is, functions required to realize autonomous driving, such as driving control, motion control, data acquisition, etc. The sub-function tasks of the tasks to be processed are sub-functions included in a certain function, such as motion control including acceleration, deceleration, braking, etc.

[0053] It should be noted that the task processing method of the multi-core operating system provided in the embodiment of the present application can also be applied to any task processing scenario including a three-level structure of task group, task and sub-function task. For example, the task group can be an instant messaging software, the task to be processed is a function provided by the instant messaging software, such as chatting, etc., and the sub-function task can be a sub-function included in a certain function, such as a sub-function task including single chat, group chat, etc.

[0054] Figure 1 It is a flowchart of a task processing method of a multi-core operating system provided according to an embodiment of the present application. The method may include the following steps.

[0055] Step 101: For each task group, determine the tasks to be processed in the task group.

[0056] In the embodiment of the present application, the multi-core operating system integrates multiple complete computing engines (i.e., processing cores) in one processor, and each processing core corresponds to one thread. The concept of task group can be established from the perspective of thread, and the function group can be assembled into the task group. The function group is used to store tasks, and then the function group is subdivided according to the task logic. From the perspective of function call, the function group is divided into multiple sub-function units, and the sub-function unit is used to store sub-function tasks. Among them, the task group corresponds to the process, the function group corresponds to the thread, and the sub-function unit corresponds to the function call.

[0057] For example, Figure 2 is a schematic diagram of an overall architecture of a task group provided according to an embodiment of the present application. Figure 2 Task group 1 includes functional group 1, functional group 2 and functional group 3. Functional group 1 includes four sub-functional units, functional group 2 includes two sub-functional units, and functional group 3 includes two sub-functional units.

[0058] In some embodiments, a task group is a collection of threads, each thread represents a functional group, and related functional groups can be configured in the task group in order. The task group can use the FIFO scheduling strategy of the POSIX system interface and the scheduling affinity design to uniformly create and process each task in the task group according to the business group logic. In addition, corresponding slots can be allocated to each functional group (task).

[0059] For example, Figure 3 is a schematic diagram of allocating slots to functional groups according to an embodiment of the present application. Figure 3 , the task group corresponds to CPUx (the xth processing core), and the task group includes function group 1, function group 2 and function group 3. Function group 1 is inserted into slot 1, function group 2 is inserted into slot 2, and function group 3 is inserted into slot 3.

[0060] In the embodiment of the present application, for any task group, when a task processing request is received, the to-be-processed tasks in the task group can be determined according to the task identifier carried in the task processing request.

[0061] Step 102: when the processing of a predecessor task of the task to be processed is completed, determining a first processing core for processing the task to be processed, wherein the predecessor task is a task processed before the task to be processed.

[0062] As an example, a predecessor task is a task that needs to be processed before a task to be processed, and there may be one or more predecessor tasks, which are determined according to the business group logic of the business group.

[0063] In the embodiment of the present application, since there is a sequential relationship between multiple tasks in the task group, the processing result of the previous task may be a prerequisite for the processing of the next task. If only the pending task is processed, the task group logic may not be satisfied and the corresponding function cannot be realized. Therefore, after determining the pending task, it is necessary to first determine whether the predecessor task of the pending task has been processed. If so, the pending task is processed. As an example, according to the status, resource amount and data amount of each processing core, an idle processing core can be selected, and then the first processing core whose resource amount meets the data amount can be selected from the idle processing cores, and the first processing core is used to process the pending task.

[0064] Therefore, when the processing of the predecessor task of the task to be processed is completed, before determining the first processing core to process the task to be processed, it can be determined whether the predecessor task of the task to be processed is completed, that is, before executing step 102, the following steps can be performed:

[0065] According to the second processing order of multiple tasks in the task group, a predecessor task to be processed before the task to be processed is determined; a second processing kernel to process the predecessor task is determined; through the second processing kernel, each sub-functional task in the predecessor task is processed according to the processing cycle of each sub-functional task and the first processing order, and processing completion information is generated; when the processing completion information is received, it is determined that the processing of the predecessor task of the task to be processed is completed.

[0066] As an example, a sub-function task may include tasks that need to be executed periodically and tasks that do not need to be executed periodically. The processing cycle of a sub-function task refers to the period during which the sub-function task is executed periodically. For example, if the processing cycle of a sub-function task is 2 seconds, it means that the sub-function task is executed once every 2 seconds. If the processing cycle of a sub-function task is 0, it means that the sub-function task does not need to be executed periodically.

[0067] In a specific implementation, the predecessor task of the task to be processed can be determined according to the second processing order of multiple tasks in the task group. The predecessor task can be one or more. The task to be processed can only be processed after the predecessor tasks are all processed. In addition, according to the state of the processing core, the amount of resources and the amount of data of the predecessor task, a second processing core that can process the predecessor task can be selected, and then the second processing core is used to process the predecessor task, and the processing completion information is generated after the predecessor task is processed.

[0068] In some embodiments, the calling rules of the sub-function functions corresponding to each sub-function task can be determined based on the processing cycle of each sub-function task in the predecessor task and the first processing order, and then the second processing core can call the sub-function functions corresponding to each sub-function task according to the calling rules to process each sub-function task, thereby realizing the processing of the predecessor task.

[0069] In a specific implementation, the calling rule includes the calling order and calling cycle of the sub-function functions corresponding to each sub-function task, and the calling order is the same as the first processing order, and the calling cycle is the same as the processing cycle. After determining the calling order and calling cycle, the sub-function functions corresponding to each sub-function task can be called in the calling cycle corresponding to each sub-function task according to the calling order to realize the processing of each sub-function task in the predecessor task, and then realize the processing of the predecessor task.

[0070] As an example, the second processing core may include multiple timers, and the timers correspond to the sub-function tasks one by one, and the sub-function functions corresponding to the sub-function tasks are called through the callback functions of the timers corresponding to the sub-function tasks. In addition, a mutex is added to the callback function to ensure that the tasks can still be executed in sequence on the basis of periodic execution.

[0071] In the embodiment of the present application, before processing the task to be processed, the predecessor task of the task to be processed is processed first, and the task to be processed is processed after the predecessor task is processed, which can ensure that the task processing in the task group meets the task group logic and realize the sequential processing of tasks in the same task group. In addition, adding a mutex to the callback function can prevent the uncertainty of the execution time of the callback function itself from affecting the sequential execution of multiple sub-function tasks in the predecessor task, achieving the effect of double protection sequential execution.

[0072] Furthermore, the second processing order of the multiple tasks in the task group can be determined according to the task group logic of the task group, and the multiple tasks can realize the corresponding functions of the task group by processing them according to the second processing order. Therefore, before determining the predecessor task to be processed before the task to be processed according to the second processing order of the multiple tasks in the task group, it can also include: determining the second dependency relationship between the tasks in the task group according to the task group logic of the task group; and determining the second processing order of the tasks in the task group according to the second dependency relationship.

[0073] As an example, the task group logic is pre-configured according to the functions corresponding to the task group, and the second dependency relationship represents the relationship between multiple tasks in the task group.

[0074] In a specific implementation, the second dependency relationship between the tasks in the task group can be determined in advance according to the task group logic of the task group, such as the processing of the first task depends on the processing result of the second task, the processing of the second task depends on the processing result of the third task, and so on, and then the second processing order is determined according to the second dependency relationship, that is, the processing order of each task is after the task it depends on, such as processing the third task first, then the second task, and then the first task. In this way, according to the task group logic of the task group, the second processing order of the tasks in the task group is determined, so that the tasks in the task group are processed according to the second processing order, thereby ensuring that the task processing in the task group complies with the task group logic and realizes the business functions corresponding to the task group.

[0075] In an embodiment of the present application, a to-be-processed task in a task group is determined based on a task processing request, a second processing order of multiple tasks in the task group is determined based on the task group logic of the task group, a predecessor task that needs to be processed before the to-be-processed task is determined based on the second processing order, and a second processing core is allocated to the predecessor task. After the predecessor task is processed, the first processing core that processes the to-be-processed task is determined, thereby ensuring that task processing complies with the task group logic and that the task is completed normally.

[0076] Step 103: Processing each sub-function task in the task to be processed according to the processing cycle of each sub-function task and the first processing sequence through the first processing core.

[0077] As an example, according to the task logic of the task to be processed, the processing cycle can be configured in advance for each sub-function task and the first processing order of each sub-function task can be determined. Then, through the first processing kernel, each sub-function task can be processed according to the processing cycle and the first processing order of each sub-function task, so as to realize the processing of the task to be processed.

[0078] That is, before processing each sub-functional task in the task to be processed through the first processing kernel according to the processing cycle and the first processing order of each sub-functional task, it also includes: determining the first dependency relationship between the sub-functional tasks according to the task logic of the task to be processed; and determining the first processing order of each sub-functional task according to the first dependency relationship.

[0079] In the specific implementation, the task logic is pre-configured according to the function corresponding to the task, and the first dependency relationship represents the relationship between the sub-function tasks. According to the task logic, the first dependency relationship between the sub-function tasks can be determined, such as the processing of the first sub-function task depends on the second sub-function task, and then according to the first dependency relationship, the processing order of each sub-function task is determined to be after the other sub-function tasks it depends on. In this way, it can ensure that each sub-function task is processed according to the first processing order, and then ensure that the processing of the task to be processed complies with the task logic, so as to successfully process the task to be processed and improve the success rate of task processing.

[0080] According to some embodiments of the present application, the first processing core may include multiple timers. The specific implementation of processing each sub-function task in the task to be processed according to the processing cycle and the first processing order of each sub-function task through the first processing core may include: determining the calling rules of the sub-function functions corresponding to each sub-function task according to the processing cycle and the first processing order of each sub-function task; calling the sub-function functions corresponding to each sub-function task according to the calling rules through the callback functions of the timers corresponding to each sub-function task to process each sub-function task, wherein a mutex is added to the callback function.

[0081] In the embodiment of the present application, since the sub-function task includes a task that needs to be executed periodically, the sub-function function corresponding to the sub-function task also needs to be called periodically, so the calling period of the sub-function function refers to the period of the sub-function function being called periodically. For example, if the calling period of the sub-function function is 4 seconds, it means that the sub-function function is called once every 4 seconds, and if the calling period of the sub-function function is 0 seconds, it means that the sub-function function does not need to be called periodically.

[0082] In the specific implementation, the calling order of the sub-function functions corresponding to each sub-function task and the calling cycle of each sub-function function can be determined according to the processing cycle of each sub-function task and the first processing order. In order to ensure the periodic execution of the sub-function tasks, a timer can be configured for each sub-function task, and through the callback function of the timer corresponding to each sub-function task, each sub-function function can be called according to the calling cycle and calling order of each sub-function function to process the corresponding sub-function task and realize the processing of the task to be processed.

[0083] In some embodiments, the specific implementation of determining the calling rules of the sub-function functions corresponding to each sub-function task based on the processing cycle of each sub-function task and the first processing order may include: determining the calling order and calling cycle of the sub-function functions corresponding to each sub-function task based on the first processing order and the processing cycle, and taking the calling order and calling cycle as the calling rules.

[0084] As an example, the first processing order of each sub-function task can be determined as the calling order of the sub-function function corresponding to the sub-function task, and the processing period of each sub-function task can be determined as the calling period of the sub-function function corresponding to the sub-function task.

[0085] For example, assuming that the processing cycle of sub-function task A is 2 seconds, the calling cycle of sub-function function a corresponding to sub-function task A is 2 seconds. Assuming that the first processing order of the three sub-function tasks A, B, and C is ABC, and the sub-function functions corresponding to these three sub-function tasks are a, b, and c, respectively, the calling order of the sub-function functions corresponding to these three sub-function tasks is abc.

[0086] In an embodiment of the present application, the calling order and calling cycle of the sub-function function are determined according to the processing order and processing cycle of the sub-function task, so that the calling rules that conform to the processing logic of the sub-function task can be obtained, and the periodic sequential calling of the sub-function function can be realized, thereby realizing the periodic sequential execution of the sub-function task.

[0087] As an example, the mutex of the callback function indicates that if the sub-function called by the callback function has not been executed, even if the calling cycle of other sub-function functions is reached, it is necessary to wait for the sub-function function to be executed before calling other sub-function functions in the calling order. This ensures the periodic sequential calling of sub-function functions, that is, ensures the periodic sequential execution of sub-function tasks.

[0088] In the specific implementation, a mutex is added to the callback function, which can be understood as a mutex lock. In the process of calling the sub-function function through the callback function, the mutex lock can be used to lock the function calling program, and unlock it after the current sub-function function call is completed. Then, the next sub-function function is determined according to the calling order, and in the process of calling the next sub-function function, the mutex lock is used to lock the function calling program until the next sub-function function call is completed and then unlocked.

[0089] Exemplarily, assuming that the task to be processed includes three sub-function tasks A, B, and C, and the first processing order is ABC, the processing cycles of A, B, and C are 2 seconds, 4 seconds, and 8 seconds respectively, then the calling cycles of the sub-function functions a, b, and c corresponding to the three sub-function tasks are 2 seconds, 4 seconds, and 8 seconds respectively, and the calling order is abc. Then the sub-function function a is called every 2 seconds, the sub-function function b is called every 4 seconds, and the sub-function function c is called every 8 seconds, but when the second call of the sub-function function a and the first call of the sub-function function b are reached at the same time, or even when the first call of the sub-function function b precedes the second call of the sub-function function a, it is necessary to ensure that the sub-function function a is called first. Therefore, this scheme adds a mutex to the callback function to lock the function call program, ensuring that each sub-function function is called after the previous sub-function function call is completed, that is, the sub-function function a must be called first, and then the sub-function function b is called, which can ensure the sequential execution of the sub-function tasks. On this basis, the process of calling the sub-function functions a, b, and c can be aabaabcaabaabc......, until the task processing is completed.

[0090] In an embodiment of the present application, the sub-function tasks of the task to be processed include tasks that need to be processed periodically. In order to ensure the periodic execution of the sub-function tasks, a timer can be assigned to each sub-function task, and each sub-function task can be processed by calling a function of the timer corresponding to the sub-function task, that is, the periodic sequential operation of the sub-function tasks is achieved on the basis of retaining the original task logic of the task to be processed; and, in order to prevent the uncertainty of the execution time of the callback function itself from affecting the sequential execution of the sub-function tasks, a mutex is added to the callback function to achieve the effect of doubly protecting the sequential execution of the sub-function tasks, thereby improving the success rate of task processing.

[0091] It should be noted that in the embodiment of the present application, before processing the task, the task group has been pre-configured according to the function, and the task group is divided into multiple tasks, and each task is then divided into multiple sub-function tasks according to the function call. In order to facilitate recording and modification, each task is inserted into the corresponding slot, and each sub-function task is inserted into the corresponding sub-slot.

[0092] That is, before determining the tasks to be processed in the task group, the process may further include: allocating a corresponding subslot to each sub-function task; and recording the subslot number corresponding to each sub-function task in a linked list according to the first processing sequence.

[0093] In the specific implementation, each sub-function task can be inserted into the corresponding slot according to the first processing order of each sub-function task, and the slots are associated through a linked list, that is, the order of the sub-slot numbers corresponding to each sub-function task is recorded in the linked list, then the order of the sub-slot numbers can reflect the first processing order of the sub-function tasks.

[0094] Figure 4 is a schematic diagram of an overall architecture of a functional group provided according to an embodiment of the present application. Figure 4 , the functional group (task) includes 4 sub-functional units (sub-functional tasks), sub-functional unit 1 is inserted into sub-slot 2, sub-functional unit 2 is inserted into sub-slot 1, sub-functional unit 3 is inserted into sub-slot 3, sub-functional unit 4 is inserted into sub-slot 4, and the first processing order of the sub-functional tasks (i.e., the execution order of the sub-functional units) is sub-functional task 2-sub-functional task 1-sub-functional task 3-sub-functional task 4.

[0095] Furthermore, since the embodiment of the present application allocates a subslot to each sub-function task, and the order of the subslot numbers in the linked list can represent the processing order of the sub-function tasks, the task to be processed can be modified by modifying the subslot number.

[0096] Therefore, the method may further include: receiving a modification instruction for the task to be processed; modifying the subslot number in the linked list in response to the modification instruction; and redetermining the first processing order according to the modified subslot number to modify the task to be processed.

[0097] In a specific implementation, the modification instruction may be pre-set or triggered during task processing or by a user. The modification instruction may include a specific modification strategy. The sub-slot number in the linked list is modified according to the modification strategy, and the sub-function tasks of the task to be processed are re-sorted according to the modified sub-slot number, that is, the first processing order is re-determined, so that the modification of the task to be processed can be achieved.

[0098] In the embodiment of the present application, when it is necessary to modify the task to be processed, the sub-function tasks can be added, deleted and the order can be adjusted by modifying the sub-slot number, thereby improving the flexibility of task modification.

[0099] In a first possible implementation method, the modification instruction may include adding a sub-function task. In response to the modification instruction, the specific implementation of modifying the sub-slot number in the linked list may include: generating a new sub-function task in response to the modification instruction, and allocating a corresponding new sub-slot to the new sub-function task; and adding the sub-slot number corresponding to the new sub-slot to the linked list according to the first dependency relationship between the new sub-function task and each sub-function task.

[0100] In a specific implementation, the modification instruction is used to instruct the addition of a sub-function task, which may include a newly added sub-function task of the task to be processed and the first dependency relationship between the newly added sub-function task and other sub-function tasks. The newly added sub-function task can be generated according to the modification instruction, and the corresponding newly added sub-slot can be allocated to the newly added sub-function task. The adjacent predecessor task that the newly added sub-function task depends on can also be determined according to the first dependency relationship, and the sub-slot number corresponding to the newly added sub-slot is added after the sub-slot number of the adjacent predecessor task. Then, the order of the sub-slot numbers recorded in the linked list is the new first processing order of all sub-function tasks included in the task to be processed. In this way, the processing logic of the task to be processed is changed, and the modification of the task to be processed is realized.

[0101] In an embodiment of the present application, by adding the sub-slot number of the newly added sub-function task at the appropriate position in the linked list, the sub-function tasks in the task to be processed are reordered, that is, the sub-function task required to be executed to process the task to be processed is changed, thereby achieving the effect of dynamically creating a new sub-function task and improving the flexibility of task modification.

[0102] In a second possible implementation, the modification instruction may also include deleting a sub-function task. In response to the modification instruction, the specific implementation of modifying the sub-slot number in the linked list may include: deleting the sub-function task to be deleted in response to the modification instruction, wherein the sub-function task to be deleted is an original sub-function task in the task to be processed; and deleting the sub-slot number corresponding to the sub-function task to be deleted in the linked list.

[0103] In the specific implementation, the modification instruction is used to indicate the deletion of sub-function tasks, which may include sub-function tasks to be deleted in the tasks to be processed. The sub-function tasks to be deleted can be deleted according to the modification instruction, and the sub-slot number corresponding to the sub-function tasks to be deleted can be deleted from the linked list. In this way, in the process of processing sub-function tasks, the sub-function functions of each sub-function task are called according to the order of the sub-slot numbers recorded in the linked list, and the tasks can be processed according to the modified processing logic, thereby realizing the modification of the tasks to be processed.

[0104] In an embodiment of the present application, by deleting the sub-slot number of the sub-function task to be deleted in the linked list, the sub-function tasks in the task to be processed are reordered, that is, the sub-function task required to be executed to process the task to be processed is changed, thereby achieving the effect of dynamically deleting the sub-function task and improving the flexibility of task modification.

[0105] In a third possible implementation, the modification instruction may also include modifying the task logic. In response to the modification instruction, the specific implementation of modifying the sub-slot number in the linked list may include: modifying the task logic of the task to be processed in response to the modification instruction; redetermining the first processing order of each sub-function task according to the modified task logic; and modifying the sub-slot number corresponding to each sub-function task in the linked list according to the redetermined first processing order.

[0106] In a specific implementation, the modification instruction may include specific modification rules, such as which sub-function tasks' sub-task logic to modify or the processing order of sub-function tasks to modify, etc. Therefore, the task logic of the task to be processed can be modified according to the modification instruction, and then the first dependency relationship between the sub-function tasks can be re-determined according to the modified task logic, and the first processing order of the sub-function tasks can be re-determined according to the re-determined first dependency relationship, and the sub-slot number of each sub-function task in the linked list can be modified according to the first processing order. In this way, in the process of processing the sub-function tasks, the sub-function functions of each sub-function task are called according to the order of the sub-slot numbers recorded in the linked list, and the task processing can be performed according to the modified processing logic, thereby realizing the modification of the task to be processed.

[0107] In an embodiment of the present application, by changing the sub-slot number corresponding to each sub-function task in the linked list, the sub-function tasks in the task to be processed are reordered, that is, the sub-function tasks required to be executed to process the task to be processed are changed, thereby achieving the effect of dynamically modifying the task logic of the task to be processed and improving the flexibility of task modification.

[0108] Furthermore, after allocating a subslot to each sub-function task, the execution period of each sub-function task can be associated with the subslot number. Figure 5 , Figure 5This is a schematic diagram for allocating slots and setting execution cycles for sub-functional units provided according to an embodiment of the present application, where sub-slot number 1 corresponds to processing cycle 1, sub-slot number 2 corresponds to processing cycle 2, sub-slot number 3 corresponds to processing cycle 3, sub-slot number 4 corresponds to processing cycle 4, and sub-slot number x corresponds to processing cycle x.

[0109] The task processing method of the multi-core operating system provided in the embodiment of the present application establishes the concept of task group from the perspective of thread, groups the function into the task group, and subdivides the sub-functions in the function group, establishes sub-function units from the perspective of function call, and configures the processing cycle for each sub-function unit, so that each sub-function unit can run periodically in sequence, that is, it ensures that the task processing conforms to the task logic, thereby ensuring the normal processing of the task to be processed, improving the success rate of task processing, and reducing the problem of task processing failure caused by multiple processing cores preempting tasks. In addition, a mutex is added to the callback function of the timer corresponding to each sub-function unit, so as to avoid the uncertainty of the execution time of the callback function itself affecting the sequential execution, and achieve the effect of double protection of the sequential execution of the sub-function unit. In addition, the corresponding sub-slot is allocated to each sub-function task, and the sub-slot is associated with the linked list, so that the sub-function task can be processed according to the sub-slot number, which improves the processing efficiency of the sub-function task; and in the case where the task to be processed needs to be modified, the sub-slot number can be modified to realize the addition, deletion and order adjustment of the sub-function task, so as to achieve the effect of dynamically modifying the task logic of the task to be processed, and improve the flexibility of task modification.

[0110] Next, taking the autonomous driving scenario as an example, the task processing methods of multiple operating systems are explained.

[0111] In the autonomous driving scenario, autonomous driving corresponds to the task group, driving control, motion control and data acquisition correspond to the functional group (i.e., task) of the task group, driving control includes sub-functional units (i.e., sub-functional tasks) such as forward, backward, and braking, motion control includes sub-functional units (i.e., sub-functional tasks) such as acceleration and deceleration, and data acquisition includes sub-functional units (i.e., sub-functional tasks) such as environmental and vehicle data acquisition, data analysis, and control instruction generation. In the autonomous driving scenario, the second processing order of the functional group is data acquisition-driving control-motion control, and the first processing order of the sub-functional units included in data acquisition is environmental and vehicle data acquisition-data analysis-control instruction generation. Each functional group is pre-inserted into the corresponding slot according to the second processing order, and the slot number is recorded in the linked list according to the second processing order. Each sub-functional unit of the same functional group is inserted into the corresponding sub-slot according to the first processing order, and the sub-slot number is recorded in the linked list according to the first processing order.

[0112] After receiving the task processing request, the task to be processed is determined according to the task processing request. Assuming that the task to be processed is a driving control task, the idle second processing core (i.e., thread) can be allocated to the data acquisition task to execute the data acquisition task. Specifically, the sub-function functions corresponding to each sub-function unit can be called in the order of environment and vehicle data acquisition-data analysis-control instruction generation to realize the processing of the data acquisition task and generate task completion information. Then the idle first processing core (i.e., thread) is allocated to the driving control task to execute the driving control task. Specifically, assuming that the sub-function unit determined according to the task completion information is forward, the sub-function function corresponding to the forward sub-function unit can be called to realize the processing of the driving control task. During the processing of the driving control task, the data acquisition task is also continuously collecting data and analyzing it. After receiving the task completion information of the data acquisition task, the processing of the sub-function unit of the driving control task can be adjusted in real time. And, after the processing of the driving control task is completed, the motion control task is processed according to the generated task completion information to realize the automatic driving of the vehicle.

[0113] Figure 6 1 is a schematic diagram of a task processing device of a multi-core operating system provided according to some embodiments of the present application, the device comprising:

[0114] The first determination module 601 is configured to determine, for each task group, the tasks to be processed in the task group;

[0115] The second determining module 602 is configured to determine a first processing core for processing the task to be processed when the processing of a predecessor task of the task to be processed is completed, wherein the predecessor task is a task processed before the task to be processed;

[0116] The processing module 603 is configured to process each sub-function task in the task to be processed according to the processing cycle and the first processing sequence of each sub-function task through the first processing core.

[0117] In some embodiments of the present application, the first processing core includes multiple timers, and the processing module 603 is further configured to:

[0118] Determine the calling rules of the sub-function functions corresponding to each sub-function task according to the processing cycle of each sub-function task and the first processing sequence;

[0119] Through the callback function of the timer corresponding to each sub-function task, the sub-function function corresponding to each sub-function task is called according to the calling rule to process each sub-function task, wherein a mutex is added to the callback function.

[0120] In some embodiments of the present application, the processing module 603 is further configured to:

[0121] According to the first processing sequence and processing cycle, the calling sequence and calling cycle of the sub-function functions corresponding to each sub-function task are determined, and the calling sequence and calling cycle are used as the calling rule.

[0122] In some embodiments of the present application, the device further includes a slot allocation module configured to:

[0123] Allocate corresponding sub-slots to each sub-functional task;

[0124] According to the first processing order, the subslot number corresponding to each sub-function task is recorded in the linked list.

[0125] In some embodiments of the present application, the device further includes a modification module configured to:

[0126] Receive modification instructions for pending tasks;

[0127] In response to the modification instruction, modify the subslot number in the linked list;

[0128] The first processing sequence is re-determined according to the modified sub-slot number to modify the tasks to be processed.

[0129] In some embodiments of the present application, the modification instruction includes adding a sub-function task, and the modification module is further configured to:

[0130] In response to the modification instruction, generating a newly added sub-function task and allocating a corresponding newly added sub-slot to the newly added sub-function task;

[0131] According to the first dependency relationship between the newly added sub-function task and each sub-function task, the sub-slot number corresponding to the newly added sub-slot is added to the linked list.

[0132] In some embodiments of the present application, the modification instruction further includes deleting a sub-function task, and the modification module is further configured to:

[0133] In response to the modification instruction, the sub-function task to be deleted is deleted, wherein the sub-function task to be deleted is an original sub-function task in the task to be processed;

[0134] Delete the subslot number corresponding to the sub-function task to be deleted in the linked list.

[0135] In some embodiments of the present application, the modification instruction further includes modifying the task logic, and the modification module is further configured to:

[0136] In response to the modification instruction, modify the task logic of the task to be processed;

[0137] Re-determine the first processing order of each sub-function task according to the modified task logic;

[0138] According to the re-determined first processing order, the subslot number corresponding to each sub-function task in the linked list is modified.

[0139] In some embodiments of the present application, the apparatus further includes a third determining module configured to:

[0140] Determine the first dependency relationship between the sub-function tasks according to the task logic of the task to be processed;

[0141] According to the first dependency relationship, a first processing order of each sub-functional task is determined.

[0142] In some embodiments of the present application, the device further includes a pre-task processing module configured to:

[0143] Determining, according to the second processing order of the plurality of tasks in the task group, a predecessor task to be processed before the task to be processed;

[0144] Determining a second processing core for processing the preceding task;

[0145] Processing each sub-function task according to the processing cycle of each sub-function task in the predecessor task and the first processing sequence through the second processing core, and generating processing completion information;

[0146] When the processing completion information is received, it is determined that the processing of the predecessor task of the task to be processed is completed.

[0147] In some embodiments of the present application, the apparatus further includes a fourth determining module configured to:

[0148] Determine the second dependency between the tasks in the task group according to the task group logic of the task group;

[0149] According to the second dependency, a second processing order of each task in the task group is determined.

[0150] Using the task processing method of the multi-core operating system provided by the embodiment of the present application, for each task group, determine the pending tasks in the task group; when the processing of the predecessor task of the pending task is completed, determine the first processing core that processes the pending task, wherein the predecessor task is the task processed before the pending task; through the first processing core, process each sub-function task according to the processing cycle and the first processing sequence of each sub-function task in the pending task. In this way, different processing cores in the multi-core operating system are used to process the tasks in the task group in sequence, and the periodic processing and sequential processing of the sub-function tasks can be guaranteed during the processing process, that is, the task processing is guaranteed to comply with the task logic, thereby ensuring the normal processing of the pending task, improving the success rate of task processing, and reducing the problem of task processing failure caused by multiple processing cores preempting tasks.

[0151] The above is a schematic scheme of a task processing device of a multi-core operating system in an embodiment of the present application. It should be noted that the technical scheme of the task processing device of the multi-core operating system and the technical scheme of the task processing method of the multi-core operating system belong to the same concept, and the details not described in detail in the technical scheme of the task processing device of the multi-core operating system can be referred to the description of the technical scheme of the task processing method of the multi-core operating system.

[0152] Figure 7 7 is a schematic diagram of a computing device according to an embodiment of the present application. The computing device 700 includes: a memory 701, a processor 702, and a computer program stored in the memory 701 and executable on the processor 702. When the processor 702 executes the computer program, a task processing method of a multi-core operating system as proposed in any of the above embodiments is implemented.

[0153] The present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, a task processing method of a multi-core operating system as proposed in any of the above embodiments is implemented.

[0154] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wirings (electronic devices), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM, Erasable Programmable Read-Only Memory or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM, Compact Disk Read Only Memory). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0155] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA, Programmable Gate Array), a field programmable gate array (FPGA, Field Programmable Gate Array), etc.

[0156] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application, and they should all be included in the scope of the claims and specification of the present application. In particular, as long as there is no structural conflict, the various technical features mentioned in the various embodiments can be combined in any way. The present application is not limited to the specific embodiments disclosed herein, but includes all technical solutions that fall within the scope of the claims.

Claims

1. A task processing method for a multi-core operating system, characterized in that: The method comprises: For each task group, determining the tasks to be processed in the task group; Determining a first processing core for processing the task to be processed when the processing of a predecessor task of the task to be processed is completed, wherein the predecessor task is a task processed before the task to be processed; Processing each sub-function task in the task to be processed according to the processing cycle of each sub-function task and the first processing sequence by the first processing core, wherein the processing cycle of the sub-function task refers to the cycle in which the sub-function task is periodically executed; The first processing core includes a plurality of timers, and the first processing core processes each sub-function task in the task to be processed according to the processing cycle and the first processing sequence of each sub-function task, including: Determine the calling rules of the sub-function functions corresponding to each sub-function task according to the processing cycle of each sub-function task and the first processing sequence; Through the callback function of the timer corresponding to each sub-function task, the sub-function function corresponding to each sub-function task is called according to the calling rule to process each sub-function task, wherein a mutex is added to the callback function.

2. The method according to claim 1, characterized in that Determining the calling rules of the sub-function functions corresponding to each sub-function task according to the processing cycle of each sub-function task and the first processing sequence includes: According to the first processing sequence and the processing cycle, the calling sequence and the calling cycle of the sub-function functions corresponding to each sub-function task are determined, and the calling sequence and the calling cycle are used as the calling rule.

3. The method according to claim 1 or 2, characterized in that: Before determining the tasks to be processed in each task group, the method further includes: Allocate corresponding sub-slots to each sub-functional task; According to the first processing order, the subslot number corresponding to each sub-function task is recorded in a linked list.

4. The method according to claim 3, characterized in that The method further comprises: receiving a modification instruction for the task to be processed; In response to the modification instruction, modify the subslot number in the linked list; The first processing order is re-determined according to the modified sub-slot number to modify the task to be processed.

5. The method according to claim 4, characterized in that The modification instruction includes adding a sub-function task, and the modification of the sub-slot number in the linked list in response to the modification instruction includes: In response to the modification instruction, generating a newly added sub-function task, and allocating a corresponding newly added sub-slot to the newly added sub-function task; According to the first dependency relationship between the newly added sub-function task and each sub-function task, the sub-slot number corresponding to the newly added sub-slot is added to the linked list.

6. The method according to claim 4 or 5, characterized in that: The modification instruction further includes deleting a sub-function task, and the modifying the sub-slot number in the linked list in response to the modification instruction includes: In response to the modification instruction, deleting the sub-function task to be deleted, wherein the sub-function task to be deleted is an original sub-function task in the task to be processed; The subslot number corresponding to the sub-function task to be deleted is deleted from the linked list.

7. The method according to claim 4 or 5, characterized in that: The modification instruction further includes modifying the task logic, and the modification of the subslot number in the linked list in response to the modification instruction includes: Modifying the task logic of the task to be processed in response to the modification instruction; Re-determine the first processing order of each sub-function task according to the modified task logic; According to the re-determined first processing order, the subslot number corresponding to each sub-function task in the linked list is modified.

8. The method according to any one of claims 1, 2 or 4, characterized in that: Before the first processing core processes each sub-function task in the task to be processed according to the processing cycle and the first processing sequence of each sub-function task, the method further includes: Determining the first dependency relationship between the sub-function tasks according to the task logic of the task to be processed; A first processing order of the sub-functional tasks is determined according to the first dependency relationship.

9. The method according to any one of claims 1, 2 or 4, characterized in that: In the case that the processing of the predecessor task of the task to be processed is completed, before determining the first processing core to process the task to be processed, the method further includes: Determining, according to a second processing order of the plurality of tasks in the task group, a predecessor task to be processed before the task to be processed; determining a second processing core for processing the preceding task; Processing each sub-function task in the predecessor task according to the processing cycle of each sub-function task and the first processing sequence through the second processing core, and generating processing completion information; When the processing completion information is received, it is determined that the processing of the predecessor task of the task to be processed is completed.

10. The method according to claim 9, characterized in that Before determining the predecessor task to be processed before the task to be processed according to the second processing order of the plurality of tasks in the task group, the method further includes: Determining a second dependency relationship between tasks in the task group according to the task group logic of the task group; A second processing order of the tasks in the task group is determined according to the second dependency relationship.

11. A task processing device for a multi-core operating system, characterized in that: The device comprises: A first determination module is configured to determine, for each task group, a task to be processed in the task group; A second determining module is configured to determine a first processing core for processing the task to be processed if the processing of a predecessor task of the task to be processed is completed, wherein the predecessor task is a task processed before the task to be processed; a processing module configured to process each sub-function task in the task to be processed according to a processing cycle of each sub-function task and a first processing sequence through the first processing core, wherein the processing cycle of the sub-function task refers to a cycle in which the sub-function task is periodically executed; The first processing core includes a plurality of timers, and the processing module is further configured to: Determine the calling rules of the sub-function functions corresponding to each sub-function task according to the processing cycle of each sub-function task and the first processing sequence; Through the callback function of the timer corresponding to each sub-function task, the sub-function function corresponding to each sub-function task is called according to the calling rule to process each sub-function task, wherein a mutex is added to the callback function.

12. A computing device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the task processing method of the multi-core operating system as described in any one of claims 1 to 10 is implemented.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the task processing method of the multi-core operating system as described in any one of claims 1 to 10 is implemented.

Citation Information

Patent Citations

  • Method for processing video processing tasks by aid of multi-core processing chip and system using method

    CN102609306A

  • Power consumption control method and apparatus

    CN106535311A

  • Energy-saving scheduling method and device for multi-core processor associated with periodic task and medium

    CN115480902A

  • Methods and apparatus for task management in a multi-processor system

    US20050188373A1

  • Method for the deterministic execution and synchronization of an information processing system comprising a plurality of processing cores executing system tasks

    US20110302589A1