# A Parallelized Database Damage Assessment Approach after Cyberattack for Healthcare Systems
## 5 Experimental Results  
The algorithm was implemented to exploit the multi-threading feature in the Java programming language. A thread is a lightweight subprocess which is the smallest unit of processing. This feature permits the execution of two or more threads simultaneously that execute parts of the program for the highest utilization of CPU.  
To verify the efficiency of the algorithm, experiments were conducted to compare it with similar algorithms presented in [10; 11]. These two algorithms were specifically chosen since they were very efficient and perhaps had the best time and memory performance among many algorithms. Note that the two algorithms being compared to the new algorithm needed a data structure that was built along with the database transactions and log file. This added an implicit time to the algorithms, which in our case was considered in the algorithms' running times. The transactions, tables, data, and other factors used in the below tests were the ones used in the papers, specifically the Northwind database [31].  
The Northwind database is a sample database used for demonstration purposes of some of Microsoft's products, especially when it comes to SQL Server. It has been used for experiments in the field of damage assessment and database recovery. The data in the database belongs to a made-up company named Northwind Traders and includes information about sales.  
A particular version of the Northwind database, written for the MySQL syntax, was used. The SQL file was loaded before every test. From the database, only transactions on the below tables were studied in the experiments:  
* Employees: the employees of the company;
* Suppliers: the suppliers of products;
* Customers: the customers of the company;
* Categories: the categories of the products;  
\begin{table}
\begin{tabular}{c c c c} \hline  & **Time Complexity** & **Memory Complexity** & **Needs Existing Data Structure** \\ \hline Our Algorithm & O((M+NQ+N3)/L) & O(N+KL) & No \\ \hline [PERSON]’s (2020) & O(M) & O(RM) & Yes \\ \hline [PERSON] and Sai’s (2017) & O(MR) & O(RM) & Yes \\ \hline \end{tabular}
\end{table}
Table 1: Comparison of the three algorithms considered in the experiments. The time complexity does not account for the time to build the needed data structures. M = total number of transactions; N = number of malicious and affected transactions; R = number of transactions that the transactions depend on; L = number of threads or areas; K = number of transactions handled by one thread or in one area; and Q = time to check dependency between transactions.  
* Products: available products;
* Orders: orders placed;
* OrderDetails: details about the order.  
The studied relationships between these tables constituting the different areas were as follows:  
* Categories and Products;
* Suppliers and Products;
* Customers and Orders;
* Products and OrderDetails;
* Orders and OrderDetails.  
The transactions considered were INSERT transactions, where each transaction inserted a row into a table. In other words, the above seven tables were empty at the beginning, and they were filled completely, one row at a time, with such transactions. Thus, the dependency between transaction arose from the primary key (PK) and foreign key (FK) relationships between the different tables. The threads were assigned to areas by the proposed multi-threading algorithm. These areas were the relationships between the tables. In this case, there were five relationships and thus five threads. Each thread was responsible for checking whether a given transaction belonged to its area or not. If it belonged, then the thread queried the affected transactions that referenced it and added them to the list of affected transactions.  
In every run of the algorithm, the SQL file defining the database was loaded, and the log file was generated. The log file contained the transactions listed in the chronological order in which they were performed.