## 4 An Architecture for Edge-Fog-Cloud Offloading
Despite C1 having significant computational power, due to latency issues that are well known with cloud computing, jobs offloaded to C1 take more time to return results. Finally, the P2P edge node (D1) is the slowest, with S = 0.17. This is due to D1 being significantly less powerful than D2 (see Table 1). ### Experiment 2: Delegator and P2P (Edge)

In this experiment, the delegator D1 collaborates with a peer-to-peer edge device D2. Comparative analysis indicates that D2 operates at a rate 2.57 times faster than D1, as detailed in Section 5.1. D2's superior computational capacity compared to D1 is further demonstrated by D2 executing approximately 2.6 times as many jobs as D1. This performance discrepancy is clearly depicted in Figure 3(a). Hence, this configuration achieves a speedup of 3.59, as documented in Figure 3(b). The average task completion time for this experiment was 1,084,998 ms.

### Experiment 3: Delegator and Fog

In this experiment, [PERSON] cooperates with [PERSON] to complete the jobs together. This results in a speedup of 3.76, as seen in the Figure 3(b). This is also due to the fact that F1 is more powerful than D1, as evidenced by the number of jobs completed by each node, as seen in Figure 3(a). The average task completion time for this experiment was 1,038,146 ms. \begin{table}
\begin{tabular}{l c c c c c c c c} \hline \hline \multirow{2}{*}{**Node**} & \multicolumn{4}{c}{**D1 as Delegator**} & \multicolumn{4}{c}{**D2 as Delegator**} \\ \cline{2-9}  & **S** & **Battery (\%)** & **Avg Tr.** & **Avg Total** & **S** & **Battery (\%)** & **Avg Tr.** & **Avg Total** \\  & & & **Time (ms)** & **Time (ms)** & & & **Time (ms)** & **Time (ms)** \\ \hline Delegator & N/A & 17.60 & N/A & 3,900,012 & N/A & 8.99 & N/A & 1,042,548 \\ Fog & 2.70 & 4.00 & 797 & 1,446,771 & 0.85 & 5.60 & 627 & 1,043,236 \\ Cloud & 1.43 & 8.39 & 1948 & 2,725,512 & 0.56 & 7.39 & 1286 & 1,674,836 \\ Edge & 2.57 & 5.20 & 184 & 1,515,956 & 0.17 & 23.60 & 2002 & 6,089,051 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Experiment 1: Baseline experimental results for each worker with D1 and D2 as delegator. ### Experiment 4: Delegator and Cloud

Here, D1 shares the workload with C1, resulting in a speedup of 2.48, as seen in Figure 4b. Node C1 is more powerful than the delegator D1, as evidenced by the number of jobs completed by each node in Figure 4a. The average task completion time for this experiment was 1,571,844 ms.

### Experiment 5: Delegator, Fog, and Cloud

In this experiment, the delegator (D1) is collaborating with both F1 and C1. As can be seen from from Figure 4b, this results in a speedup of 4.85. The average task completion time for this experiment was 803,566 ms.

### Experiment 6: Delegator, P2P, Fog, and Cloud

In this experiment, a comprehensive 3-tier configuration, comprising a P2P edge device (D2), a fog server (F1), a cloud server (C1), and the delegator (D1), collaboratively processes the tasks. This integrated architecture achieves a significant speedup of approximately 7.5, as documented in Figure 4b. The average task completion time for this experiment was 514,485 ms. D2 and F1, being the fastest workers, are able to complete almost two-thirds of the total jobs (Figure 4a). Figure 5 illustrates the cumulative number of jobs completed (y-axis) over time in milliseconds (x-axis) for each node (D1, D2, F1, C1). The lines represent the total number of jobs completed by each node at any given point in time. The gap between the lines provides an indication of how many jobs each device has completed relative to the others, with a larger gap signifying a higher contribution. Figure 4: Results for Experiments 2-6 and 9. (**a**) Jobs completed by each node for Experiments 2-6,9. (**b**) Speedup gains and battery usage for varying node configurations. Figure 5: Time series of number of jobs completed by each node. Experiment 6: Results for D1 working with D2, F1, and C1: Time series of number of jobs completed by each node.