4.1.1. Scenario 1(1): 25 VMs for Single DC

In scenario *1(1)*, 25 VMs with one DC are considered for intelligent resource utilization. Among the six clusters, the RT of all fogs is optimized using the MGs installed in the regions. It is observed that during peak hours, users have higher demands as compared to low peak hours. The details of peak and off peak hours regarding each region are taken from [30]. Since the fog accomodates efficiency in latency while communicating to the cloud environment, this framework gives a reliable solution in the energy management and resource allocation as displayed in Figure 2. The RT of the SJF algorithm is more efficient than the RR and ESCE. SJF processes the requests with the minimum completion time and entertains the other requests which are having the largest PT. Further, RR entertains all the cloudlets in a cyclic order based on their request time. In addition, ESCE checks the free VMs and equally distributes all requests to them. Two MGs are installed in each region to fulfill the demands of consumers. The RT obtained by the ESCE, RR and SJF algorithms throughout the simulations is: 65 ms, 58 ms and 57 ms for fog 1; 60 ms, 58 ms and 57 ms for fog 2; 64 ms, 58 ms and 57 ms for fog 3; 63 ms, 58 ms and 57 ms for fog 4; 53 ms, 50 ms and 49 ms for fog 5; and 58 ms, 55 ms and 54 ms for fog 6. The RT is totally based on the number of the requests for each hour. So, the requests are based on the population of all clusters as shown in Table 2. For fog 1, SJF is 13% more efficient than the ESCE; whereas it is 2% more efficient than RR. For fog 2, it is 5% and 2% more intelligent than the previous two algorithms. SJF outperforms ESCE and RR up to 11% and 2% for fog 3. In fog 4, SJF beats the previous algorithms: ESCE and RR up to 10% and 2%. For fog 5, SJF obtains the efficient RT of 8% and

2% as compared to ESCE and RR. SJF is 7% and 2% more efficient than ESCE and RR algorithm for fog 6. It is observed that SJF can handle more requests easily and outperforms the previous algorithms as shown in Figure 4 because the regions: 0, 2 and 3 have the maximum population and it shows better results for them as compared to the previous algorithms.

**Figure 4.** Average Response Time (RT) of All Fogs in Scenario *1(1)*.

The average PT of each fog according to the users' requests is displayed in Figure 5 for the whole day using the aforementioned algorithms. The average PT of the fog 1 is 13 ms, 9 ms and 8 ms using the ESCE, RR and SJF algorithms. Fog 2 also has the effective PTs which are optimized by these algorithms as 14 ms, 9 ms and 8 ms using ESCE, RR and SJF. SJF outperforms the other algorithms for computing the requests of region 3 consumers in 13.5 ms, 8 ms and 9 ms using the above-mentioned algorithms. ESCE, RR and SJF obtain the optimized PT from the fog 4 up to 13.8 ms, 9 ms and 8 ms. Fog 5 obtains the efficient PT using the SJF as compared to the ESCE and RR upto 7 ms, 10 ms and 8 ms. All algorithms provide 5 ms, 4 ms and 3 ms optimized PT for Fog 6. From these results, it can be concluded that SJF gives more optimized results for all of the fogs in the respective regions. All regions have sufficient population and the proposed algorithm gives efficient results as compared to the previous algorithms. For example: it outperforms the ESCE and RR up to 39% and 2% for fog 1; 37% and 2% for fog 2; 41% and 2% for fog 3; 43% and 2% for fog 4; 93% and 13% for fog 5; and 40% and 25% for fog 6.

**Figure 5.** Average Processing Time (PT) of All Fogs in Scenario *1(1)*.

Consumers' RPH is shown in Figure 6 for all the fogs installed in the respective regions. Fog loading is done as per the number of requests received from the buildings. The number of buildings and homes are considered random; however, their requests are taken as fixed in each

time interval. The fog loading phase is initiated after the requests' receiving phase and then tasks' computation is performed. The maximum population is considered from each region for getting the maximum number of requests and the number of VMs, MGs and other relevant services are available on the fog and cloud DCs for fulfilling the requests. The requests from each region are based on the number of consumers living in that region as shown in Figure 6.

**Figure 6.** Request Per Hour (RPH) of the Consumers in Scenario *1(1)*.

Using the six fogs for six regions, the proposed system's total cost is comprised of the VMs cost, MGs cost and data transfer cost. The number of MGs, VMs and all the other allocations relevant to users' requests along with their costs are calculated and analyzed. There is a trade-off in the VMs cost using the SJF algorithm; since it receives the tasks with the small size priority and allocates those tasks to the available VMs, it has a high cost. The VMs cost obtained by the ESCE, RR and SJF is 300\$, 478\$ and 300\$. MG cost is computed as: 2731.94\$, 2400\$ and 2734.31\$ respectively. The data transfer cost is calculated as 5795.75\$, 3800.53\$ and 5795.79\$. In addition, computation cost for the MG and data transfer cost for the other two algorithms is not very high because they do not consider the request's size priority. Aggregated cost for all three algorithms is shown in Figure 7.

**Figure 7.** VM, MG and Data Transfer Cost.
