METHOD AND COMPUTER FOR THE MANAGEMENT OF DATA EXCHANGES BETWEEN A PLURALITY OF TASKS

20220357986 · 2022-11-10

    Inventors

    Cpc classification

    International classification

    Abstract

    Disclosed is a method of managing data exchanges between a plurality of tasks by a computer of a vehicle, in particular a motor vehicle, the method including a phase of grouping functions into sets, each set including data-producing functions and consuming functions. For each set of functions, a first phase includes the steps of executing the producing functions in order to produce what are referred to as “produced” data, and of storing a copy of each produced datum, and a second phase includes the steps of restoring the data to be consumed by the consuming functions, on the basis of the stored copies, and of executing the consuming functions on the basis of the restored data to be consumed.

    Claims

    1. A method for managing data exchanges between a plurality of tasks by means of a computer of a vehicle, said computer comprising at least one core, each task making it possible to execute at least one function, each function being designated as producing and/or consuming at least one datum, said method comprising: c) a phase of grouping functions into sets, each set comprising data-producing functions, the execution of which is allocated to a given first task, and data-consuming functions, which consume data produced by said data-producing functions, the execution of which is allocated to a given second task different from the first task, d) for each set of functions: i) a first phase comprising the steps of: 1) executing the data-producing functions of the set in order to produce what are referred to as “produced” data, 2) storing a copy of each produced datum, ii) a second phase comprising the steps of: 1) restoring the data to be consumed by the consuming functions of the set, on the basis of the stored copies, 2) executing the consuming functions of the set on the basis of the restored data to be consumed.

    2. The method as claimed in the claim 1, wherein, in the step of executing the producing functions, the execution of the data-producing functions in the first task, to which the execution is allocated, is sequential.

    3. The method as claimed in claim 1, wherein, in the step of executing the consuming functions, the execution of the data-consuming functions in the second task, to which the execution is allocated, is sequential.

    4. The method as claimed in claim 1, in the storing step, the copies are stored in a memory comprising a plurality of regions, by assigning the value of each copy to one region of the plurality of regions.

    5. The method as claimed in claim 4, wherein, in the restoring step, the value of each copy stored in a region of the memory is respectively assigned to one datum to be consumed.

    6. A vehicle computer for managing data exchanges between a plurality of tasks, said computer comprising at least one core, each task making it possible to execute at least one function, each function being designated as producing and/or consuming at least one datum, said computer being configured to: a) group functions into sets, each set comprising data-producing functions, the execution of which is allocated to a given first task, and data-consuming functions, which consume data produced by said data-producing functions, the execution of which is allocated to a given second task different from the first task, b) for each set of functions: 1) execute the data-producing functions of the set in order to produce what are referred to as “produced” data, 2) save a copy of each produced datum, 3) restore the data to be consumed by the consuming functions of the set, on the basis of the stored copies, 4) execute the consuming functions of the set on the basis of the restored data to be consumed.

    7. The computer as claimed in claim 6, said computer being configured to execute the data-producing functions, in the first task to which the execution is allocated, sequentially.

    8. The computer as claimed in claim 6, said computer being configured to execute the data-consuming functions, in the second task to which the execution is allocated, sequentially.

    9. The computer as claimed in claim 6, said computer being configured to store a copy of each produced datum in a memory comprising a plurality of regions, by assigning the value of each copy, to one region of the plurality of regions.

    10. A vehicle comprising a computer as claimed in claim 6.

    11. The method of claim 2, wherein, in the step of executing the consuming functions, the execution of the data-consuming functions in the second task, to which the execution is allocated, is sequential.

    12. The method of claim 2, in the storing step, the copies are stored in a memory comprising a plurality of regions, by assigning the value of each copy to one region of the plurality of regions.

    13. The method of claim 3, in the storing step, the copies are stored in a memory comprising a plurality of regions, by assigning the value of each copy to one region of the plurality of regions.

    14. The method of claim 11, in the storing step, the copies are stored in a memory comprising a plurality of regions, by assigning the value of each copy to one region of the plurality of regions.

    15. The method of claim 11, wherein, in the restoring step, the value of each copy stored in a region of the memory is respectively assigned to one datum to be consumed.

    16. The method of claim 12, wherein, in the restoring step, the value of each copy stored in a region of the memory is respectively assigned to one datum to be consumed.

    17. The method of claim 13, wherein, in the restoring step, the value of each copy stored in a region of the memory is respectively assigned to one datum to be consumed.

    18. The computer of claim 7, said computer being configured to execute the data-consuming functions, in the second task to which the execution is allocated, sequentially.

    19. The computer of claim 7, said computer being configured to store a copy of each produced datum in a memory comprising a plurality of regions, by assigning the value of each copy to one region of the plurality of regions.

    20. The computer of claim 8, said computer being configured to store a copy of each produced datum in a memory comprising a plurality of regions, by assigning the value of each copy to one region of the plurality of regions.

    Description

    BRIEF DESCRIPTION OF THE DRAWINGS

    [0052] Other features and advantages of the invention will become more apparent on reading the description which follows. This description is purely illustrative and must be read with reference to the attached drawings, in which:

    [0053] FIG. 1 shows an example of execution of a plurality of tasks by a computer according to the invention,

    [0054] FIG. 2 illustrates a transition corresponding to the execution of two consecutive tasks by a computer according to the invention,

    [0055] FIG. 3 shows an example of implementation of the task-managing method according to the invention.

    DESCRIPTION OF THE PREFERRED EMBODIMENTS

    [0056] Computer

    [0057] A computer for managing data exchanges between a plurality of tasks will now be described, said computer being intended to be mounted in a vehicle, in particular a motor vehicle, and configured to execute tasks, allowing a control function of the engine of said vehicle, such as ignition, fuel injection or gas recirculation, to be implemented by an actuator.

    [0058] The computer comprises at least one core making it possible to execute at least one task comprising at least one function, in particular a function for computing and/or determining data. The computer also comprises a protection mechanism for protecting competition between the execution of various tasks.

    [0059] Core

    [0060] As explained previously, each core is in particular configured to execute a task, a plurality of independent tasks or a series of interdependent tasks which are allocated to it, via its operating system. Each task allows a sequence of one or more functions to be executed and is characterized by an activation scheme, an allocation scheme and a priority level.

    [0061] The activation scheme of a task defines the type of activation of the execution of said task. The activation of the task can be synchronous, and therefore the period of execution of the task is constant, or asynchronous, and therefore the period of execution of the task is variable, or event-driven, or, in other words, after detection of a state of the system that requires the task to be executed.

    [0062] The allocation scheme of a task defines the one or more cores to which said task is allocated. Specifically, a task can be executed on a single core or in a manner distributed between a plurality of cores.

    [0063] The priority level of each task depends on the activation scheme and on the allocation scheme to one or more cores. For example, the priority level is defined depending on the execution period, and is inversely proportional to said execution period. In other words, in this example, the shorter the execution period of a task, the higher the priority level. There are obviously other ways of determining the priority level of each task.

    [0064] The operating system makes it possible to choose, at any given time, which task must be executed and in what order, depending on the activation scheme of the tasks and their priority level.

    [0065] Each function is said to “produce” and/or “consume” at least one datum. Specifically, each producing function is executed and makes it possible to determine one or more data, called “produced” data, and each consuming function is executed on the basis of one or more data, called data “to be consumed”.

    [0066] Moreover, each function is also characterized by its activation scheme and therefore by its execution period.

    [0067] Protection Mechanism

    [0068] The protection mechanism is configured to store a copy of the value of the data produced by a task and to restore data to be consumed by another task, on the basis of the stored copies.

    [0069] Thus, the protection mechanism temporarily prevents competition between the tasks, and therefore temporarily stops the competition between the execution of each task during storage of the produced data and restoration of the data to be consumed.

    [0070] In the present case, the protection mechanism comprises a transition module and a physical memory.

    [0071] a) Transition Module RT

    [0072] The transition module RT manages the transfer of data between competing tasks depending on the priority level of the tasks, in order to avoid any problems with competition between the execution of tasks. The management of the data transfer depends on the activation scheme, the priority level, and the allocation scheme, that is to say the core to which the task is allocated.

    [0073] The transition module RT is configured to aggregate the transfer of data from the producing functions to the consuming functions via a function for storing the data produced by the producing functions and a function for restoring the data to be consumed by the consuming functions.

    [0074] The transition module RT, via its storing function, makes it possible to determine the copy of a produced datum and is implemented to store this copy.

    [0075] The transition module RT, via its restoring function, allows the data to be consumed to be determined on the basis of the value of a stored copy. In other words, the transition module RT is implemented to restore the data to be consumed.

    [0076] b) Memory

    [0077] The physical memory of the protection mechanism comprises a plurality of regions, making it possible to store the data produced by a task or by a series of tasks or by a plurality of independent tasks and to restore the data while ensuring consistency and stability.

    [0078] According to other embodiments, the protection mechanism can for example consist of semaphores or queues or in imposing a forced sequentiality between the tasks.

    EXAMPLE 1

    [0079] With reference to FIG. 1, a first example of execution of a plurality of producing and consuming functions A, B, C, D, will now be presented. In this example, the functions A and C are what are referred to as “producing” functions, and are executed in a first task 1, which is called the “source”, the execution period of which is equal to 5 milliseconds, and the functions B and D are what are referred to as “consuming” functions, and are executed in a second task 2, called the “target”, the execution period of which is equal to 10 milliseconds. The first task 1 and the second task 2, at 5 milliseconds and at 10 milliseconds, respectively, may be allocated to the same core or to a plurality of different cores.

    [0080] The invention is not limited to any particular number of tasks, functions and cores.

    [0081] The producing functions A and C are therefore executed sequentially in the first task 1 and the consuming functions B and D are also executed sequentially in the second task 2.

    [0082] A single transition module RT is configured to aggregate the transfer of data from producing function A (producing function C, respectively) to consuming function B (consuming function D, respectively) via the storing function and the restoring function.

    EXAMPLE 2

    [0083] With reference to FIG. 2, a transfer of data from the first task 1 executing the producing functions A, C to the second task 2 executing the consuming functions B, D has been shown. To simplify the description, only transfer between the producing function A and the consuming function B which consumes the data produced by the producing task A will be described.

    [0084] A transition module RT is connected between the first task 1 and the second task 2. In other words, the transition module RT connects the producing function A to the consuming function B, and the producing function C to the consuming function D.

    [0085] As detailed previously in the first example, the first task 1 has an execution period equal to 5 milliseconds and the second task 2 has an execution period equal to 10 milliseconds. Thus, the first task 1 has a higher priority level than the second task 2. For this reason the producing function A is carried out before the consuming function B.

    [0086] The producing function A is configured to be executed on the basis of an input value, which is for example defined by a device or a function external to the plurality of functions A, B, C, D, and makes it possible to determine a produced datum VIA after execution of the producing function A.

    [0087] The transition module RT is configured to ensure the transfer of the datum VIA produced by the producing function A to the consuming function B. Thus, the transition module RT makes it possible to determine a copy V.sub.1A_int of the produced datum ViA and to store this copy V.sub.1A_int.

    [0088] The protection mechanism uses the memory MEM to store, or in other words to write, the copy V.sub.1A_intto a region contained in said memory MEM.

    [0089] The consuming function B is configured to read the datum V.sub.2B to be consumed, on the basis of the stored copy V.sub.1A_int, and to execute, on the basis of the datum V.sub.2B to be consumed.

    [0090] Method

    [0091] With reference to FIG. 3, one embodiment of the method for managing data exchanges between a plurality of tasks by means of a computer such as presented above will now be described, in which embodiment the four functions A, B, C, D that were described with reference to FIG. 1 will be considered.

    [0092] The method according to the invention first of all comprises a phase of grouping functions into sets E.sub.T. Producing functions, which are executed in a given first task 1, and consuming functions, which consume the data produced by said producing functions, and which are executed in a given second task 2, are grouped together in each set E.sub.T. In the example presented here, the set E.sub.T therefore contains the producing functions A and C, and the consuming functions B and D, which consume the data produced by said producing functions A, C.

    [0093] Each producing function A and C can comprise a plurality of input values.

    [0094] For each set E.sub.T of grouped functions, the method comprises a first phase PH1 comprising a step E1 of executing the producing functions A and C sequentially. In other words, the producing functions A and C are executed one after another. Producing function A is executed and makes it possible to determine a produced datum ViA. Likewise, producing function C is executed and makes it possible to determine a produced datum V.sub.2C.

    [0095] Lastly, the first phase PH1 comprises a step E2 of storing the produced data V.sub.1A and V.sub.1C, or, in other words, a step in which the produced datum VIA (the produced datum V.sub.1Crespectively) is written by the transition module RT. The transition module RT allows, via its function for storing the produced data V.sub.1A, V.sub.1C, a copy V.sub.1A_int of the produced datum V.sub.1A and a copy V.sub.1C_int of the produced datum V.sub.1C to be determined, and said copies V.sub.1A_int, V.sub.1C_int to be stored in the memory MEM.

    [0096] The method also comprises a second phase PH2, carried out following the first phase PH1, comprising a step E3 of restoring the data V.sub.2B, V.sub.2D to be consumed by the consuming functions B and D. In other words, the restoring function of the transition module RT makes it possible to assign the value of the copy V.sub.1A_int (of the copy V.sub.1C_int, respectively) stored in the memory MEM, to the value of the datum V.sub.2B to be consumed (of the datum V.sub.2D to be consumed, respectively).

    [0097] Such a restoration, through storage mirroring, which might also be referred to as reading from write memory, therefore makes it possible to copy the value of a datum stored in the memory MEM, here the value of the copy V.sub.1A_int. (of the copy V.sub.1C_int, respectively), to the datum V.sub.2B to be consumed (to the datum V.sub.2D to be consumed, respectively) by the consuming function B (the consuming function D, respectively) during its execution.

    [0098] The second phase PH2 then comprises a step E4 of executing the consuming functions B and D of the set ET sequentially, on the basis of the restored data V.sub.2B, V.sub.2D to be consumed. In other words, consuming function B is executed on the basis of the datum V.sub.2B to be consumed, and then consuming function D is executed on the basis of the datum V.sub.2D to be consumed.

    [0099] Thus, the protection mechanism prevents simultaneous execution of the storing step E2 and restoring step E3, thus making it possible to freeze the value of the copies V.sub.1A_int, V1.sub.c_int. Thus, the stability of the value of copies V.sub.1A_int, V.sub.2C_int, which will then become the data V.sub.1B, V.sub.2D to be consumed, is ensured.

    [0100] However, the producing functions A, C and the consuming functions B, D can be executed simultaneously.

    [0101] In the method presented above, the second phase PH2 is carried out after the first phase PH1. However, as a variant, it is possible for the second phase PH2 to be carried out before the first phase PH1, the consuming tasks being executed on the basis of data already stored or previously stored in the memory MEM, in an iteration carried out beforehand.

    [0102] Stability and consistency of the data are ensured at the same time. Stability is ensured because each copy V.sub.1A_int, V.sub.1C_int of the produced data ViA and Vic is stored only at the end of the execution of the producing functions A, C, and because restoration is carried out before the start of the execution of the consuming functions B, D.

    [0103] Data consistency is ensured since the data are processed in an aggregated manner and sorted by set E.sub.T of producing functions A, C and of consuming functions B, D. Moreover, the method is automatable and realizable.