## 3 VIDAF Architectural Framework
### System Infrastructure Architecture  
The system architecture refers to the hardware and software components, their relationships, attributes, and functions that constitute a COTS-based system application. A component-based approach is utilized in the design of a system application architecture within the VIDAF. Individual functional structures (COTS nodes) represent well-defined objects containing hardware/software components, tasks, and properties.  
A VIDAF system is built using COTS nodes, as illustrated in Figure 2.  
Each COTS node is constituted of various hardware/software components (e.g., from a standardized object's repository warehouse), within which applications could be executed. Each node may have its own hardware platform, operating system, and programming model. This ensures the diversity in COTS components and applications and different implementation and execution environments in each node. Within the system's infrastructure, a run-time middleware layer between the application and  
Figure 2: VIDAF System Architecture.  
the COTS nodes provides the support software needed for real-time application development. Such a software layer utilized in many cases is the Linux firmware, enhanced with real-time capabilities, with the real-time preemptive patch PREEMPT_RT [40]. One of the design specifications and essential requirements that should be satisfied by a COTS-based system architecture in real-time control is to ensure reliability and guarantee that worst-case behavior is kept within acceptable time limits (bounded by response time and latency). For this reason, in our implementation we configured a real-time variant of Linux with PREEMPT_RT patch, capable of minimizing both operating system overheads and latency. The resources that are crucial for the execution of real-time applications are directly assigned to the applications themselves, with no software layer in the middle.  
Applications consist of tasks (in our implementations they are actually threads, each one having its own real-time scheduling policy SCHED_FIFO/SCHED_RR and high priority) and resources (hardware/software objects) within a single or several COTS nodes. Tasks communicate (through shared distributed memory) and interact in a preemptive multitasking way to perform reliably a real-time job. In our approach, tasks are enforced to predictable memory accesses (mlockall) that are current and future task's memory allocations are locked, in order to prevent being paged out. In our implementations, this feature is invoked immediately from the main master module to prevent the page out of memory for the real-time tasks. This results in lower latencies, a higher number of execution iterations, and improves the determinism of RPi3's real-time applications' execution. This application infrastructure ensures that a real-time task during its execution reacts appropriately in time to events that take place in the real world and that the overall system response time is within the desired real-time specifications limits.  
Tasks from the same application can also be allocated to different nodes. Tasks could be related and even process the same data across the different nodes (application layer). However, in our implementation, this is not the preferred mode of operation to avoid bus interference (for memory data) or other potential conflicts between tasks running on different nodes. Additionally, in the real world, there may exist several software/hardware layers between the actual device under control and the real-time tasks, running other tasks or processes too, altogether competing for hardware/software resources that may lead to a non-deterministic execution. The functionality and operation of each node could also be changed or reconfigured at run-time, according to the application mode. Therefore, this component-based design approach does not impose restrictions on how applications are structured.  
The implementation mechanism of each system node lies within the structure of each system hardware/software component.