# S.O.V.O.R.A.: A Distributed Wireless Operating System
## 3 S.O.V.O.R.A. Wireless Distributed Systems
### The Local Agent  
Similarly to the OR, the LA is a process that runs periodically in the user space at the top of the OS as one or multiple instances on the node to manage different resources or applications. The LA interacts with the OS to collect information related to the status of hardware resources, running applications, and MANET. Perform resources and workload control are based on that information. As shown in Figure 3, the LA has a set of microservices to allow for interaction with the running applications and to carry out monitoring and control at the application-level, estimating the computing resources consumption of the node, communicating periodically with the OR, sharing the status of the node and receiving execution requests. The modules are as follows:  
* Ad hoc Mode: This module enables the communication between the LA and the OR to send and receive the commands or the log information with the Alfred service.
* Monitor App: A microservice that monitors the application performance. A controller links the LA to applications designed for use in the system.
* Information: A microservice that collects the local information such as computing resources (CPU, Memory, Storage, I/O) and applications state, and the LA sends it to the OR.
* Monitor Device: A microservice that shows the information in real-time executed as a thread.
* Log: A microservice that stores all logging information about resources, messages, network interface state, and local and global interactions in each node or instance.
* Command Exec: A microservice that receives the messages from the users or the OR to execute, stop, or exit some distributed application.  
Algorithm 1 shows the LA routine and the tasks carried out to keep the system in operation and communication between member nodes of the system and the OR. The input for the algorithm are the main services for the framework as the communication in the Ad hoc mode, as well as the OR discovery service and the communication servers with the different entities signalized in the system. Subsequently, the applications are deployed in docker containers, where the application controller is located and deployed, considering the number of cores available for execution.  
Figure 3: S.O.V.O.R.A. proposed Model.  
```
Data:Communication node Status Input:Communication Node Status Input:Ad hoc Mode(B.A.T.M.A.N.) enable Input:RUN ADHOC MODep Input:RUN DISCOVERY SERVICE Input:Run DAG file Input:Run ThreadServer(STATES) Input:Run ThreadServer(EXEC) Input:Run ThreadServer(REGISTRY) Input:RUN ThreadDocker APPS ifserverExecThread------then
2 params:Orch(Poldana);
3 ExecPol (params);
4 end
5 ifServerNodeInfo ServerExec4 pps ---- truethen
6 fork in coresdo
7 | create_container;
8
9 end
10 exit
11 while\(N=0\)do
12 inti=0;
13 write node_info;
14 if\(i==0\)then
15 form in coresdo
16 cpu_acum[m];
17 container_acum[m];
18
19
20 else
21 fork in containersdo
22 cpu_acum -- cpu_acum_current;
23 cont_acum -- cont_acum_current;
24 Get Status(%CPU,Thr_App,Thr_Cont, Energy, Mem, Disk);
25 info_node -- (Get Status,cpu_acum,cont_acum);
26 end
27
28 end
29 save Locall.og;
30 if(Orchestrator enable -- truethen
31 send orchestrator (node_info);
32
33 end
```  
**Algorithm 1** Local Agent Algorithm.  
The main process occurs on lines 5 to 28, where arrangements to save the history of resources are consumed in the node. For example, the %CPU is the resource to be saved as a value. This task is done globally at the node level and locally at the container level. In the same way, the performance of the running applications is monitored. These values are stored and sent to the OR (lines 29 to 31). In this process, it is important to highlight the execution of policies (lines 1-4) where there is a server thread that waits for the instructions to execute the application policies contained in the LA.