## 3 Proposed System
### Load-Balancing Model in the IoT Environment  
Fog computing is a liberating concept for balancing workloads in a cloud context. The resources could not be utilized to their full capacity because of execution time and compute node property variances in the fog. We put much effort into preventing the compute nodes in the fog environment from being overworked or underworked.  
If \(t_{m}(1\leq m\leq M)\) is assigned to the computing node \(q_{n}(1\leq n\leq N)\) at time instant s, then let \(K_{m}^{u}(s)\) be the binary variable used to determine (2):  
\[K_{m}^{u}(s)=\begin{cases}1,&\quad\text{if $t_{m}$ is assigned to $q_{n}$}\\ 0,&\quad\text{otherwise}\end{cases} \tag{2}\]  
The fog service's distribution judgment estimates the resource utilization for the nth computing node \(q_{n}\) at time \(s\) in (3):  
\[bx_{n}(s)=\frac{1}{a_{n}}\sum_{m=1}^{M}K_{m}^{u}(s)\cdot b_{m} \tag{3}\]  
where \(a_{n}\) is the computing node \(q_{n}\)'s capacity. Using the service distribution, we can calculate how many services are running at a time \(s\) in (4):  
\[mt_{n}(s)=\sum_{m=1}^{M}K_{m}^{u}(s) \tag{4}\]  
For each kind of processing node, the load-balance variation must be specified. In order to provide fog services, assume there are W distinct categories of cloud and fog nodes (5).  
Resource utilization is intrinsically linked to load-balancing fluctuations. In order to quantify resource consumption, we must ascertain the number of compute nodes of type w that are actively being used at instant \(s\) (5):  
\[c_{w}(s)=\sum_{n=1}^{N}f_{n}(s)\cdot\beta_{w}^{n} \tag{5}\]where \(\beta_{w}^{n}\) is used to judge whether \(q_{n}\) is a type w computing node, which is described in (6), and \(f_{n}(s)\) is used to judge whether \(q_{n}\) is empty at \(s\), presented in (7).  
\[\beta_{w}^{n}=\left\{\begin{array}{ll}1,&\mbox{ \ \ if \ }q_{n}\mbox{ is a \ \ with type computing node,}\\ 0,&\mbox{otherwise.}\end{array}\right. \tag{6}\]  
\[f_{n}(s)=\left\{\begin{array}{ll}1,&\mbox{ \ \ if \ }mt_{n}>0,\\ 0,&\mbox{ \ otherwise}\end{array}\right. \tag{7}\]  
At time s, the resource consumption for computing nodes of type \(w\) is calculated by (8):  
\[BX_{w}(s)=\frac{1}{c_{w}(s)}\sum\limits_{n=1}^{N}\sum\limits_{m=1}^{M}K_{m}^{ n}(s)\cdot bx_{n}(s)\cdot f_{n}(s) \tag{8}\]  
For this additional purpose (variance of load balance of at time \(q_{n}\) instant \(s\)), the load-worth balance will rise or fall depending on how resources are used. The standard deviation of \(q_{n}\) can be determined by using the following Equation (9):  
\[dr_{n}(s)=\left(bx_{n}(s)-\sum\limits_{w=1}^{W}BX_{w}(s)\cdot\beta_{w}^{n} \right)^{2} \tag{9}\]  
The standard deviation of all compute nodes of type \(w\) is summed to get an average of ten (10).  
\[DR_{w}(s)=\frac{1}{c_{w}(s)}\sum\limits_{n=1}^{N}\sum\limits_{m=1}^{M}K_{m}^{ n}(s)\ \cdot\ dr_{n}(s)\cdot f_{n}(s) \tag{10}\]  
Load-balance variance in cloud and fog conditions during the execution period \([S_{0},S]\) might be determined using (11):  
\[DR_{w}=\frac{1}{S-S_{0}}\int_{T_{0}}^{T}DR_{w}(s)\ rs \tag{11}\]  
Given these facts, min \(DR_{w},\) \(\forall w=1,\ldots,W,\) and \(t\cdot s\cdot c_{w}(s)\leq\sum\limits_{m=1}^{M}\beta_{w}^{n},\) the following expression is obtained for the difficulty of reducing the load-balance variance:  
\[\sum\limits_{m=1}^{M}K_{m}^{n}b_{m}\leq a_{n}, \tag{12}\]  
Here, \(\sum\limits_{m=1}^{M}b_{m}\) represents the resource requirements for all services, \(\sum\limits_{n=1}^{N}a_{n}\) displays the resource requirements for all services assigned to the type m computer node, and Formula (12) depicts the computing node capacity. We can see from (12) that the main objective of this study was to resolve an optimization problem with several constraints [36].