# Minimum-Cost-Based Neighbour Node Discovery Scheme for Fault Tolerance under IoT-Fog Networks
## 3 Materials and Methods
### Problem Formulation and Objective Function
The maximum response time, 49.57 ms, occurred at a higher task count of 1500, with a task length of 5000. The proposed method provides shorter response times of 0.9 ms, 0.3 ms, and 0.1 ms for \begin{table}
\begin{tabular}{c c c} \hline \hline
**S.No** & **Parameter** & **Value** \\ \hline
1 & Fog server & 5–50 \\
2 & Fog control node & 20–100 \\
3 & Fog access node & 50–5000 \\
4 & User device & 5–1000 \\
5 & Number of tasks & 50–1500 \\
6 & Task length & 1000–10,000 \\
7 & Node capacity & 1500 MIPS \\
8 & Initial node energy & 5 J \\
9 & Task selection from IoT/user device & Priority based \\
10 & Cloud data-center & 1 \\
11 & Bandwidth & 500 \\
12 & Processing speed & 1200 MIPS \\
13 & Fog memory space & 1024 MB \\
14 & Deadline of the task & Length based \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Simulation parameters. Figure 5: Comparison of average response time vs. number of tasks, (**a**) with a variable length; (**b**) with various algorithms. HBI-LB [25], Throttled, and Round Robin [27], respectively. This is because an increase in both factors will directly affect the load of the Fog network and the availability of Fog access nodes during efficient task-offloading, significantly increasing the average response time. Figure 6a,b present a comparison of average response times with various existing algorithms, such as Round Robin, Throttled [27], and HBI-LB [25], for variable task lengths and multiple tasks, respectively. This is identified as the proposed PTFT algorithm with a shorter average response time of 1 ms, 0.3 ms, and 0.7 ms for HBI-LB [25], Throttled [27], and Round Robin, respectively. This is achieved because the lowest-cost path with appropriate residual energy levels are selected based on task priority and the free availability of alternate candidate Fog access nodes for task-offloading following fault occurrence, while also keeping track of task-offloading activities in Fog network using RPF algorithm to avoid the under- and overutilization of Fog access nodes. ### Task Completion Rate

The proposed PTFT/RPF algorithm is simulated based on the task deadline (length) and the obtained results are compared with the existing RPMFT [10] method and replication without a fault-tolerance mechanism. Figure 7a,b illustrate the performance of the proposed PTFT method in the first scenario, showing the completion rate and failure rate for 250 tasks of random length generated by the IoT/user devices. It is observed that the proposed replication and pre-emptive forwarding method achieved a higher completion rate than other methods. Figure 7a indicates the importance of task completion using replication methods, and it is observed that, when 50%, 60%, and 80% failure rates are obtained, replicas are used to achieve efficient task completion during task-offloading activities in Fog networks. From Figure 7b, that the completion rate is shown to be improved for the proposed method, and an improvement in performance of 62.5% was observed compared to the RPMFT [10] method. Figure 6: Comparison of average response time vs. task length (**a**) with multiple tasks; (**b**) with various algorithms. In second scenario, Figure 8a,b present the performance of the proposed PTFT/RPF methods, showing the completion rate and failure rate for 1500 tasks of random length generated by the IoT/User devices. Figure 8a indicates the importance of task completion using replicas, and the 30%, 40%, and 50% failure rates were obtained when more replicas to achieve a better completion rate in Fog networks. Figure 8b shows that the completion rate is improved for the proposed method, and a 17.3% higher performance was reached compared to the RPMFT [10] method because the existing method uses only the replicas of specific tasks in the fault-tolerance mechanism, instead of giving equal priority to all tasks.