Abstract
Nowadays, cities are intended to change to a smart city. According to recent studies, the use of data from contributors and physical objects in many cities play a key element in the transformation towards a smart city. The ‘smart city’ standard is characterized by omnipresent computing resources for the observing and critical control of such city’s framework, healthcare management, environment, transportation, and utilities. Mist computing is considered a computing prototype that performs IoT applications at the edge of the network. To maintain the Quality of Service (QoS), it is impressive to employ context-aware computing as well as fog computing simultaneously. In this article, the author implements an optimization strategy applying a dynamic resource allocation method based upon genetic algorithm and reinforcement learning in combination with a load balancing procedure. The proposed model comprises four layers i.e. IoT layer, Mist layer, Fog layer, and Cloud layer. Authors have proposed a load balancing technique called M2F balancer which regulates the traffic in the network incessantly, accumulates the information about each server load, transfer the incoming query, and disseminate them among accessible servers equally using dynamic resources allocation method. To validate the efficacy of the proposed algorithm makespan, resource utilization, and the degree of imbalance (DOI) are considered as the scheduling parameter. The proposed method is being compared with the Least count, Round Robin, and Weighted Round Robin. In the end, the results demonstrate that the solutions enhance QoS in the mist assisted cloud environment concerning maximization resource utilization and minimizing the makespan. Therefore, M2FBalancer is an effective method to utilize the resources efficiently by ensuring uninterrupted service. Consequently, it improves performance even at peak times.
Keywords
Introduction
With the help of the Internet of Things (IoT), the interconnected set of devices, physical machine, and sensors to communicate data over the network without the interference of humans [17]. Every associated object is designated with a unique ID. In day to day, a life application of IoT is present such as healthcare applications.
To get benefit from IoT devices, it is essential to connect with fog computing or mist computing [44]. Most IoT applications are employed in the healthcare management system [26]. Patients are monitored remotely with the help of smart objects so that the manpower and operational cost will be optimized [37]. The use of IoT devices plays a vital role in the health care sector. It includes remote health check-ups, old-age care, and incurable diseases [22]. The use of sensors increases the performance of the healthcare system and minimizes the cost of managing this leads to increases the efficiency. Here small sensors are connected to the patient’s body for getting different vital signs.
Generally, varieties of sensors are used for different applications in the medical sector. Pulse Sensors are used for the pulses of the body a list of serious cases such as heart attack, low and high blood pressure, and respiratory problems can find out [51]. Respiratory Rate Sensors are operated for monitoring the count of breaths per minute to identify the problems such as a blockage in the airway, tuberculosis, etc. [31]. Temperature Sensors are employed to detect the temperature of the body [36]. Blood Pressure (BP) sensors are responsible to measure hypertension [3]. Pulse Oximetry Sensors are utilized to find out the percentage of oxygen in the blood [19].
The main objectives of fog computing are to minimize latency, consumption of energy, and bandwidth efficiency [21]. Fog computing delivers the data near to the user. It provides a wireless transfer of data in an efficient manner. In a fog environment use of cloud is to bring the facilities near to the users but on a smaller scale. Task with greater computational complexity but less delay sensitivity may be sent to the cloud whereas tasks with lower computational complexity may be sent to the nearer fog server. Mist-Fog computing architecture is composed of a four-layer architecture that is an IoT layer, mist layer, fog layer, and cloud layer. Besides the fog layer and mist layer is being divided into different regions. Resource requests generated from the physical objects can be filled by the resources available in the layer. The mist and fog layer are divided into different regions; therefore, two prospects may arise one, server of a region might be overloaded and second, there are possibilities of availability of ideal resources in other regions. For the computation of incoming requests, it needs different resources based on the types of computation the load balancing mechanism will allocate resources. Previously different types of resource allocation methods are explained in various cases. Although they are having constraints such as various types of computational resources are available in the computational environment. If a fog server is getting crowded, then the quality of service of the model will not be maintained due to which it results in a higher delay.
The essential difference between fog computing and mist computing is that fog computing is the response to numerous difficulties in the IoT area, for example, high transfer speed necessities and reasonability of utilizations, this idea can be additionally stretched out by pushing the calculation to the end gadgets. In Fog computing the gateway bears the obligation regarding IoT application execution, in any case, whether the application is simply basic information assortment or building automation with numerous actuation tasks. Mist computing takes fog computing ideas significantly further by pushing suitable computation to the very edge of the organization, to the sensor and actuator gadgets that make up the organization. With Mist computing the calculation is performed at the edge of the organization in the microcontrollers in the installed nodes. The Mist computing worldview diminishes latency and further expands the independence of an answer.
The creativeness of this paper is to present an M2F balancer model utilizing the resource allocation strategy dependent on reinforcement learning and genetic algorithm. The proposed M2FBalancer framework has four layers for example IoT layer, Mist layer, Fog layer, and Cloud layer. The part of the IoT layer is to get beats from the patients. The mist layer is having one module named adaptive time share module that is liable for allocation and movement to an appropriate server. The fog layer is having an M2FBalancer module that is mindful to decide the status of the server, for example, underloaded, overloaded, and ordinary. The cloud layer is liable for the capacity of information. This is a real-time application model that can consolidate in a smart city’s health management.
The detail of the present paper is constructed as follows: Section 2 presents the related works and presents details overview in the perspective of cloud, fog, mist, and IoT computing in a cooperative environment. Section 3 explains the proposed model, for load balancing and task scheduling Section 4 highlights the experimental setup and analyzes the simulation related result followed a discussion. Finally, Section 5 ends with concluding remarks with future insight.
Related work
The general concept of smart city
Smart city concept is being developed for enhancing the economy, portability, ecosystem, people, and standards of living and management of cities. The smart city aimed for providing basic and necessary facilities to its citizens. They all are having equipped with various objects for seamless solutions to their problems. Now-a-day’s cities across the world collect a massive amount of data that are associated with all the requirements of living organisms stayed in the city. These collections of a huge amount of data will lead to the creation of useful and significant content that will help the technology to solve the complicated problems faced by the citizens of the smart city. For example, in Seoul city, the government collected data which is related to public health, transportation, and residence and these data are assigned to the data scientist and engineers to predict and produce a meaningful pattern to solve the problems faced by the citizens in the day-to-day life. As a consequence, the Seoul government identified the demand of the public to operate the city bus facility during mid nighttime [28]. Data collected or generated by the users are being analyzed and stored securely in different layers of the co-operative model and processed accordingly.
A vast analysis had been done how the use of a huge amount of data in smart city and related issues in specific fields of transportation, public healthcare management, energy distribution and sustainability [2,10,14,39,47,48]. Figure 1 [39] illustrates the various components associated with the smart city.

General structure of smart city.
Cloud computing is defined as the system of interlinked thousands number of computers, having numerous numbers of applications and files hosted on a cloud and all the nodes are connected through the internet in a complex manner. Cloud computing provides the facilities of sharing of resources; hardware, software on demand [34]. It also implements the concept of parallel and distributed computing. Users need not purchase the software or computation platforms they are going to follow a “pay as you use” model [32,33]. If the customer is having an internet facility then they are going to use the facilities of computation and resources and have to pay accordingly. Cloud computing becomes more and more demand in the industry, academia, and society as the omnipresent of internet access and big data in their volume, velocity, and variety through the internet [30]. Cloud computing is the distribution of computing services over the internet. The third-party is involved in the management of the data which is being provided by the cloud as a service to the individuals or business organizations [16]. The Geographical Information System (GIS) enables cloud computing paradigm leverages for environmental monitoring, marine and coastal management, urban planning and health care, watershed [4,5].
Fog computing
Fog computing is a networking architecture that uses IoT devices for carrying out a computation, storage, and communication in a specified region [43]. Fog computing uses the boundary network resources and cloud resources [7]. Fog computing is a cooperative framework where IoT applications are presented [24,41]. Various challenges are faced by the computing environment such as architecture, interfacing, and programming offloading of computation, resource allocation, load balancing, the security of data, storage of data is discussed in detail in [29]. With the incorporation of fog computing, several challenges to health management in smart cities can be solved [42]. The health care management sector highly benefited with the presence of fog computing [27]. During the process of transmission of data between the IoT enabled devices and fog servers, there will be an impact of processing delay and transmission delay [9]. A variety of models is being proposed which aims to achieve the minimum energy consumption in communication and computation [25]. The models are based on an amalgamation of cloud and fog.
The objects associated with fog computing environments are different, so it is very necessary to achieve proper communication among all of them. There should be an exact management scheme to achieve the objective of the fog based cooperative model [13].
Mist computing
Mist computing provides the facility of, placement of computing facility on the edge of the actual devices, of the network. The microchips or microcontrollers attached to the physical objects are going to compute the whole data sensed by the objects. After computing these data; they are going to transfer these data to the network [4,6]. The process of transferring data consumes energy from an equivalent computing platform. Having computation power on the device, data can be processed, prepared, and improved first before getting stored. The resulting data will consume less power while transfer and would be smaller in size. The advantage of the integration of fog and mist computing is security. The data on the system would be secure by using this combined approach. The data is processed locally before transferring to a remote server. Mist computing environment requires less cloud storage and transmission power for long term analysis data. The health care system and smart cities are the areas where fog computing applications have been applied successfully [11], such as the mist computing environment that works near the edge and physical devices, which provides low power gateway that increases throughput with reduced latency at the edge of the devices. As a result, cloud storage has reduced. So, in the meantime, reduction in required transmission power results in overall efficiency [6,15].
To have a secure computation uploading scheme in a fog-cloud-IoT environment, Alli et al. [1] have proposed a secured uploading scheme based on the neuro-fuzzy model and particle swarm optimization. The neuro-fuzzy model is employed to secure data at the smart gateway and PSO is used to select an optimal fog node by the IoT device to upload its workload. Authors have considered private and public cloud for both sensitive and non-sensitive data, both this data is uploaded using a dynamic uploading strategy. Besides, they have considered a cloud layer if the fog node is not capable of handling the workload. To determine the fog load onto which the workload should be migrated, two metrics are considered as available processing capacity and remaining load energy. Reinforcement learning is used to select the clod layer. Their proposed approach is implemented using the NS3 simulator with java programming and compared with DTO-SO, FCFS, LOTEC, and CMS-ACO. Their proposed approach significantly reduces response time, energy consumption while maximizing resource utilization and throughput. Chen et al. [8] have proposed a machine learning-based time constraint resource allocation scheme for vehicular fog computing. In this paper, a Perception Reaction Time (PRT) matrix is used for load efficiency and security in fog computing. The primary idea of this article is to minimize the PRT by using a deep reinforcement learning approach for the on-demand optimal resource allocation. Their proposed approach claims that PRT is reduced by about 70% while being compared with the traditional approach like Q- learning and SEO.
Load balancing strategy
The methods of allocating incoming requests among all the servers equally are known as load balancing [18]. The objective of load balancing in mist computing is to confirm that there is no overload. The merits of using load balancing techniques are waiting time reduction, minimization of response time, efficient resource utilization, improves the throughput and enhance overall performance and efficiency of the system. The M2F balancer is a congestion monitoring program between server and user requests. The main goal of the balancer is to increase resource utilization. When a server goes down, the load balancer sends the incoming request to other free servers available in the layer. At the time of joining the new server to the cooperative model, the load balancer will automatically forward incoming requests to it.
Again, the load balancing techniques are classified into two types that are static load balancing and dynamic load balancing. Static load balancing is defined as once any task is assigned to any server can’t be removed until unless it completed its computation. Static load balancing is non-primitive. Static load balancing techniques lead to minimizing the execution time because of less communication with others. The demerits of static load balancing are that it overlooks the present situation of a system when it performs the distribution of tasks. In the case of dynamic load balancing techniques, it always checks the workload status of each system, and accordingly, it will redistribute the load again. Dynamic load balancing techniques can be able to choose which task will have to assign to which server according to the present situation of the computing environment. In case of dynamic load balancing, the load balancer can decide the exact server to whom the task will be transferred. According to the computing scenario, the dynamic load balancing technique is more productive as compared to the static load balancing techniques. The demerit of the dynamic load balancing method is network congestion which degrades the performance. In general, the load balancing mechanism is used to make sure of uninterrupted service.
Resource allocation holds a very pivotal role in the context of cloud computing. It is very important to distribute the available resources between different servers available in an effective manner. Due to the efficient computing nature, it is a very common research issue in the cloud computing field [46]. The benefits of using dynamic resource allocation in a computing environment [35] are to reduce the location overhead and no software or hardware overhead. A limitation of dynamic resource allocation is inconsistent with resources as they are assigned to distant server and migration issues [12,38].
The load balancing procedure is implemented to scale up the ability to expand the server capacity by transferring the overloaded tasks among available underloaded servers [49]. The commonly used load balancing algorithms are Least Connection (LC), Round Robin (RR), Weighted Round Robin (WRR), Dynamic Round Robin (DRR), Least Response Time (LRT) and Weighted Active Monitoring (WAM). According to LC method, it will transfer the load to the server which is having the least number of active transactions. For each server it up to dates the data in continuous based on the sequence of connections. Next, its trade-off the loads among the servers [45]. In RR, the load balancer is having the list of free servers and the incoming request will be sent equally to everyone in sequence [5]. WRR is analogous to the RR in assigning the task in a time-shared manner but it varies in the sense that the job is having the highest number of requests will be assigned a higher weight. In WRR, a weight is assigned to each server based on its capacity [20]. DRR is a procedure of allocating the weight to the servers based on the server load and capacity. According to the servers load the load balancer transfer task to the compatible server [50]. LRT algorithm transfers the task to those servers that are having the least response time [40]. In WAM, weights are assigned to the server based on its processing capability. It assigns to the most effective server often arriving a new incoming request [23].
Proposed model
In this section, it describes a mist to fog based load balancing algorithm and optimization strategy cooperative fog computing environment. The most useful application of IoT is in the health care management system. In a smart city, healthcare management is having a big role to provide services to its citizens. In this paper, the authors proposed a mist computing-based load balancing algorithm for a four layer-based architecture.

Proposed M2FBalancer model.
It is implementing an IoT-mist-fog based healthcare management system which is shown in Fig. 2. In this section, it purposes the M2FBalancer system that has four layers i.e. IoT layer, Mist layer, Fog layer and Cloud layer. Among these four layers, the role of the IoT layer is to receive pulses from the patients. The third layer is the fog layer which is used to decide the status of the server and migrate the job from an overloaded server to an underloaded server. The fourth layer that is cloud layer is accountable for the storage of secured forwarding of data to and from the mist layer. The desired data are transferred to the most suitable server. The incoming request from different regions will be assigned with priorities by the M2FBalancer and it will assign the optimized scheduling algorithm for processing the incoming task. In consequence, the M2FBalancer gets the least execution time and minimum waiting time.
The main goal of the IoT based layer is to perceive different stimuli of living objects. Then next to the IoT layer is the mist layer, responsible for the management of incoming request and transfers it to the respective suitable/appropriate server. The third layer is the fog layer which is used to decide the status of the server and migrate the job from an overloaded server to an underloaded server. The fourth layer that is cloud layer is used for storing secured data and forwarding those data to and from the mist layer. The stimulus received from the physical living objects is transferred to a suitable server for processing that is controlled by the smart city health care management. The primary goal behind the cooperative architecture is to attain a low response time.
The mist layer is having one module named adaptive time share modules that are responsible for allocation and migration to a suitable server. The fog layer is having a M2FBalancer module that is responsible to determine the status of the server such as underloaded, overloaded, and normal. This is a real-time application model that can incorporate in smart city’s health management. The allocation cost and response time are also minimized so that it enhances the QoS in the proposed environment.
Figure 3 explains the flow information in different layers that is from the device layer to the cloud layer. The basic requirement is there should be internet connections from the device layer to the cloud layer. The user is going to send the request from the device layer then an acknowledgment will be sent by the next layer. Then the user is going to submit the task to the mist server, if the mist server is overloaded then the task will be submitted to the fog server. If the fog server is unable to execute the task then it will be transferred to the cloud layer, based on that each layer is going to have a response as accept or deny.

Sequence diagram for M2FBalancer.
The M2FBalancer is responsible to choose the exact server, can process the incoming request. The selection procedure of the mist server is based upon two criteria that are characteristics of the mist server and predefined conditions. The components of the M2FBalancer are Mist Server Classification (MSC) and Calculating Weight Procedure (CWP). The total layer is being divided into the different clusters, each cluster has a master node that handles and manages the data of the entire server. The Mist Server Manager (MSM) transfers the information of the slave nodes to its master node. The characteristics of the mist server are recorded at the server information table (SIT). The characteristics of the mist servers are CPU usage, size of the resources (capacity) and storage size (RAM) and Adaptive Weight (AW). This AW is expressed based on the parameters mentioned above and is denoted as follows:
These are the matrices used in this paper to evaluate the effectiveness of the proposed algorithm. The following quality of service metrics are defined as follows
The average utilization of the resource is defined as the complete usage of every asset present in the mist environment.
The average utilization of resources is calculated as follows
Here, BS is the balanced sate and
The master server is having a server information table and M2FBalancer program. The selection of the fog server is based on the value of AW (β). As the value of β changes, the value of AW also changes. A genetic algorithm is implemented to get the most prominent value of β. The population for the genetic algorithm is the assigned task to the available servers. The named genetic algorithm is an optimal beta setting algorithm. The details steps of the optimal Beta setting are shown in Algorithm 1.

Optimal beta setting (OWS)
Each server calculates AW; the M2F balancer calculates the average AW and calculates the threshold AW.
The mist server is identified by comparing the value of AW with the AAW and TAW, and it is recognized as either overloaded (
With the overloaded condition, the resource allocator selects a suitable underloaded server and transfers the request from the overloaded server to the underloaded server. If the mist server is overloaded, then it has to transfer the request from the overloaded mist server to an underloaded mist server. The resource allocator will select the compatible underloaded server by calculating the Process Weight (PW) and it will assign the task to the underloaded server that is having the highest PW value. The PW is calculated as follows
Adaptive weighted round Robin (AWRR)
The proposed method implements a resource allocation (RA) algorithm based on an Adaptive Weighted Round Robin (AWRR) that is a revised version WRR. The AWRR approach has two primary jobs such as i. Rl based resource allocation and ii. RL based task migration. A weight parameter is used in the AWRR to find out the compatible underloaded server. The next server with the maximum AW is assigned as the highest priority server.
RL based assignment algorithm (RLAA)
In this research, a reinforcement learning-based assignment algorithm for the mist environment is implemented. The assignment of task on to server is based on the RL algorithm to accomplish a maximum load balancing in the mist environment. RLAA algorithm that is an AI technique to accomplish maximum load balancing in the mist environment. The broker gets information about the state of the current environment and takes the action accordingly. The updated action does result in the current state. Thereby the brokers get informed with the respective change with the help of a reward. The following RL assignment algorithm selects the suitable mist server to process the on-demand request. In this part, another RA technique for LB in mist environment is proposed. RLAA algorithm that is an AI technique to accomplish maximum load balancing in the mist environment. RL is an AI method where an operator makes a move in an environment to pick up the honor. The agent gets the current climate state and makes a move appropriately. The taken steps prompt an adjustment in the climate state and at that point, the agent will be acknowledged with the change through an honor. The pseudo-code of RLAA algorithm as shown in Algorithm 2.

RL based assignment algorithm
The optimal process is going to transfer the processes from overloaded mist servers to the underloaded mist servers, the process is known as migration process. The details of the migration are to be updated in the Server Information Table (SIT). Algorithm 3 emphasizes the resource migration approach while Algorithm 2 emphasizes the task assignment approach. The resource migration approach is responsible to migrate the resources either within the server or between the servers often overloading condition. In contrast, the task assignment procedure is responsible to allocate the task to the server for scheduling. Task assignment procedure is implemented after executing an effective load balancing strategy. Overall instruction of the resource locator-based migration algorithm is explained in Algorithm 3. The migration agent selection policy figures out how to choose the ideal process to relocate from overloaded mist servers to the underloaded mist servers and afterward refreshes the information in the Server information table (SIT). During the overloaded condition, resources are to be migrated to the underloaded server. Underloaded servers are chosen based on the low response time of a resource. Then, the tasklist table will be updated accordingly. The pseudo-code of the Resource migration based algorithm as shown in Algorithm 3.

Resource migration based algorithm
Algorithm 4 is described as the updated task list table with a modified tasklist value. After the migration, the tasklist table will be updated with the modified value. This iteration will take place until the maximum iteration is reached. The pseudo-code of the Resource migration based algorithm as shown in Algorithm 4.

Updated tasklist table with a modified tasklist value
The proposed method has experimented on a computer with Intel i5, 3.4 GHz CPU, with 4 GB RAM. To validate the effectiveness of M2FBalancer, all the experiments have been simulated on MATLAB. The proposed AWRR algorithm is being compared with previously used algorithms in fog computing for Least count [45], Round Robin [5], and Weighted Round Robin [20]. The simulation results show that the proposed AWRR method gives a notable improvement for makespan, average resource utilization and degree of imbalance. Dynamic independent tasks with variable lengths are considered to validate the efficacy of the proposed algorithm. All the experiments have been conducted 10 times and the mean values of all the 10 executions are noted down.
Discussion
The performance of the proposed algorithm and the previously used load-balancing algorithm is given in Fig. 4, which shows the makespan of the proposed technique over others. The X-pivot demonstrates the number of assignments and the Y-pivot shows the level of makespan. It is clear from the figure that the AWRR algorithm performs better while being contrasted and the beforehand load balancing algorithm since it accomplished a low-level of makespan in mist computing. It shows that the proposed AWRR algorithm considerably reduce the makespan than the previously used load balancing algorithm in Mist computing. Figure 5 clarified that the AWRR algorithm gives better results when contrasted with past LB calculations as it accomplished the higher ARU. It shows the ARU of the proposed strategy over others. The X-axis exhibits the number of tasks and the Y-axis shows the ARU. It is obvious from the figure that the AWRR algorithm performs better while being differentiated and the already load balancing algorithm since it achieved a high-level of ARU in mist computing. Figure 5 shows that the AWRR algorithm outperforms better while being compared with the previously load balancing algorithms because it achieved high resource utilization and low degree of imbalance. Figure 6 shows the degree of imbalance using the proposed method over others. The X-axis indicates the number of tasks and the Y-axis shows the degree of imbalance. It is evident from the figure that the AWRR algorithm performs better while being compared with the previously load balancing algorithms because it achieved a low degree of imbalance and high resource utilization. Due to the application of an effective load balancing strategy, the proposed algorithm could be able to achieve the desired degree of balance in the datacenter.
The proposed AWRR algorithm gives a better outcome when contrasted with past LB calculations as it accomplished the higher ARU and higher LBL. Subsequently, all the above outcomes have demonstrated that the AWRR algorithm performs better for makespan, ARU and LBL when contrasted with LC, RR, and WRR. Contrasting the proposed algorithm and the state-of-the-art algorithm, the exploratory outcomes demonstrated that it can lessen the makespan and decline the number of migrations and hence increase the resource utilization.
Therefore, based on the obtained results, it has been observed that the proposed AWRR algorithm meliorates the overall performance in terms of makespan, average resource utilization, and degree of imbalance.

Makespan for AWRR with the compared algorithms.

ARU for AWRR vs. previous LB algorithms.

DOI for AWRR vs. previous LB algorithms.
In this paper, a dynamic resource assignment strategy using a reinforcement learning and genetic algorithm in combination with a load balancing procedure is implemented. The proposed M2FBalancer regulates the traffic in the network continuously, collects the information about a load of each server, transfer the on-demand request, and disseminate them among available servers uniformly. The experiments are conducted, and the simulation results show that the proposed algorithm meliorated the considered QoS parameters the mist assisted cloud computing environment in terms of the average resource utilization and makespan. Hence, M2FBalancer is an effective way to establish a high utilization of resources by ensuring uninterrupted service. The simulation result outperforms better while being compared with the aforementioned algorithm for ARU, makespan, and Degree of Imbalance (DOI). The proposed work is scalable as it can be deployed in the mist servers with any number of tasks and resources by considering the conflicting QoS parameters. Moreover, our method is generic in comparison to the compared algorithms for the load balancing in IoT-Mist-Cloud continuum. The proposed method is flexible and elastic as it can tackles voluminous amount of request and balance them efficiently. In future the authors aim to extend the work by implementing a security mechanism on the mist layer. This work could be improved by using a machine learning strategy. In future work, we would plan to implement security features in IoT-mist-fog based cooperative model. The encryption and decryption mechanism could also be implemented at the cloud and mist end for data exchange for smart city applications.
