## 4 An Architecture for Edge-Fog-Cloud Offloading
In practice, these indicators may vary dynamically due to fluctuations in network traffic (e.g., WLAN, LAN, and internet) and the computational load on worker devices, especially edge devices with constrained resources. These variations can influence task completion times and, consequently, the speedup achieved in real-world scenarios. #### 4.1.1 Best-Case Scenario

Deriving from [6], only considering the P2P edge workers, assuming jobs of equal computational complexity and ignoring overheads, the upper bound for speedup can be given as:

\[S_{\text{upper}}=1+\sum_{i=2}^{x}\biggl{(}\frac{1}{k_{\epsilon_{i}}}\biggr{)} \tag{4}\]

This formula illustrates the ideal scenario where the combined effort of all devices maximises the task processing speed. Realistically, it should be noted that given the presence of overheads and the variability in job sizes, the realised speedups are likely to fall below this theoretical maximum. Incorporating the fog and cloud workers, the updated formula for the upper bound for speedup becomes:

\[S_{\text{upper}}=1+\sum_{i=2}^{x}\biggl{(}\frac{1}{k_{\epsilon_{i}}}\biggr{)} +\sum_{j=1}^{y}\biggl{(}\frac{1}{k_{f_{j}}}\biggr{)}+\sum_{l=1}^{z}\biggl{(} \frac{1}{k_{\epsilon_{i}}}\biggr{)} \tag{5}\]

#### 4.1.2 Worst-Case Scenario

The lower bound for speedup is formulated, extending from [6], for edge, fog, and cloud workers as follows. We consider the worst-case scenario where the collective capability of the worker devices across the edge, fog, and cloud tiers is significantly less than that of the delegator. This scenario might occur due to high network latency, worker unavailability, or extremely weak workers. In such situations, the delegator undertakes the parallelised task execution without the assistance of any worker nodes, incurring overheads, including costs related to task parallelisation and ongoing worker search efforts, as well as communication costs across the edge, fog, and cloud layers. The utmost job completion time, \(t_{\text{worst}}\), is represented as:

\[t_{\text{worst}}=t_{M}+c_{\text{edge}}+c_{\text{fog}}+c_{\text{cloud}}+e_{ \text{edge}}+e_{\text{fog}}+e_{\text{cloud}}\]

Under these assumptions, the lower bound for speedup can be given as:

\[S_{\text{lower}}>\frac{t_{M}}{t_{M}+c_{\text{edge}}+c_{\text{fog}}+c_{\text{ cloud}}+e_{\text{edge}}+e_{\text{fog}}+e_{\text{cloud}}} \tag{6}\]

This formulation reflects the minimal speedup achievable under adverse conditions. ## 5 Experimental Evaluation

An image processing task (face detection) was chosen as the computational task to be shared amongst the nodes. The job pool on the delegator consists of 1000 unique PNG images at 1024 \(\times\) 1024 resolution, obtained from the FFHQ dataset ([[https://github.com/NVlabs/ffhq-dataset](https://github.com/NVlabs/ffhq-dataset)]([https://github.com/NVlabs/ffhq-dataset](https://github.com/NVlabs/ffhq-dataset)), accessed on 4 March 2024). We selected images starting from filenames 66000.png to 66999.png. The mean image size was 1.3 MB, with a median of 1.31 MB and a standard deviation of 0.161. The images were stored in the delegator device at the start of each experiment. The nodes used for the experiment are given in Table 1. These devices represent a range of computational capacities across the edge, fog, and cloud layers. The Moto G5S Plus (D1) represents a constrained edge device typical in IoT setups, while the OnePlus 6 (D2) demonstrates a more powerful edge environment. The Dell Inspiron 5502 (F1) serves as a fog server, representing resource-rich devices for intermediate computation and the AWS EC2 t3.xlarge instance (C1) exemplifies a high-performance cloud resource for centralised processing. These choices demonstrate the applicability of our approach to devices across a wide spectrum of computational capacities, from constrained edge devices to powerful cloud resources. All results were obtained from experiments conducted on the specified physical devices, ensuring a realistic evaluation of the system's performance. No simulations were used.