**Abstract**

Internet applications generate massive amount of data. For processing the data, it is transmitted to cloud. Time-sensitive applications require faster access. However, the limitation with the cloud is the connectivity with the end devices. Fog was developed by Cisco to overcome this limitation. Fog has better connectivity with the end devices, with some limitations. Fog works as intermediate layer between the end devices and the cloud. When providing the quality of service to end users, scheduling plays an important role. Scheduling a task based on the end users requirement is a tedious thing. In this paper, we proposed a cloud-fog task scheduling model, which provides quality of service to end devices with proper security.

**Keywords:** ANN, fuzzy logic, fog computing, IoT, QoS, K-means clustering

## **1. Introduction**

Cloud computing is very popular in the technology world as it provides numerous useful services to end users. Cloud computing is based heavily on virtualization technology. Cloud computing provides many features such as huge processing power, great storage provision, and pay-per-use model. Cloud computing has many desirable features such as flexibility, scalability, performance-cost efficiency, and ease of test, adopting and deploying new technologies [1].

In spite of all these services, there are some drawbacks of cloud computing that cannot be ignored. For examples, the cloud and users are physically far away from each other that induce intolerably delay, again there can be a shortage of resources for executing the tasks, many resources could remain idle even though tasks need to be processed, etc. [1].

Internet of Things (IoT) is an emerging technology. It requires latency-aware computation for real-time application processing. In IoT environments, devices connected to it generate a huge amount of data, which are generally referred to as big data. IoT devices generated data are generally processed in a cloud infrastructure because of the on-demand services and scalability features of the cloud computing. However, processing IoT application requests on the cloud is not an efficient solution for some IoT applications, especially time-sensitive ones. To address this issue, Fog computing, which is a middle layer between cloud and IoT devices, was proposed. In Fog computing environment, IoT devices are connected to Fog devices. These Fog devices are located in close proximity as compared to cloud to users and are responsible for intermediate computation and storage [2].

There are many challenges when we are working in fog computing environment. One of the challenges is task scheduling. Tasks are broadly classified into two

category, dependent task and independent task. While performing task scheduling in fog, the category of tasks plays a vital role.

Task scheduling depends on the many criteria based on user's requirements. For example, healthcare-related task. In such type of task time is a vital factor. Delay in such type of task is not acceptable, so to manage such type of tasks, many task scheduling algorithms have been proposed. Task scheduling involves scheduling of resources, such as CPU, memory. Depending on the type of task, algorithm may varies. The basic idea behind task scheduling is to give the user QoS (Quality of Service).

### **2. Literature review on task scheduling in fog-cloud environment**

Author in [3] have used Q learning algorithm in cloud computing for allocating the task to the virtual machine. In this paper, we have compared their algorithm with FIFO, greedy, random, mix algorithm. The proposed model is divided into three parts: tasks transmission, task allocation, and task execution.

Resource Management and task scheduling are very important tasks in cloud. The traditional scheduling algorithm has low resource utilization and more response. Rather than using single scheduling algorithm, multiple scheduling algorithms are used. The selection of one of the scheduling algorithm is done using machine learning classification. Six scheduling algorithms are considered here. FCFS, priority scheduling conservative migration supported backfilling, aggressive migration supported backfilling, and priority-based consolidation. Selection of particular algorithm based on environment and task is done using machine learning classification [4].

Two reinforcement schedulings were introduced for resource scheduling, online resource scheduling deepRM2 and offline resource scheduling DeepRM\_off. Then the comparison of these two algorithms has done with the DeepRM and the heuristic algorithm. Two resources are considered in this CPU and memory. Image is given as input for training process [5].

Three approaches for tasks scheduling are discussed and compared in this paper. PSO algorithm, genetic algorithm, modified PSO algorithm. Modified PSO algorithm is nothing but the old PSO with the merging of SJFP for generating initial population in order to minimize makespan. The result shows that the modified PSO outperforms the other two algorithms [6].

Author in [7] suggested a new technique to schedule the Jobs or tasks in Big Data cluster. The uniqueness of this proposed method is that it basically focuses on the resources utilization and the type of Scheduled job altogether. The clusters used for experimentation of the proposed method are homogeneous. The given algorithm assigns task to the data node based on the type of job and based on the data node resource load.

K-means clustering algorithm is used for grouping the virtual machine and task [8]. The categorization of virtual environment is done on the basis of available application in each machine. Four parameters are considered for task selection, task length, user priority, deadline, and cost. K-means clustering technique is used for virtual machine as well as for task.

To select a proper task scheduling algorithm for better performance in cloud computing is a critical task. Author in [9] suggested a Framework for the above problem. Author suggested that the decision of which task scheduling algorithm is suitable for a particular task should be taken by machine learning algorithm.

The Basic concept in [10] is distribution of task to different fog nodes. The proposed approach performance is compared with PSO and GA. The proposed

#### *An Adaptive Task Scheduling in Fog Computing DOI: http://dx.doi.org/10.5772/intechopen.108785*

approach divides the complete task into two part reproduction behavior, food source foraging behavior. The implementation of BLA is done in C ++. The proposed algorithm outperforms in terms of CPU execution time, allocation of memory, and therefore, the cost function. The limitation of this approach was it does not give any solution on dynamic job scheduling, and again here they consider stationary fog servers.

Author in [11] proposed test and selection technique to select the best algorithm for scheduling. The hyper-heuristic algorithm is divided into two phases, training phase and testing phase. The basic objective is to find out the best algorithm for workflow scheduling. The author [11] considered four algorithms for the purpose of selection, genetic algorithm, particle Swarm Optimization, ant Colony Optimization, and annealing algorithm. FogSim is used for fog computing environment, and cloud SIM is used for cloud environment.

Author in [12] suggested Ant colony algorithm for scheduling. The tasks are grouped according to two criteria, minimum cost and minimum end time service. Also the prioritization of task is done based on the above two criteria. The ant Colony algorithm is used to select optimal virtual machine for executing the task.

The main focus is on multi-resource fairness in task and to achieve ultralow task latency for fog computing system. Author in [13] proposed fair TS online test scheduling model. Author uses DRL technique to gain experience and based on that the Fair TS model is developed. Researchers [13] claim that their model balances the time and resources. The main challenge of this paper is to perform online task scheduling. The number of tasks is already fixed. For multi-resource fairness in fog computing system dominant resource fairness policies are adopted.

Different fog node has different processing abilities, for example, strong fog node with considerable resources can solve the complex problem easily. But such type of scenario development is a problem in task scheduling. This problem is addressed in this paper. A new task scheduling strategy is suggested in this paper. Hybrid heuristic algorithm is proposed for tasks scheduling. The hybrid heuristic algorithm is combination of two algorithms, improved particle Swarm Optimization and improved ant Colony Optimization [14].

Issues related to mobile crowd sensing task in fog computing are discussed. A deep reinforcement scheduling solution is provided to solve this problem. It is a selfadaptive model. Three-layer hierarchical structure of fog computing is discussed. To solve task scheduling problem in fog computing, a task scheduler is added in the cloud layer to decide the scheduling strategy for fog computing [15].

Three-layered structure is introduced: terminal layer, which consists of mobile devices; fog layer, which consists of task scheduling cluster and resource integration model; core layer composed of cloud resource provider. Scheduling is done in the middle layer. A new scheduling method was introduced "I-FASC" to determine the characteristics of task and resources. An improved genetic algorithm is proposed, which is an improvement over the firework algorithm, which introduced the explosion radius detection mechanism of Fireworks to avoid disappearance of optimal solution [16].

The problem with delay-sensitive application such as smart health required to transfer large amount of data to cloud, so it reduces the performance. To resolve that, fog computing is introduced. But in fog, there should be some mechanism to manage the task and resource as well as security. To achieve this, a cost-aware genetic-based task scheduling algorithm is proposed [17].

Two characteristics of Intelligence are considered, device-driven and humandriven in IOT-based computing scenario. For demonstration purposes, two cases are considered. The first case machine learning algorithm is used to study the human behavior based on that scheduling is done that is identifying the priority of the task whether the task is important or not, and if it is important in that case, give

the resource to that task. In second case, an algorithm is designed for the end user device to select the offloading decision, that is, to identify whether to process the task or discard it to minimize energy consumption of fog node and to minimize the latency [18].

In the three-tier architecture, the end devices are at the lowest level, fog is the intermediate layer, and the top most layers consist of cloud. Intelligent virtual machine is created by using Bayesian method to classify task. The FBCS algorithm outperforms when compared with the FCFS and delay priority algorithm. Two algorithms are designed: first for task classification and second for updating processing power of the device [19].

When we are talking about scheduling in cloud computing that basically means we are focusing on how to improve the use of resources and reduce the time to complete a job. The cost to do certain job depends on time and exchange of data. To reduce the cost of the user, decrease the volume of data sent to the cloud. This was the main idea behind the creation of fog. The IoT devices can connect to the cloud through fog nodes [20] .

The tasks are scheduled based on lower delay. In this paper, the problem related to task scheduling in fog computing is discussed. The dynamic scenario resulted from user mobility brings a dynamic computing demand at edge devices. The scheduling strategies should be designed based on the different application classes according to demand coming from the mobile user [21].

A metaheuristic algorithm based on a Harris Hawk Optimization based on a local search strategy for task scheduling in fog computing is proposed to improve the quality of service provided to the user in industrial IoT application [22].

For scheduling purpose, an optimized knapsack algorithm is proposed, which is based on symbiotic organism search algorithm [23].

An improved apriori algorithm "I-Apriori" is proposed based on apriori algorithm. A novel task scheduling TSFC algorithm is proposed. The association rules are generated by the I-apriori algorithm. The TSFC algorithm is based on I-apriori algorithm [24].

Tasks scheduling problem is discussed to reduce the cost of Edge computing sys-tem. The focus of this paper is to minimize the cost while satisfying the delay requirement of the entire task. For that a two-star scheduling cost Optimization algorithm is proposed (TTSCO) [25].

The focus of this paper is on how to reduce the power consumption in edge computing while meeting the resource and delay constraints [26].

Task scheduling algorithm based on delay model is suggested. Others claim that the delay model based on little's law is in accurate. So the authors suggest a delay model without using little's law. Then a life Lyapunov function of delay is defined based on that a task scheduling algorithm is proposed to minimize the delay [27].

The focus [28] is to provide the quality of service to the user and to improve the performance of scheduling. An application-aware scheduling algorithm is proposed.

A scheduling algorithm for cloudlet for utilization of the available resources is suggested. The proposed algorithm is based on ant Colony Optimizations algorithm [29].

Quality of service was the main motive behind a grouped tasks scheduling algorithm. The GTS algorithm divides the task into categories. User task, task latency, task size, task type are the parameters used for categorizing a task. GST first chooses which category to be executed and then chooses the task with minimum time to be executed in the category [30].

A new scheduling algorithm is proposed, FCAP. This new algorithm is combination of two algorithms: Fuzzy C-means clustering algorithm and PSO *An Adaptive Task Scheduling in Fog Computing DOI: http://dx.doi.org/10.5772/intechopen.108785*

particle Swarm Optimization algorithm. FCAP is used to cluster the resources. The main idea behind this algorithm is to provide quality of service to the users [31].

A reinforcement learning agent is proposed that horizontally scales container's instances based on the demand of user and available fog resources. FScalar is integrated in kubernetes cluster architecture. Also the use of SARSA to build a scalar agent is proposed [32].

Author in [2] studied the current trend of fog computing as well as the architecture of fog computing. Author also explained the limitation of such architecture and pointed out the deployment issue of services in fog. Efficiently placing a new service without affecting the running one is the biggest problem with the fog architecture.

RSU (roadside unit) acts as an immobile fog node. The responsibility of RSU is request processing and decision-making for task scheduling. Author in [33] investigated the tasks scheduling and resource allocation from the viewpoint of serviceoriented architecture (SOA). Tasks scheduling is based on scheduling chain.

A novel energy efficient fog computing Framework is proposed by the author. The homogeneous fog network is considered for framework. The main focus of the paper is on Energy Efficiency for task scheduling. Author in [34] Suggested maximum energy-efficient task scheduling algorithm MEETS in homogeneous fog network.

Parallel execution of tasks in heterogeneous fog network is suggested. New concept PE processing efficiency is defined, which includes computing resources and communication capabilities. DATS algorithm is introduced to minimize the service delay in heterogeneous fog network. The two key components of DATS are PCRC (progressive computing resource competition) to obtain stable resource allocation result and second is STS (synchronize task scheduling) [35].

An adaptive multi-objective Optimization testing task scheduling method for fog computing is proposed. The two objectives of these proposed algorithms are task scheduling and resource scheduling with minimum task execution time and resource cost [36].

A new concept is introduced [37], "region". Region is nothing but the collection of fog node. Basically the fog nodes are divided into region based on the requirement of the user. A task scheduling algorithm for region-based cloud (FBRC) is proposed [37].

A best selection of fog device for offloading the task by considering the time and energy consumption is a very serious challenge. To address this problem, a module placement method by classification and regression tree algorithm is proposed. The parameters for selecting the best fog node for the task are authenticity, integrity, confidentiality, speed, cost, capacity, and availability. Model placement is based on Markov chain process [38].

A tool kit that can automatically simulate the complex network topology and different type of computing resources as well as automatically execute user submitted workflow application and compare the performance of different computation offloading and task scheduling strategy for workflow is suggested [39].

A Ranking-based task scheduling algorithm using linguistic and fuzzy quantified in fog cloud network preposition is proposed. This algorithm is compared with distance-based algorithm, price-based algorithm, and latency-based algorithm [40].

Load balancing in cloud and fog is suggested in this paper. Cuckoo search by using levy walk distribution and flower pollination is proposed for load balancing. The motto is to reduce the delay and to overcome the latency issue [41].

The task is assigned with the priority depend on the deadline of the task. Preemption of the task is not possible after assigning it to the particular fog node [42].


#### *Search Algorithm - Essence of Optimization*

