## 3 Simple Resource Algorithm
### Advertising Cloud Formulation  
The variables indicate the number of CPUs, Memory, Storage, and Network resources respectively. These values help in determining the resource availability and allocation for secure service migration. At each round, each provider will use the mathematical formulation below: Step 1 of the RASP protocol and general notations is as follows:  
* **Stage 1**. CB \(\rightarrow\) SA: Advc (CB, ResCB) [CB \(\rightarrow\) SA: Advertising Cloud (CB) sends an advertisement (Advc) to the Receiving Server (SA), detailing its free resources (ResCB)]. * Maximum Resource of Cloud (\(MAX\_Cm\)) = [CPU (Cmc), Memory (Cmm), Storage (Cms), Network (Cmn)],
* Allocated Resource of Cloud (\(ALLOC\_Cn\)) = [CPU (Cac), Memory (Cam), Storage (Cas), Network (Can)],
* Free Resource of Cloud (\(FREE\_Cf\)) = [CPU (Cfc), Memory (Cfm), Storage (Cfs), Network (Cfm)] Cloud CB Formulation Algorithm 1 in detail,  
```
1:Resources(\(r\)) \(\in\) {Cpu(\(c\)), Network(\(n\)), Memory(\(m\)), and Storage(\(s\))}
2:\(MAX\_Cm\) (\(Cmr\)) = {\(Cmc,Cmm,Cms,Cmm\) }
3:\(ALLOC\_Ca\) (\(Car\)) = {\(Cac,Cam,Cas,Can\) } &
4:\(FREE\_Cf\) (\(Cfr\)) = {\(Cfc,Cfm,Cfs,Cfn\)}
5:\(Cfr\longleftarrow Cfr\) \(\cup\) Resources(\(r\))
6:If \(Cfr\leftarrow(Cmr-Car)>0\) then
7: Send Advc of \(Cfr\) and wait for response;
8:else \(Cfr\leq\phi\) then
9: wait for \(Cfr>0\) ;
10: End if \begin{table}
\begin{tabular}{c c c c} \hline
**Resource Allocation** & **Adverting Cloud** & **Adverting Cloud** & **Adverting Cloud \\
\begin{tabular}{c} CPU, Memory, \\ Network, and Storage \\ \end{tabular} \\ \hline \end{tabular}
\end{table} 
Table 1: RAS Table. Figure 3: Simple resource allocation design. * **Step 1**: The resources in consideration are categorized as CPU (c), Network (n), Memory (m), and Storage (s). * **Step 2-4**: These steps define the maximum capacity for each type of resource (\(Cmr\)), current allocation of resources (\(Car\)), and the available (free) resources (\(Cfr\)) in the AC. * **Step 5-10**: Condition Check and Advertisement: The condition checks if there are any free resources (\(Cfr\)). If there are free resources, the AC sends an advertisement of these resources and waits for a response. If there are no free resources, the system waits until resources become available, i.e., when (\(Cfr\)) is greater than 0. ### Receiving Servers Formulation

Receiving Servers (RS) receive an advertisement from the Advertising Cloud (AC) and its free resources. A server that needs to use a cloud has variables that detail its requirements. If the free resources of AC, Cfc, Cfm, Cfs, Cfn are larger than Receiving Server requirements, it can forward the request to the Resource Allocation Server (RAS) also known as the Registry (R). The required resources of the server are given by (Req_Res of SA (SAreqr)). If we assume the requested resources a less than the free resources of the AC and all requested resources are valid, then and only then, it sends the request to RAS. Step 2 of the RASP protocol is as follows:

* **Stage 2**. SA \(\rightarrow\) R : (SA, CB, ResCB)pkR [SA \(\rightarrow\) R: Receiving or Requested Servers (SA) send a message to the Registry to verify the identity and free resources (Res freeCB) of the Advertising Cloud, CB]. * Requested Resource of Server (Req_Res of SA (\(SAreqr\))) = \(\{Src,Srm,Sms,Srn\}\) CPU (Src), Memory (Srm), Storage (Sms), Network (Srn)] Server SA Formulation Algorithm 2 in detail,
```
1:Resources(\(r\)) \(\in\)\(\{\)Cpu(\(c\)), Network(\(n\)), Memory(\(m\)), and Storage(\(s\))\(\}\)
2:Req_Res (\(SAreqr\)) = \(\{Src,Srm,Sms,Srn\}\)
3:\(SAreqr\) \(\longleftarrow\)\(SAreqr\)\(\cup\)Req_Resources
4:If \(SAreqr\)\(>\) 0 then
5:Search for Resource Migration;
6:If \(SAreqr\)\(\leftarrow\) (\(Cfr-SAreqr\)) \(>\) 0 then
7: Accept Cf and send a message to RAS;
8: Else ignore the request;
9: End if
```

**Algorithm 2** Server SA Formulation

### Resource Allocation Server

The Resource Allocation Server (RAS) plays a crucial role in the resource allocation process.