# Joint Optimization of Service Migration and Resource Allocation in Mobile Edge-Cloud Computing
## 3 System Model and Problem Definition
### Migration Model  
For each task \(\textit{task}^{k}_{t}\), we use \(X^{k}_{t}=[x^{1}_{k,t},\ldots,x^{m}_{k,t}]\) to denote the allocation of \(\textit{task}^{k}_{t}\) on ESs in time slot \(t\), where \(x^{m}_{k,t}=1\) indicates that \(\textit{task}^{k}_{t}\) is allocated to server \(n\); otherwise, it signifies that \(\textit{task}^{k}_{t}\) is not on server \(n\). In time slot t, \(\textit{task}^{k}_{t}\) needs to satisfy  
\[\textbf{C1}:\sum_{i=1}^{n}x^{i}_{k,t}=1,\forall k\leq K_{t},\quad\forall t\in T. \tag{1}\]  
This stipulates that each task is allocated to exactly one ES. The ES hosting \(\textit{task}^{k}_{t}\) is denoted as follows:  
\[\Psi^{k}_{t}=arg\max_{l}X^{k}_{t},\quad l\in\{1,\ldots,n\}. \tag{2}\]  
Migration occurs if \(|\Psi^{k}_{t+1}-\Psi^{k}_{t}|>0\), and we use \(\Psi^{k}_{t+1}\) to denote the location of the server where the task is located in the next time slot. Whenever a migration occurs, the SI of \(\textit{task}^{k}_{t}\) must be migrated via the communication link of the RANs from the current ES to a new ES for continued processing. It is crucial to transfer the SI's state context during migration, which includes user-specific information, intermediate processing results, and more. Before resuming the task, the new ES must synchronize the SI's state context and restore the task's progress. As depicted in Figure 2, the migration process from suspension to restoration involves various time delays, including service suspension delay, synchronization delay, and service restoration delay. Thus, the total migration delay of SI can be expressed as follows:  
\[D^{k}_{t}=h^{k}_{t}+w^{k}_{t}+r^{k}_{t+1}, \tag{3}\]  
where \(h^{k}_{t}\) represents the service suspension delay associated with the SI context of \(\textit{task}^{k}_{t}\), \(w^{k}_{t}\) denotes the synchronization delay as the SI migrates from the source ES to the target ES, and \(r^{k}_{t+1}\) is the service restoration delay for restoring the task to its state before suspension. During the service suspension and restoration processes, both the suspension and restoration delays are contingent upon the remaining size of the task, the processing inten  
Figure 2: An example of the migration process. sity required for either suspension or restoration, and the computing resources allocated to the task's SI. The service suspension delay can be articulated as  
\[h_{t}^{k}=\frac{\rho_{W}^{sp}(V_{t+1}^{k}+V_{W}^{m})}{p_{\Psi_{t}^{k}}}, \tag{4}\]  
where \(\rho_{W}^{sp}\) represents the suspension processing intensity requirements of the application type \(W\) to which the \(task_{t}^{k}\) belongs when the SI is paused (measured in CPU cycles required by processing per bit state context), \(V_{W}^{m}\) is the context size of the application type \(W\) (measured in MB), and \(p_{\Psi_{t}^{k}}\) denotes the computational resources allocated to the SI on \(s_{\Psi_{t}^{k}}\) (measured in cycles per second). And, the service restoration delay can be written as  
\[r_{t+1}^{k}=\frac{\sigma_{W}^{sp}(V_{t+1}^{k}+V_{W}^{m})}{p_{\Psi_{t+1}^{k}}}, \tag{5}\]  
where \(\sigma_{W}^{sp}\) denotes the restoration processing intensity requirements of the application type to which \(task_{t}^{k}\) belongs when the SI is restored, and \(p_{\Psi_{t+1}^{k}}\) denotes the computational resources allocated to the SI on \(s_{\Psi_{t+1}^{k}}\) in the next time slot. The term \(V_{t+1}^{k}\) is further discussed in Equation (14). The synchronization delay is the transmission delay determined by the remaining data size of the task and the bandwidth between the original server and the target server, which can be expressed as  
\[w_{t}^{k}=\frac{V_{t+1}^{k}+V_{W}^{m}}{B_{\Psi_{t}^{k},\Psi_{t+1}^{k}}}, \tag{6}\]  
where \(B_{\Psi_{t}^{k},\Psi_{t+1}^{k}}\) is the link bandwidth between the source server \(s_{\Psi_{t}^{k}}\) and the target server \(s_{\Psi_{t+1}^{k}}\). Specifically, we have \(D_{t}^{k}=0\) if \(|\Psi_{t+1}^{k}-\Psi_{t}^{k}|=0\).