## 4 DeepFogSim: The Considered System Model
### Container-Based Virtualized Fog Node Architecture  
In principle, the technological platform of Figure 3 may run, in parallel, _multiple_ CDNNs which carry out different analytics on the same set of sensed data by resorting to the virtualization of the full spectrum of available physical resources [40].  
Hence, according to this consideration, we assume that all Fog/Cloud nodes of Figure 3 are equipped with software clones of the run CDNNs. The number of clones simultaneously hosted by each FN equates to the number of (possibly, multiple) CDNNs which are running in parallel over the technological platform of Figure 3. Doing so, each clone is fully dedicated to the execution of a single associated CDNN, and then it acts as a virtual \"server\" by providing resource augmentation to the tied \"client\" CDNN. For this purpose, each clone is executed by a container (CNT) that is instantiated atop the hosting FN. The container is capable of using (through resource multiplexing) a slice of the physical computing and networking resources of the hosting FN. The logical view of the resulting virtualized container-based FN is detailed in Figure 5.  
All containers hosted by \(\text{Fog}(j,m)\) in Figure 5 share: (i) a same Host Operating System (HOS); and (ii) the pool of computing (i.e., CPU cycles) and networking (i.e., bandwidth and I/O Network Interface Cards (NICs) and switches) physical resources available on the hosting FN. The task of the Container Engine of Figure 5 is to allocate these physical resources to the requiring containers by performing dynamical multiplexing.  
The resulting virtualized architecture of \(\text{Fog}(j,m)\) is sketched in Figure 6. Specifically, in Figure 6 we have that:  
1. the \((j,m)\)-th _Virtualized Convolutional Processor_, running at frequency \(f_{jm}\), provides the computing support for the execution of the set of \(|\mathcal{T}_{m}|\) consecutive convolutional and pooling layers of the supported CDNN to be executed on _tier_\(\#m\). In the envisioned architecture, the input data \(\vec{z}_{m-1}(j)\) at the _Virtualized Convolutional Processor_ is a feature vector received from the FNs working at the previous _tier_\(\#(m-1)\), while the corresponding output data \(\vec{z}_{m}(j)\) is provided to the associated _Virtualized Classifier Processor_, as well as forwarded to the FNs operating at the next _tier_\(\#(m+1)\);
2. the \((j,m)\)-th _Virtualized Classifier Processor_, running at frequency \(\widetilde{f}_{jm}\), provides the computing support for the execution of the local classifier of the CDNN. Its task is to process the feature vector generated by the corresponding _Virtualized Convolutional Processor_, so as to produce the output vector \(\widetilde{\widetilde{y}}_{m}(j)\) to be delivered to the corresponding \(m\)-th _Local Aggregator_ of Figure 3 for the (possible) generation of an early-exit;
3. \(\text{Fog}(j,m)\) is also equipped with a number \(FanIn(j,m)\geq 1\) of virtualized input ports. Hence, the task of the _MulltipleXer_ (_MUX_) at the bottom of Figure 6 is to merge the corresponding information flows received by the FNs operating at the previous _tier_\(\#(m-1)\), so as to generate a (single) aggregate feature vector \(\vec{z}_{m-1}(j)\). All input flows at the bottom of Figure 6 are assumed to operate at a same bit-rate \(R_{m-1}\) (bit/s);
4. the main task of the _De-MulltipleXer_ (_DEMUX_) at the top of Figure 6 is to replicate the received feature vector \(\vec{z}_{m}(j)\) over the \(FanOut(j,m)\geq 1\) virtualized output ports equipping \(\text{Fog}(j,m)\). Each output flow is forwarded to the FNs at the next _tier_\(\#(m+1)\) at a bit-rate \(R_{m}\) (bit/s); and  
Figure 5: Logical view of a virtualized container-based Fog node. \(n_{c}\) is the number of containers hosted by each Fog node.  
the task of the _Virtual Switch_ (_VS_) of Figure 6 is to enable the transmission of the output feature \(\mathbb{Z}_{m}(j)\) to the FNs at the next _tier_\(\#(m+1)\) only when early-exit does not occur at _tier_\(\#m\).