## 4 The PI-Based Task Offloading Algorithm
### Re-Offloading Mechanism  
Using PITO, delay-sensitive tasks can be offloaded on board by satellites. However, due to the dynamics in SEC, the dynamic arrival of delay-sensitive tasks disrupts the original offloading assignment, even making it infeasible. Thus, we propose a re-offloading mechanism based on match-up strategy [38; 39; 40] in this subsection. At time \(\tau\), \(q\) delay-sensitive tasks \(T_{x}=\{t_{n+1}\), \(t_{n+2}\),..., \(t_{n+q}\}\) are newly generated by observation satellites \(D_{x}=\{n+1\), \(n+2\),..., \(n+q\}\), which need to be processed by SEC satellites in \(S\). Each task \(t_{i}\in T_{x}\) is also characterized by tuple \(<\)\(\lambda_{i}\), \(\mu_{i}\), \(\sigma_{i}\)\(>\) in Section 3.1. Given the original assignment \(\theta\), the procedure of the proposed re-offloading mechanism is described as follows:  
_Step 1:_ Obtain the influence horizon. Let \(\varepsilon\) be the expected re-offloading time, then the re-offloading assignment \(\theta^{*}=\{\theta_{s}\ast\mid s\in S\}\) will be executed at time \(\tau+\varepsilon\). Additionally, new tasks in \(T_{x}\) are expected to be completed before \(\max_{t_{i}\in T\tau}\sigma_{i}\). Thus, the _influence horizon_ is defined as \([\mu_{a},\,\mu_{b}]=[\tau+\varepsilon,\,\max_{t_{i}\in T\tau}\sigma_{i}]\). _Step 2:_ Determine the re-offloading tasks. With horizon \([\mu_{a},\,\mu_{b}]\), when new delay-sensitive tasks in \(T_{x}\) are offloaded, the original tasks in the same horizon of \(\theta\) are disrupted, represented as \(T_{o}=\{t_{i}\in T\,\mid\,\tau_{i}^{S}\in(\mu_{a},\,\mu_{b})\}\). Next, by the time \(\mu_{a}\), several tasks in \(\theta\) may have been completed or are currently in processing. Since re-offloading assignment \(\theta^{*}\) must not conflict with implemented tasks, tasks \(T_{a}=\{t_{i}\in T\,\mid\,\tau_{i}^{S}\leq\mu_{a}\}\) cannot be re-offloaded. Additionally, tasks in \(\theta\) executing after \(\mu_{b}\) are slightly impacted, and then these tasks, denoted as \(T_{b}=\{t_{i}\in T\,\mid\,\tau_{i}^{S}\geq\mu_{b}\}\), are reserved to reduce the re-offloading time. Thus, \(T=T_{a}\cup T_{o}\cup T_{b}\) exists, and the re-offloading tasks are \(T_{r}=T_{x}\cup T_{o}\). Figure 5 illustrates an example of the proposed task sets in \(\theta\), where tasks in \(T_{a}\), \(T_{o}\) and \(T_{b}\) are marked in orange, cyan, and red, respectively. The above task sets (\(T_{a}\), \(T_{o}\) and \(T_{b}\)) are obtained in a distributed way in Algorithm 4. First, each satellite \(s\in S\) calculates time parameters for tasks in \(\theta_{s}\), as described in Section 3.3. Then, vector \(\mathbf{U}_{s}=[U_{s1},\,U_{s2},\,\ldots,\,U_{s(t+q)}]^{T}\) is generated, where entry \(U_{st}=1\) for \(t\in\{\theta_{s}\mid\,\tau_{i}^{S}\,\,\leq\,\mu_{a}\}\), \(U_{st}=2\) for \(t\in\{\theta_{s}\mid\,\tau_{i}^{S}\geq\mu_{b}\}\), and otherwise, \(U_{st}=0\). Since \(U_{st}\) is only determinated by satellite \(s\) with \(t\in\theta_{s}\), a common \(\mathbf{U}_{s}\) can be easily obtained, where \(U_{st}=0\), \(1\), and \(2\) for \(t\) belonging to \(T_{r}\), \(T_{a}\), and \(T_{b}\), respectively. Figure 5: Gantt chart of offloading assignment \(\theta\). _Step 3_: Obtain re-offloading assignment. First, we obtain the available buffer size \(MA_{s}\) for each \(s\in S\). By original assignment \(\Theta\), several tasks \(T_{c}=\{t_{i}\in T\ \mid\ \tau_{i}^{F}\leq\mu_{a}\}\) have been accomplished at time \(\mu_{a}\), and buffer resources occupied by them are released; then, we have  
\[MA_{s}=M_{s}-\sum_{t_{i}\in\Theta_{s}}\lambda_{i}+\sum_{t_{i}\in\Theta_{s}\cap T _{c}}\lambda_{i} \tag{25}\]  
Subsequently, two modifications are involved in \(F(\Theta^{\bullet})\). For task \(t_{i}\in T_{x}\), data uploading begins at time \(\mu_{a}\). Then, the data readiness time \(\tau_{i}^{D}\), as defined in (6), is revised as  
\[\tau_{i}^{D}=\mu_{a}+\tau_{i,s}^{comm} \tag{26}\]  
Moreover, some tasks in \(\theta_{k}\) may also be re-offloaded to \(\theta_{s}\)*.