## 4 An Architecture for Edge-Fog-Cloud Offloading
The aims of each experiment and related RQs are given in Table 2. Each experiment was conducted five times, and the results were averaged to ensure statistical reliability. The network capacity and latency details for the three different edge-fog-cloud tier networks in the experiments are given in \[\frac{t_{e_{i}}}{t_{e_{1}}}=k_{e_{i}} \tag{1}\]0

### Experiment 1: Baselines

This experiment examines the computational capacities of each worker node in comparison to the delegator. This sets the baseline values to understand the performance gains and battery usage for the later experiments. The delegator first executes the entire task monolithically (the'monolithic version' refers to the task without any of the parallelising components). Next, the delegator offloads the entire task to each worker, and each node processes the entire task sequentially. Two sets of baseline experiments are carried out: \begin{table}
\begin{tabular}{l l l l} \hline \hline
**Node** & **CPU** & **RAM** & **OS** \\ \hline Moto G5S Plus (D1) & Qualcomm MSM 8953 Snapdragon 625 & 4 GB & Android 8.1 \\ Oneplus6 (D2) & Qualcomm SDM845 Snapdragon 845 & 8 GB & Android 11 \\ Dell Inspiron 5502 (F1) & 11 th Gen Intel(R) Core(TM) i7-1165G7 @2.80 GHz 1.69 GHz & 16 GB & Microsoft Windows 10 \\ AWS EC2 instance t3.xlarge (Cx where \(x\in[1..12]\)) & 4 vCPU upto 3.1 GHz Intel Xeon Platinum Processor & 16 GB & Ubuntu Server 20.04 LTS \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Specifications of the delegator and worker nodes. \begin{table}
\begin{tabular}{l l l} \hline \hline
**Experiment** & **Aim** & **RQ** \\ \hline
1,2,3,4,5,6,9 & Compare the performance of the system when there are multiple configurations of edge, fog, cloud nodes, with heterogeneous platforms, capacities, connection protocols, working together & RQ1 \\ \hline
7 & Investigate the impact of task sharing configuration parameters in an edge, fog, cloud collaboration setup & RQ2 \\ \hline
8, 10 & Investigate the impact of dynamically adding/removing or slowing down worker nodes & RQ3 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Experiment overview. \begin{table}
\begin{tabular}{l l l} \hline \hline
**Network Type** & **Latency Range (ms)** & **Bandwidth (Mbps)** \\ \hline P2P Edge (Wi-Fi Direct-based) & 5–10 & 50–100 \\ Fog Server (LAN-based) & 5–30 & 100–150 \\ Cloud Server (Internet-based) & 200–400 & 30–50 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Network capacity and latency details for different network types. (1) D1 as delegator, with D2, F1, and C1 as workers, and (2) D2 as delegator, with D1, F1, and C1 as workers. The speedup metric, denoted as S, provides the relative performance gain achieved through offloading compared to monolithic execution. Table 4 shows the results of this study. Note that Avg. Tr. time denotes the average transmission time per job in the table. This includes all associated communication delays, such as the propagation time, any network routing or switching delays, and job preparation and acknowledgment processing at both ends. Battery % indicates the battery usage of the delegator during the execution of the experiment. This was measured by recording the battery percentage of each device just before the experiment started and immediately after it ended. With D1 as delegator, the results indicate that D2, F1, and C1 exhibit speedup factors of approximately 2.57, 2.70, and 1.43 over D1, respectively, Note that this comparative performance takes transmission delays into account. This is why even though the fog (F1) and cloud (C1) nodes may be computationally more resource rich than the P2P edge node (D2), the overall performance in D1's perspective is less than D2. As can be seen from the battery usage on D1, offloading significantly reduces D1's battery consumption, even with the additional communication costs. With D2 as delegator, F1's speedup (0.85) is only slightly lower than D2's monolithic execution, but C1 demonstrates a marked decrease in speedup with S = 0.56.