4.1.2. Scenario 1(2): 50 VMs with Two DCs

In this scenario, 50 VMs are used with two DCs in order to check the efficiency of the proposed C2F2C framework. First the RT of all the fogs is computed as shown in Figure 8. The RT of all fogs calculated according to the above-mentioned algorithms: ESCE, RR and SJF is 32.5 ms, 29 ms and 28.25 ms for fog 1; 30 ms, 29 ms and 28.25 ms for fog 2; 32 ms, 29 ms and 28.25 ms for fog 3; 31.5 ms, 29 ms and 28 ms for fog 4; 26.5 ms, 24 ms and 23 ms for fog 5; and 24 ms, 23 ms and 21 ms for fog 6. In this case, SJF outperforms all algorithms efficiently as it is also observed from all of the previous fogs results. SJF outperforms ESCE and RR: 14% and 3% for fog 1; 6% and 3% for fog 2; 12% and 3% for fog 3; 12% and 3% for fog 4 similar to fog 3; 14% and 3% for fog 5; and 3% using both algorithms for fog 6, respectively.

**Figure 8.** RT of All the Fogs in Scenario *1(2)*.

After computing the RT of the scenario, the PT of each fog is also computed as displayed in Figure 9. The PT for fog 1 is computed as: 7.5 ms, 4.5 ms and 4 ms using these algorithms. For fog 2–6, it is calculated as: 7 ms, 4.5 ms and 4 ms for fog 2; 6.55 ms, 4.5 ms and 4 ms for fog 3; 6.54 ms, 4.5 ms and 4 ms for fog 4; 5 ms, 4.5 ms and 4 ms for fog 5; and 2.5 ms, 2 ms; and 1.5 ms for fog 6 through ESCE, RR and SJF algorithms. These algorithms have optimized the proposed work efficiently, especially SJF algorithm performs better then the other two algorithms. For fog 1–6, it performs 47% and 12%; 43% and 12%; 39% and 12%; 82% and 12%; and 94% and 25% better than ESCE and RR. This scenario gives the more optimal results in terms of the resource allocation because more resources are utilized and consumers are entertained more efficiently as compared to the first scenario.

**Figure 9.** PT of All the Fogs in Scenario *1(2)*.

Figure 10 shows the RPH of the consumers which is kept the same as in scenario 1. For the sake of simplicity, RPH is kept similar to all scenarios in this work.

As mentioned above, the aggregated cost is comprised of the VMs cost, MGs cost and data transfer cost in this system. For this scenario, the resources are used twice as compared to the resources used in scenario *1(2)*, so, it costs almost double to the scenario *1(1)*; however, it maximizes the RT and PT of the consumers' requests. The total cost for this scenario is shown in Figure 11. The cost computed for VMs, MGs and data transfer is: 600\$, 756\$ and 600\$; 5463.88\$, 4800\$ and 5468.62\$; and 11591.5\$, 7601.06\$

and 11591.58\$. This scenario has achieved more optimized results as compared to the scenario *1(1)*; however, it compromises the cost.

**Figure 10.** RPH of All the Consumers in Scenario *1(2)*.

**Figure 11.** Virtual Machines (VM), Microgrids (MG) and Data Transfer Cost.
