# Fog over Virtualized IoT: New Opportunity for Context-Aware Networked Applications and a Case Study
## 4 A Case Study: StreamVehicularFog
### StreamVehicularFog Computing Model  
We consider the most general case composed of multiple reconfigurable VMs per physical server interconnected by a switched rate-adaptive virtual LAN (VLAN), managed by the controller, named StreamVehicularFog Manager (SVFM), with the following parameters:  
Figure 3: FDC structure in the StreamVehicularFog scenario.  
\(\bullet\)\(\mathcal{S}_{T}\stackrel{{\triangle}}{{=}}\) total number of physical servers with \(\mathcal{S}_{T}\geq 1\);  
\(\bullet\)\(\mathcal{VM}_{max}(s)\stackrel{{\triangle}}{{=}}\) maximum number of VMs (possibly, heterogeneous) hosted by the \(s\)-th physical server with \(\mathcal{VM}_{max}(s)\geq 1\), \(s=1,\ldots,\mathcal{S}_{T}\);  
\(\bullet\)\(\mathcal{VM}(s;v)\stackrel{{\triangle}}{{=}}v\)-th VM hosted by the \(s\)-th server, \(1\leq v\leq\mathcal{VM}_{max}(s)\), \(1\leq s\leq\mathcal{S}_{T}\);  
\(\bullet\)\(\mathcal{M}_{sv}\stackrel{{\triangle}}{{=}}\) total number of VMs in the data center that is calculated as: \(\sum\limits_{s=1}^{\mathcal{S}_{T}}\mathcal{VM}_{max}(s)\equiv\mathcal{S}_{T} \times\mathcal{VM}_{max}\). Formally, \(\mathcal{M}_{sv}\) is the set of available VMs which may be hosted by the FDC.  
Moreover, the engaged internal parameters for the server of the FDC are presented as follows:  
\(\bullet\)\(\mathcal{M}(t)\stackrel{{\triangle}}{{=}}\) set of the VMs which are turned ON at \((t)\) time slot \((t)\subseteq\{(s;v);\,1\leq s\leq\mathcal{S}_{T};\,1\leq v\leq\mathcal{VM}_{max} (s)\}\)  
\(\bullet\)\(\overline{\mathcal{M}}(t)\stackrel{{\triangle}}{{=}}\) set of the VMs which are turned OFF at \((t)\subseteq\{(s;v);\,1\leq s\leq\mathcal{S}_{T};\,1\leq v\leq\mathcal{VM}_{max} (s)\}\)  
\(\bullet\)\(\overline{\mathcal{M}}(t)\equiv\{(s;v);\,1\leq s\leq\mathcal{S}_{T};\,1\leq v \leq\mathcal{VM}_{max}(s)\}\) / \(\mathcal{M}(t)\) ;  
\(\bullet\)\(f_{s,v}(t)\stackrel{{\triangle}}{{=}}\) processing rate of VM(\(s\);\(v\)) at \(t\in[0,\,f_{s,v}^{max}](IU/s),\,1\leq s\leq\mathcal{S}_{T},\,1\leq v\leq\mathcal{VM}_{ max}(s)\);  
\(\bullet\)\(\mathcal{L}_{s,v}(t)\stackrel{{\triangle}}{{=}}\) workload processed by VM(\(s\);\(v\)) at \(t\in[0,\,\mathcal{L}_{s,v}^{max}](IU),\,1\leq s\leq\mathcal{S}_{T},\,1\leq v\leq \mathcal{VM}_{max}(s)\);  
\(\bullet\)\(f_{s,v}\stackrel{{\triangle}}{{=}}\) maximum processing rate of VM(\(s\);\(v\)), \((IU/s),\,1\leq s\leq\mathcal{S}_{T},\,1\leq v\leq\mathcal{VM}_{max}(s)\);  
\(\bullet\)\(\mathcal{L}_{s,v}^{max}\stackrel{{\triangle}}{{=}}\)\(t_{slot}f_{s,v}^{max}\stackrel{{\triangle}}{{=}}\) maximum workload processed by VM(\(s\);\(v\)) during each time slot (\(t\)); in \((IU),\,1\leq s\leq\mathcal{S}_{T},\,1\leq v\leq\mathcal{VM}_{max}(s)\);  
\(\mathcal{L}_{s,v}^{max}\leq t_{slot}f_{s,v}^{max}\).  
Let \(t\in\mathcal{T}\) be a consolidation instant. Each slot \(t\) can be considered according to the following states:  
1. turn ON some physical servers which were turned OFF at slot \(t\);
2. turn OFF some physical servers which were turned ON at slot \(t\);
3. turn ON or turn OFF some VMs hosted by servers which were turned ON at slot \((t-1)\) and are still turned ON at slot \(t\);
4. scaling up/down the processing rates and workloads of some VMs which are turned ON at slot \(t\).  
According to the aforementioned engaged parameters, the following actions should be taken to manage the problem applicable in the real environment: Let \(f_{ON}(IU/s)\) be the minimum allowable practical processing rate for turned ON VMs and \(\mathcal{M}(t)\equiv\{(s;v):\,f_{s,v}(t)>f_{ON};\,1\leq s\leq\mathcal{S}_{T};\,1 \leq v\leq\mathcal{VM}_{max}(s)\}\) and \(\overline{\mathcal{M}}(t)\equiv\{(s;v):\,f_{s,v}(t)\leq f_{ON};\,1\leq s\leq \mathcal{S}_{T};\,1\leq v\leq\mathcal{VM}_{max}(s)\}\).