Next Generation Internet of Things Architecture Towards Distributed Intelligence: Reviews, Applications, and Research Challenges

- Increasing the implication of growing data generated by the Internet of Things (IoT) brings the focus toward extracting knowledge from sensors’ raw data. In the current cloud computing architecture, all the IoT raw data is transmitted to the cloud for processing, storage, and control things. Nevertheless, the scenario of sending all raw data to the cloud is inefficient as it wastes the bandwidth and increases the network load. This problem can be solved by Providing IoT Gateway at the edge layer with the required intelligence to gain the Knowledge from raw data to decide to actuate or offload complicated tasks to the cloud. This collaboration between cloud and edge called distributed intelligence. This work highlights the distributed intelligence concept in IoT. It presents a deep investigation of distributed intelligence between cloud and edge layers under IoT architecture, with an emphasis on its vision, applications, and research challenges. This work aims to bring the attention of IoT specialists to distributed intelligence and its role to deduce current IoT challenges such as availability, mobility,


I. INTRODUCTION
It is expected that 50 billion smart devices will be associated with the Internet [1] and the generated data will be around 500 zettabytes by 2020 [2].Recently, IoT becomes popular due to the development of Radio Frequency Identification (RFID), Wireless Networks, Bluetooth Low Energy (BLE), and sensing and actuating technologies.However, enabling IoT has many challenges that cannot be ignored such as availability, energy efficiency, security and privacy, scalability, interoperability, and reliability.Those challenges because most IoT applications are cloud-based.This means that sensor data are processed and stored on distance serves hosted on the Internet, rather than a local server.Recently, scholars are trying to solve those challenged by looking at edge computing as it is closer to end devices (e.g., smart devices and sensors) than the cloud [34].Edge computing means to enable the technologies that allow computing to be done at the edge of the network, close to the end devices.Processing data close to the end devices will help to solve the problems of latency, security, and privacy, availability and power consumption.Edge computing has the advantages of fast processing, energy efficiency, security, mobility, and heterogeneity.On the other hand, cloud computing cannot be omitted as edge computing has limited process and storage capability.Cloud computing has the advantages of large storage space, processing capabilities, data analysis, and easy access [3].Therefore, integrating edge and cloud in one model is essential to combine their features in one model for supporting IoT applications.
The current structure that combines IoT and cloud consists of three layers: cloud layer, edge layer, and end devices layer, as shown in Figure 1.The cloud layer consists of a group of connected powerful computers that can process huge and complex data.The edge layer is the middle layer between the cloud and end devices that sequel the advantages of cloud computing by offering extra services for the requirements of IoT.The last layer is the end devices layer that consists of sensors and actuators (things).In general, sensors collect the raw data from the environment and send it to the edge layer.The Gateway at the edge layer pre-processes that data by connecting cloud and end devices by different transmission protocols and forwards the data to the cloud.The cloud processes the data to obtain the Knowledge and make the decision.Thereafter, it sends the decision to the actuators at the end devices layer through the edge layer.Sending a huge amount of data to the cloud and return with the decision is an inefficient way that causes latency, availability, security, and privacy, and power consumption problems.The current ISSN: 2180 -1843 e-ISSN: 2289-8131 Vol. 12 No. 2 network architectures and technologies are not sufficient to send a huge amount of data to the cloud and return with the decision.
Nowadays, scholars are investigating processing IoT data close to the end devices layer to avoid the challenges.Many papers suggested building IoT gateway at the edge layer that can process the raw data and make the decision without sending the data to the cloud.Single-board computers such as Arduino and Raspberry Pi have acceptable computational capabilities that make them able to act as IoT gateway at the edge layer to process the raw data to make the decision [86].However, those constrained devices do not have the same computational power of the cloud to deal with the huge amount of IoT data.From here, distribute the intelligence between edge and cloud become necessary.We can define Distributed Intelligence in IoT as a paradigm that uses models, techniques, and algorithms for deciding whether to process IoT data in the edge layer, cloud layer, or both together [81], [82], [83].
Accordingly, this Work highlights the role of Distributed Intelligence models that combines the advantage of both edge and cloud layers.Distributed Intelligence distributes the intelligence over the edge and cloud layers to provide the required functionality and performance for IoT applications [35].It will enable the IoT gateway to extract most of the knowledge from the sensors' data to decide without sending unnecessary data to the cloud.Processing and deciding by IoT gateway instead of cloud will solve the problems of latency for real-time applications.In some cases, when the gateway is unable to process the data and make the decision, the cloud will make the decision.For example, turn on the heating system at a smart home, the sensors will collect the data of temperature, time, and the motion at home then send it to the IoT gateway at the edge layer.The gateway will process the data, decide to turn on/off the heating system and send the decision back to the heating system at the home.However, if the gateway is unable to make the decision (e.g the task is too complex, or the gateway is unable to process the task), the gateway will forward the data to the cloud layer.For example, if a video processing application consumes the CPU of the gateway, so the task might be offloaded to the cloud layer to be processed.This paradigm helps the gateway to still under load.
This paper is organized as follows.In the second section, we introduce the related work related to Distributed Intelligence in IoT.The following section takes a close look at the Internet of Things, cloud computing, and edge computing respectively.The fourth section represents the Distributed Intelligence in IoT.In the fifth section, we introduce some of IoT applications that highlight the need for Distributed Intelligence.In the last section, we represent the main current challenges of enabling Distributed Intelligence in IoT.To the best of our knowledge, this paper presents the first comprehensive review of Distributed Intelligence in IoT to date.

II. RELATED WORKS
In 1990, the concept "Internet of Things" was firstly introduced by Kevin Ashton, the Executive Director of Auto-ID Labs at MIT, while giving a talk for Procter & Gamble [4].During his talk, he stated that all the data available on the web were first produced by humans who have limited attention, time and accuracy.He added that we need computers that know everything about things using gathered data without any human helps.Later on, IoT has been evolved into a system using a variety of technologies such as the Internet, wireless communication, microelectromechanical systems, and embedded systems.
Nowadays, extracting knowledge from the collected raw data is one of the IoT challenges.IoT aimed to collect the raw data from the sensors, send them to the cloud for further processing.The cloud processes the data make the decision and sends it to the actuators.Many proposals applied the scenario of sending collected data from the environment to the cloud to store, manage, and make decisions [5,6,7,8,9], as it provides large storage, complex processing, and access anywhere/ anytime [10].Unfortunately, cloud-based systems cause a high level of latency for IoT applications [11,12,13].Therefore, researches started to look at the edge computing to process the data close to the things as it provides fast processing, energy efficiency, reliability, and security and privacy [14].However, it is not able to offer large storage, complex processing, and access anywhere/anytime that the cloud offers.Therefore, the solution is to integrate edge and cloud computing to benefit from their advantages for IoT applications.
In the last decade, many kinds of research discussed and proposed models of IoT and cloud integration [15,16,17,18].Researches in [15,16] demonstrate the need to integrate IoT with the cloud by presenting a deep understanding of the integration between cloud and IoT [68].They also provide an overview of the current researches related to this topic.Additionally, they mentioned the challenges and solutions points of current approaches.Babu et al. [17] presented an architectural design for integration cloud and IoT.Li et al. [18] employed the TOSCA standard for cloud service management to systematically specify the components and configurations of IoT applications.TOSCA describes the internal topology of application components and the deployment process of IoT applications.All the previously mentioned models are cloud-based which need to transfer all raw data to the cloud for processing and making the decisions.None of the previously mentioned papers discussed processing raw data collected from end devices at the edge layer to learn, make the decision, and take actions, without sending the data to the cloud.
A large amount of work is being performed in the field of enabling edge computing to process raw data generated and making the decision.Some of the work focuses on enabling the IoT gateway at the edge of the network to process and manage the raw data.Mueller et al. [19] introduced a SwissQM/SwissGate system to program, deploy, and operate wireless sensor networks.They proposed a gateway called SwissGate and apply it to smart home applications.Jong-Wang et al. [20] came up with a sensor network system that consists of one main server and several servers acting as gateways and connecting with different sensor networks.Design such a system requires a lot of configurations and high hardware costs.In another work, Bimschas et al. [21] came up with a smart gateway approach that able to execute application code.They proposed a middleware for the gateway to run different applications such as protocol translation, request caching, and intelligent caching with sensor discovery.For general IoT applications, Guoqiang et al. [22] came up with a general-purpose smart IoT gateway that supports several communication protocols to translate different sensor data and unified external interfaces fitting for flexible software development.To use smartphones as a gateway, Bian et al. [23] utilize the android phone to be a temporary used smart home gateway that can predict user behavior to shut down unused devices.This works aimed to provide a dynamic home gateway that can reduce the wasted energy of the smart home.
In healthcare IoT application domain, Shen at al. [24] presented an intelligence 6LoWPAN border router that connects the health care sensors with IP network and use a hidden Markov Model to make local decisions of health states.Stantchev et al. [25] introduced three-tier architecture (cloud, gateway, and smart items) to enable servitization for smart healthcare infrastructure.Rahmani et al. [26] also suggested an intelligence e-health IoT gateway for remote health monitors systems at the edge of the network in a threelevel architecture.The gateway can provide several services such as real-time data processing, local storage, and embedded data mining.Azimi et al. [27] presented a hierarchical computing model for IoT-based health monitoring systems based on the MAPE-K [28] computing model introduced by IBM.The model benefits of fog and cloud computing to partition and execute machine learning data analytics.
To counter the intelligence challenges in IoT gateway, Wang et al. [29] proposed a framework of smart gateway for smart homes that consists of a smart home layer, smart gateway layer, and cloud layer.While the gateway performs data collection, awareness, and reporting, the cloud stores the reported data, and adjusts the data collection and awareness policy.Rahman et al. [30] proposed a Distributed Intelligence model for IoT gateway based on belief network concept to learn, predict, and make a decision.This system starts based on a small number of predefined rules, after that, the system can change the rules based on past experiences.
In recent years, a large effort is being performed in the field of IoT gateway that is located between cloud and end devices.Although there is a large amount of work being done to enable the gateway at the edge layer, there is only a small improvement towards providing intelligence to the gateway by extracting the knowledge from the raw data at IoT gateway to make the decision locally.Furthermore, few types of research performed in collaborating between the IoT gateway and the cloud when the gateway is unable to analyze the data, make the decision and take the action.

A. Internet of Things
The IoT is a paradigm to connect an unlimited number of objects with their unique identifications anytime and anyplace using the IoT communications protocols [31].IoT objects might be mobile phones, clothing, machines, and doors.It has been involved in many fields such as smart home, intelligence health care [73], and intelligent transportation.The recent innovative developments of information and communication technologies related to ubiquitous communication [72], pervasive computing, and ambient [62] intelligence play an essential role in IoT birth [57].Ubiquitous Communication a concept in communication and computer networks [84], [85] where interconnection can be made anywhere and anytime.Pervasive computing is the improvement in smart devices including the computational feature process [42].Ambient Intelligence [49] is the ability of objects to sense and respond to the physical environment [63].Below, key technologies of IoT will be discussed.

Radio-frequency identification (RFID)
The RFID is the technology that uses radio waves to detect, identify and track an object electronically through a tag that attached to the object.It can store and/or retrieve information using electromagnetic transmission and a radio frequency (RF) compatible integrated circuit.A simple RFID system consists of RFID readers and RFID tags [50].The RFID tag can be read by the RFID reader [52] from up to several feet away and does not require being within a direct line with the reader to be tracked.A reader can scan several tags at the same time and transfer it to the server [53,76].RFID technology is widely used with different IoT applications such as smart home, public transportations, health services, and Smart Agriculture to identify things electronically [75][54].

Wireless Sensor Network (WSN)
A sensor is a device that able to detect a certain type of input from the physical object or the environment such as heat, smoke, light, motion, and pressure.In general, the sensor's output is an electrical signal that is transmitted to the data center for processing and extracting the knowledge.WSN is a group of sensors that communicate wirelessly and hop-by-hop to gather information and detect a certain event in the physical environment [74].WSN provide different beneficial data that might be used in certain applications and services.However, it faces many challenges in terms of communication and resource constraints such as short communication range, mobility, reliability, and security.

Addressing
The development of the Internet has led to interconnect objects and intelligent systems.In this case, identifying and managing objects are very essential for IoT, as it consists of a large number of objects.Addressing adds more features to IoT which are uniqueness, reliability, persistence, and scalability [26].The current IPv4 is only able to identify a group of sensors based on their geographical location [51].However, the current requirements for IoT are to identify every sensor individually based on its identification, location, or functions.IPv6 able to achieve those requirements, as it has a larger address size to address and manage IoT objects efficiently [69], the IETF standardized adaption protocol for IPv6 which is called 6LoWPAN [70].It represents by both RFCs 4944 and 6282.
6LoWPAN is a short form that combines Internet Protocol (IPv6) and Low power Wireless Personal Area Networks (LoWPAN).6LoWPAN, therefore, provides end devices with restricted processing ability to transmit information wirelessly using an Internet Protocol.It allows compression techniques to compress the IPv6 and UDP packets after deleting the excessive data from the header part [71].

Middleware
Due to the object's heterogeneity, limited storage, and processing capabilities, the middleware and application layer plays a key role [66], with the main objectives of functional abstraction and device communication [61].The middleware is categorized in layers such as object abstraction, service management, service composition and application [33].In a ISSN: 2180 -1843 e-ISSN: 2289-8131 Vol. 12 No. 2 generic IoT system, end devices usually collect specific information such as temperature, light, and pressure.This information passes through limited processing locally.Then, it is sent to the external gadget for computations.After that, it can be transmitted to the local area network until it reaches the Internet then the cloud-based services [43].The cloudbased service will convert the received data into knowledge after some processing operations [44].This knowledge might need to be stored or action needs to be performed.To support IoT, middleware [65] should handle the following challenges: interoperability between heterogeneous devices, context awareness [64], managing data, privacy and security, and device discovery [45].

B. Cloud Computing
The concept "Cloud Computing" was firstly defined as ''Cloud computing is a model for enabling ubiquitous, convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction'' [55,56,57].Over the last few years, Cloud computing started to be popular in the IT industry, as it has the advantages of unlimited storage, complex processing capabilities, and access anywhere/ anytime [46].It also provides virtual resources on demand.Leading IT companies such as Amazon, Microsoft, and Google adopted this model to provide services over the Internet [47].
Cloud services are divided into three layers as shown in figure 2: Software as a Service (SaaS), Platform as a Service (PaaS), and Infrastructure as a Service (IaaS).SaaS delivers applications running on Cloud environments through the browser to customers [58].PaaS refers to the operating environment including the operating system and software development frameworks.IaaS refers to providing instant computing infrastructure, storage, and network resources to manage the operating system, cloud applications, and cloud storage [48].

C. Edge Computing
Edge computing is a paradigm of processing data at the edge of the network close to the end devices, where the data is generated, instead of sending the data to the cloud for processing [78].The current Cloud architecture fails to handle the huge data generated by IoT devices, as it causes high latency and bandwidth utilization [79].Thus, there is a need for edge computing to optimize computing in real-time IoT applications.The edge is a layer that is located between the cloud and the data source [80].For example, a gateway in health care is the edge between health care things and the cloud.As shown in figure 1, the things at the end devices layer can be data generated or consumers.Edge can perform several tasks such as data pre-processing, local data storage, data processing and caching, and request and deliver services from the cloud [87].Edge computing has been found to improve the reliability, availability, and security and privacy of IoT applications, as the data is processed locally [59,60].

IV. DISTRIBUTED INTELLIGENCE IN IOT
Distributed Intelligence in IoT is a paradigm that uses models, techniques, and algorithms for deciding whether to process IoT data in the edge layer, cloud layer, or both together.The development of IoT applications has recently become much easier with the availability of development kits, open hardware, and software.IoT Applications also become easy to be deployed on the cloud with the availability of Platform as a service (PaaS) resources and IoT cloud services.Between the cloud and the end devices (sensors), at the edge layer, gateway (computer board such as Arduino) shortened the development, but the complication is still at the software level.Those boards are not intelligent enough to extract the knowledge from the raw data coming from sensors and make the decision [36].Figure 3 illustrates the current approach; the sensors collect the raw data from the environment around and send it to the gateway at the edge layer.Thereafter, the gateway converts between the protocols and forward the data to the cloud, Then, the cloud process the data, extract the knowledge and decide to actuate a thing or not.Finally, the cloud sends the decision to the actuator at the end devices layer.This existing approach of sending all raw data generated by end devices to cloud using an IoT gateway is not efficient as it impacts the network's reliability, availability, robustness, and security and privacy.The availability, for example, supposes we have a smart, cloud-based home system, there is a fire inside the home, and there is no Internet connection.In this case, the system will fail to connect with the cloud to process the data and take any action against the fire.Some contributions proposed a basic role for the IoT gateway [38], for example, applying predefined rules that are not efficient especially with complex IoT applications as they require many rules.IoT applications connect many things that make the intelligence by predefined rules fail to scale well.Furthermore, predefined rules not able to offer intelligence in undefined conditions as it only offers presumed intelligence [39].
On the other hand, intelligence should not only reside in the cloud.Nowadays, there is a need for providing intelligence at both the cloud and edge layers.Depending on the situation, the decision should be made either on the edge of the cloud to provide the desired functionality and performance, as shown in Figure 4.This can be applied by distributed the intelligence between edge and cloud layers [37].Distributed intelligence in IoT means to distribute the intelligence over the edge and the cloud layers to provide the required functionality and performance for IoT applications.IoT gateway at the edge layer should be able to process the raw data and make the decision and send only the necessary data to the cloud [40].The question here is how to provide the gateway with the intelligence to extract the knowledge from the raw data?Algorithms and techniques should be running on IoT gateway, the algorithms should be able to process real-time raw data and extract the knowledge to make the decision.It should be able to perform its function even with the loss of cloud connectivity.
Machine learning can be a powerful solution for processing data produced by IoT devices.Combining machine learning and IoT gateway can help to analyze the data locally and make the decision instead of sending the data to the cloud [67].It also can provide real-time prediction, security, reliability, and availability.However, many IoT gateway controllers such as Raspberry Pi and Arduino have limited processing capabilities so the gateway should use some techniques based on CPU utilization, CPU temperature, number of tasks, and type of application to determine when to offload the task to the cloud.For example, the gateway might processes only a certain number of coming tasks simultaneously and offloads the others to the cloud.
The benefits of enabling Distributed Intelligence in IoT can be summarized as the following: • Local data processing of the most real-time data for fast decision and action made.• Offload the complex tasks to the cloud.
• Reduce the data transmitted to the cloud for security and privacy purposes [41].• Enable IoT networks to be more resourceful in terms of energy and communication bandwidth.• To provide interoperability for heterogeneous platforms and communication protocols used in IoT.• Enable end devices to interact even with no connection with the cloud.

A. Smart Home
In the past, the smart home was a science fiction idea.For example, Ray Bradbury imagined homes were interactive and ran themselves.It was terrifying until the actual benefits of home automation were considered by humans, and then the idea started to be more comfortable [33].In the 19th century, many hardware and software appeared that leading up to smart home applications.Also, the X10 standard was industrialized to allow sending and receiving broadcast messages via radiofrequency.Currently, the development of computer boards such as raspberry pi, Arduino, and FPGA helps scholars to build and develop inexpensive smart home applications.For example, Raspberry Pi is a cheap, smallsized computer that plugs into an LCD, keyboard, and mouse.It has different types of communication ports such as Ethernet, USB ports, HDMI port.It can perform all the functions of a desktop computer like word processing, browsing, and playing game.
Nowadays, most of the researches related to smart home applications aims to build a comfortable, secure, accessible, safe system inside the home with consideration of minimizing operating energy and cost.Sensors are attached to all targeted home appliances to be considered smart objects.They can sense, process data, and communicate.These devices from time to time carry out sensing and perform basic data processing before sending the data to the hub, gateway or directly to the cloud.There are many challenges concerning smart home system design, but this paper only concern of Distributed Intelligence.In most of the smart home applications, all data need to be transferred to the cloud where the decision is made.This approach takes a long time and threatens security because data is shared with the outside network.Furthermore, it will impact availability if there is no Internet connection.On the other hand, some smart home applications can make the decision locally.However, those applications are predefined rules based which is impractical with complex IoT applications.As mentioned in section 4, predefined rules fail to scale well and to offer intelligence in undefined conditions.Therefore, provide the home gateway should be provided with the intelligence that able it to decide whether to make the decision locally or on the cloud.The gateway might use the following techniques to decide where to process the data: CPU utilization, CPU temperature, number of the running tasks, or type of the task.If it is locally, the gateway will be able to extract the knowledge from the raw data coming from the sensors and make the decisions without sending the data to the cloud-based on machine learning algorithms.Machine learning algorithms for processing data at the smart home gateway are required; it can make the decision and activation based on the analysis ISSN: 2180 -1843 e-ISSN: 2289-8131 Vol. 12 No. 2 of experience.
In some cases, when the gateway is unable to make the decision, it will offload the task to the cloud.For example, turn on the heating system at a smart home, the sensors will collect the data of temperature, time, and the motion at home then send it to the smart IoT gateway at the edge layer.The gateway will process the data, take the decision based on an intelligent algorithm to turn on/off the heating system and send the decision back to the heating system at the home.However, if the task consumes the CPU, the gateway will forward the data to the cloud layer.For example, a video processing task consumes the CPU, so the gateway will offload it to the cloud layer.

B. Internet of Vehicles (IoV)
The IoV is a group of applications for Information processing and sharing to ease overcrowding, enhance traffic management, reduce the environmental influence, and increase revenue for transport to business users and the public.[34].It is an advanced technology with the integration of sensors, Internet, wireless communication, protocols for exchanging information among fast speed vehicles.The traditional IoV systems with central data processing at the cloud experience have many significant challenges such as connectivity and coverage, communication and energy cost, congestion, coordination and implementation, and traffic incident notification [45].It cannot efficiently deal with realtime data [46], as each vehicle will transfer its generated data to the cloud through the Internet.A large number of vehicles will produce a huge amount of data that will impact the network.Furthermore, the traditional system may cause privacy problems because the current location of vehicles is shared.They also share the beginnings and journey's end of tours with the cloud server [46].Moreover, suppose there are several cars at a certain street contacting the cloud to avoid the traffic, the cloud will ask all those cars to move to a street that is parallel to the first one.This will shift the traffic from one street to another.
The IoV should be able to process real-time data efficiently without sending all of them to the cloud as shown in Figure 5.This can be achieved by bringing part of the intelligence to the edge layer and make it able to decide by extracting the knowledge from raw data collected from sensors.Each vehicle has to be attached to a smart gateway that connects it with other vehicles in the same area to share the data about road and traffic conditions.The gateway should be provided with the intelligence to process the data and make the decision.Applying this scenario will improve the availability of the system, as it will be able to make the decision even with no connection with the cloud.
Enabling Distributed Intelligence between the cloud and a smart gateway in IoV will reduce the delay and enhance the safety of IoV applications.One case is re-routing vehicles in a traffic management system for congestion avoidance needs the information to be shared between vehicles from different road areas [77].The smart gateway attached to the vehicle should collect the data of the traffic condition and negotiate with the other gateways of vehicles on the road to decide to either re-route the vehicle or not.Although Distributed Intelligence will improve the performance of IoT applications, there are many research challenges and questions regard enabling it.This section illustrates the challenges of enabling Distributed Intelligence between cloud computing and edge computing with some suggested solutions.Such as how the gateway and the cloud interact with each other?Which tasks should be offloaded to the cloud?which techniques determine to either process the task locally or offload it to the cloud?

A. Single board computer capabilities
Nowadays, single board computers have been developed rapidly.However, they still have limited computations and storage capabilities that impact their role to be a gateway between the end devices and the cloud layers, as end devices generate a huge amount of data that requires processing.The gateway has to be robust and flexible to take care of several issues such as data processing, data management, security, and QoS.It is challenging to accomplish all the tasks instantaneously using current resource-constrained single board computers.Thus, the solution is to offload certain tasks to the cloud for processing and making the decision.Offloading techniques will keep the gateway under load and perform their jobs properly.

B. IoT Gateway Platform issues
The software frameworks at the gateway level still have challenges in processing raw data locally and make the action.An intelligence algorithm should be implemented in the platform to be able to process data based on learning from experience.Combining IoT and machine learning is essential to provide intelligence at the gateway to learn from experience.Many machine learning algorithms can play an essential role in processing IoT data such as decision trees, deep learning, and reinforcement learning.

C. Tasks Management
Distributed Intelligence aims to distribute the tasks between the gateway and the cloud.The question here is which factors govern the distribution of tasks?The computation tasks can be distributed in two scenarios.The first one is to process simple tasks locally in the gateway and offload complex tasks to the cloud.The second one is to use system metrics of the gateway such as CPU and RAM utilization to decide either to offload the task or process the tasks locally.For example, when the CPU utilization of the gateway is over 75%, offload all-new coming tasks to the cloud.

VII. CONCLUSION
This work has presented a deep investigation of Distributed Intelligence under IoT.It is a paradigm to distribute the intelligence over the edge and cloud layers to provide the required functionality and performance for IoT applications.Distributed Intelligence in IoT plays an important role to support the exact communication and processing functions to be offered at the exact place at a certain time.This can be achieved by integrating cloud and edge computing in one model and provide the edge with a smart gateway that has two main jobs: firstly, decide to process the data locally or send it to the cloud.Secondly, process the local data to extract the knowledge and make the decision.Distributed Intelligence in IoT is related to Artificial intelligence, IoT, and Cloud Computing.Therefore, corporations between the scholars of those areas should be started to propose and standardize certain Distributed Intelligence paradigms for the popular IoT applications such as smart homes, intelligence of vehicles, and intelligence watering system.

Figure 3 :
Figure 3: Existing Model of the integration between Cloud and IoT