AutoSAR Series Explanation (Introduction) 3.5-RTE's Management of Data Consistency

1. What is data consistency

To quote Baidu Encyclopedia:

Data consistency means that when multiple users try to access a database at the same time, and their transactions use the same data at the same time, the following four situations may occur: lost updates, undetermined dependencies, inconsistent analysis, and phantom reads.

To put it more simply: when multiple operations read and write the same data at the same time, bugs are likely to occur (actually due to priority issues, our data may be tampered with, resulting in data that the author does not want to see result)

Second, the realization mechanism of data consistency

1. Use RTE management

As mentioned before, this category is to use RTE to manage the data here to prevent bugs from appearing. For example, IRead, everyone operates the backup of data, and does not directly operate the original data

2. SWC internal variables

This internal variable is amazing, because it can be directly configured in DaVinci, and the runnable can be called directly, just like a global variable defined in a c file without being externed. The functions defined in the c file can be used directly. Then there will be a problem at this time. The functions in the same c file may be run on different Tasks, and these functions may run at the same time. Then when calling this global variable, it may be There is a bug. So how to solve it? AutoSAR does the following two ways:

  • EAs (Exclusive Areas, dedicated area) : It is the following two sentences of code, which is equivalent to a closed interrupt , and the statement calling the variable is placed inside, and no more advanced Task can interrupt the protected statement during operation
Rte_Enter_name>();

//这里放置被保护的语句

Rte_Exit_name>();
  • IRVs (Inter-runnable variables, inter-function variables) : There are still two sentences of code. The above EAs is that the entire code segment is protected, and the two sentences here are equivalent to being protected when changing variables, that is, these two protected when the sentence is executed
Rte_IrvWrite_re>_name>()

Rte_IrvRead_re>_name>()

Guess you like

Origin blog.csdn.net/qq_42700289/article/details/131404802