## 4 Task Execution Cost Analysis  
### Task Execution Latency  
In this subsection, the task execution time, which is a part of task execution cost, is analyzed. For UAV \(u\), when there are sufficient parking resources in its coverage area, the tasks from UAV \(u\) will be directly delivered to the parked vehicles in its coverage range. The time cost for finishing task \(t\) from UAV \(u\) is calculated as follows:  
\[Tt=T_{u,t}^{up}+T_{u,t}^{com}+T_{u,t}^{down} \tag{5}\]  
where \(T_{u,t}^{up}\) denotes the time to upload the whole task; \(T_{u,t}^{com}\) indicates the task calculation time; and \(T_{u,t}^{down}\) indicates the result return time. For \(T_{u,t}^{up}\), we have the following:  
\[T_{u,t}^{up}=\frac{s_{u,t}}{mr_{u,ave}} \tag{6}\]  
where \(s_{u,t}\) is the total amount of data size; \(r_{u,ave}\) is the average throughput between UAV \(u\) and the parked vehicles which will carry out the task; and \(m\) denotes the number of task performers. Here, we consider a parallel task execution mode [32; 33]. In other words, the whole task can be divided up and then carried out by multiple task performers collaboratively. The throughput between UAV \(u\) and parked car \(n\) is modeled as follows:  
\[r_{u,n}=B_{u,n}\log_{2}(1+\frac{P_{u}|h_{u,n}|^{2}d_{u,n}^{-\beta}}{\sigma^{2 }}) \tag{7}\]  
where \(B_{u,n}\) is the channel bandwidth; \(P_{u}\) denotes the fix transmit power of UAV \(u\); \(\sigma^{2}\) is the power spectral density of Gaussian Noise; \(h_{u,n}\) indicates the channel fading from UAV \(n\) to parked vehicle \(n\); \(d_{u,n}\) represents the distance between the two when a downlink delivery occurs; and \(\beta\) indicates the path loss exponent. Assuming that the CPU frequency of the automobile is \(f_{v}\), then \(T_{u,t}^{com}\) is denoted as follows:  
\[T_{u,t}^{com}=\frac{s_{u,t}c_{u,t}}{mf_{v}} \tag{8}\]  
where \(c_{u,t}\) indicates the computational complexity of task \(t\). The task result return duration is calculated as follows:  
\[T_{u,t}^{down}=\frac{y_{u,t}}{r_{ave,u}} \tag{9}\]  
where \(y_{u,t}\) is the size of the final result, and \(r_{u,ave}\) which denotes the average transmission rate from task performers to UAV \(n\) has a similar calculation method as \(r_{u,n}\). Figure 3: The formation of the clusters. If the parking resources within the coverage range of UAV \(u\) are insufficient (computing resources are occupied) or there is no available resource in the coverage range of UAV \(u\), UAV \(u\) needs to forward the generated application to its neighboring UAV with more accessible resources. In this case, the required duration for task calculation is as follows:  
\[T_{t}=T_{u,u^{\prime}}+T_{u^{\prime},t}^{up}+T_{u^{\prime},t}^{com}+T_{u^{ \prime},t}^{down}+T_{u^{\prime},u} \tag{10}\]  
where \(T_{u,u^{\prime}}\) is the duration for UAV \(u\) to forward the data to its neighbor UAV \(u^{\prime}\) through the wireless mode, and \(T_{u^{\prime},u}\) denotes the wireless delivery delay for UAV \(u^{\prime}\) to upload the calculation result to UAV \(u\). Since two neighboring UAVs communicate through an air-to-air (A2A) link which mainly uses line-of-sight transmission [26], \(T_{u,u^{\prime}}\) is described by the following equation:  
\[T_{u,u^{\prime}}=\frac{s_{u,t}}{r_{u,u^{\prime}}}=\frac{s_{u,t}}{B_{u,u^{\prime }}\log_{2}(1+\frac{P_{u}10^{-\frac{Loss(u,u^{\prime})}{10}}}{e^{2}})} \tag{11}\]  
where \(Loss(u,u^{\prime})\) is the path loss between the two UAVs in free space. According to study [34], we have the following:  
\[Loss(u,u^{\prime})=32.45+20\log f_{f}+20\log d_{(u,u^{\prime})} \tag{12}\]  
where \(f_{f}\) represents the carrier frequency, and \(d(u,u^{\prime})\) is the distance between the two neighboring UAVs. Moreover, \(T_{u^{\prime},u}\) is obtained in a similar way as \(T_{u,u^{\prime}}\).