# On-the-Fly Repairing of Atomicity Violations in ARINC 653 Software
## 2 Background
### On-the-Fly Repairing of Atomicity Violations  
Researchers have proposed on-the-fly repairing of atomicity violation techniques for real-world software to prevent system failure [36; 37]. In general, these techniques can be classified in diagnosis phase and treatment phase. In the diagnosis phase, the faults or anomalies of the system are detected with error diagnosis approaches, such as detection protocols or correct interleaving information [36; 37; 38]. The detection protocol monitors the information of shared variables executed in each thread during execution and analyzes correlations to diagnose the occurrence of atomicity violations. The algorithm for diagnosing atomicity violations checks the locking discipline or compares the order relationships among shared variables. The detection protocol uses access history to store the information required by the detection algorithm. The access history is a data structure to store a set of threads, synchronizations and shared variables. Some detection algorithms include time information in this set. However, the access history causes high time and space overheads to maintain information during executions. The diagnosis phase compares the correct interleaving information acquired during correct interleaving provided at the development stage with data obtained in actual interleaving during the execution to diagnose the occurrence of atomicity violations. This technique is suitable for application in modern systems, since it has lower time and space overheads than detection-protocol-based techniques and provides higher accuracy in diagnosing atomicity violations. The correct interleaving information can be provided by developers or through testing. The developer can directly specify additional execution information as an assertion or comment near the shared variable in the source code during the development stage. To diagnose an atomicity violation, we compare the programmer-specified information in the \begin{table}
\begin{tabular}{l l l l l l} \hline \hline \multirow{2}{*}{**Years**} & \multirow{2}{*}{**Analysis**} & \multicolumn{3}{c}{**Detection**} & \multicolumn{2}{c}{**Repairing**} \\ \cline{3-6}  & & **Static** & **Dynamic** & **Mixed** & **Forward** & **Backward** \\ \hline
**2011\(\sim\)2020** & [PERSON] et al. [32], [PERSON] et al. [33] & - & [PERSON] et al. [31] & [PERSON] et al. [34] & [PERSON] et al. [17], [PERSON] et al. [16] & - \\ \hline
**2021\(\sim\)** & - & - & [PERSON] et al. [35] & - & - & - \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Research studies on atomicity violations in airborne software. source code with the actual execution information. This method has disadvantages. An inexperienced developer may omit the defects or gather incorrect execution information. Once the software development process is finished, the posthumous methods for testing collects the correct interleaving through numerous repeats of the developed software. Then, following the suit of the previous way, the atomicity violations are diagnosed by comparing the correct interleaving with the actual execution information. This method has the advantage of collecting relatively accurate correct interleaving. However, there may be cases where an incorrect interleaving is collected during testing. When an error is detected in the diagnosis phase, the treatment phase handles the error based on the type of error. There are two types of approaches for treatment, forward and backward recovery. Forward recovery avoids the faults by inserting synchronization or changing the priority of thread scheduling. Backward recovery re-executes the program by returning to the line of the code immediately before the error occurred, that is, to the line of the code where the last operating state shows no system faults. Due to its relatively low overhead, forward recovery is performed for repairing access faults. Thus, it employs various methods to implement synchronization, such as inserting condition variables, inserting time-out and inserting locks.