# Two-Stage Optimal Task Scheduling for Smart Home Environment Using Fog Computing Infrastructures
## 4 Performance Analysis and Evaluation Matrix
### Results and Discussion  
This study discusses the proposed two-stage optimal model for task scheduling within the fog environment with an application to smart homes. The smart home case study deals with a time series solution, which further reduces the latency time, minimizes the usage of the network bandwidth, has a quick response time, and has many other benefits.  
Fog computing is one the most-suitable environments for providing all these benefits to smart homes. The concepts of resource management and task scheduling help to distribute the tasks and resources among other fog nodes in order to improve the performance of the network and services. Thus, the proposed 2-ST approach is very efficient in the smart home scenario as compared to the hybrid approach proposed by [PERSON] et al. [12] for both fog and non-fog environments. The efficiency of the smart home scenario within the fog environment is calculated in terms of energy consumption, latency, and network usage. Figure 5 shows the energy consumption in Joules for the proposed 2-ST model and its comparison with the hybrid approach for both the fog and the cloud environment. The corresponding figure shows the reduced energy consumption for an increased number of tasks within the smart home fog environment. Due to the decentralized nature of cloud computing, it provides the best performance with respect to the data storage and processing, but brings an increase in the latency, energy consumption, and network utilization. Thus, cloud computing is not the best solution for time-critical applications such as smart homes, smart cities, healthcare, and many others.  
In contrast to the aforementioned benefits and drawbacks of cloud computing, a new layer has been added into the existing cloud architecture, named the fog layer, and thus, a new environment came into existence with its own benefits, known as fog computing. One of the main advantages of the fog environment is the latency time, and Figures 6 and 7 show the same along with a comparison of the proposed and hybrid approaches for the fog and cloud environment. The fog layer is responsible for bringing resources near the IoT sensors for the actions or tasks to perform, which further reduces the load on the cloud server and reduces the latency time during task execution.  
\begin{table}
\begin{tabular}{l l} \hline
**Sensor Data** & **Unit of Measurement** \\ \hline Humidity & \% age \\ \hline Motion sensor & On/off \\ \hline Smoke & Obscuration in dBA \\ \hline Water leak sensor & Buzzer on/off \\ \hline Electricity usage sensor & KWH \\ \hline Light sensor & Lumens; on/off \\ \hline \end{tabular}
\end{table}
Table 5: IoT sensors’ parameters.  
Our proposed 2-ST, i.e., the two-stage optimal task scheduling approach, reduced the energy consumption, latency time, and network utilization significantly compared to the hybrid approach for both the fog and cloud environment. The results clearly showed that the energy consumption, network utilization, and latency time increased with the increase in the number of tasks and sensors within the smart home. The comparison between the hybrid and 2-ST approach showed small differences with respect to the energy consumption, but a great difference with respect to the latency time. Similarly, the network usage also showed a significantly large difference between the 2-ST and hybrid approach for the cloud environment, as well as the fog environment. Thus, overall, the results showed that the proposed 2-ST approach performed the best for the smart home scenario.  
Figure 5: Energy consumption in J for different tasks within the smart home environment.  
Figure 6: Latency comparison of the 2-ST and hybrid approaches for both the cloud and fog environment.