Fog Computing and the Internet of Things: A Review

: With the rapid growth of Internet of Things (IoT) applications, the classic centralized cloud computing paradigm faces several challenges such as high latency, low capacity and network failure. To address these challenges, fog computing brings the cloud closer to IoT devices. The fog provides IoT data processing and storage locally at IoT devices instead of sending them to the cloud. In contrast to the cloud, the fog provides services with faster response and greater quality. Therefore, fog computing may be considered the best choice to enable the IoT to provide efficient and secure services for many IoT users. This paper presents the state-of-the-art of fog computing and its integration with the IoT by highlighting the benefits and implementation challenges. This review will also focus on the architecture of the fog and emerging IoT applications that will be improved by using the fog model. Finally, open issues and future research directions regarding fog computing and the IoT are discussed.


Introduction
The Internet of Things (IoT) is one of the spotlight innovations which has the potential to provide unlimited benefits to our society.The development of the IoT is about to reach a stage at which many of the objects around us will have the ability to connect to the Internet to communicate with each other without human intervention [1].Originally, the IoT was intended to reduce human data entry efforts and use different types of sensors to collect data from the environment and permit automatic storage and processing of all these data [2,3].
As the IoT is characterized by limited computations in terms of processing power and storage, it suffers from many issues such as performance, security, privacy and reliability.The integration of the IoT with the cloud, known as the Cloud of Things (CoT), is the right way to overcome most of these issues [4].The CoT simplifies the flow of IoT data gathering and processing and provides quick, low-cost installation and integration for complex data processing and deployment [4,5].
The integration of IoT with cloud computing brings many advantages to different IoT applications.However, as there are a large number of IoT devices with heterogeneous platforms, the development of new IoT applications is a difficult task [5].This is because IoT applications generate huge amounts of data from sensors and other devices.These big data are subsequently analyzed to determine decisions regarding various actions.Sending all these data to the cloud requires excessively high network bandwidth [5].To overcome these issues, fog computing comes into play.
The term fog computing was coined by Cisco [6].It is a new technology that provides many benefits to different fields, especially the IoT.Similar to the cloud, fog computing provides services to IoT users such as data processing and storage.Fog computing is based on providing data processing capabilities and storage locally to fog devices instead of sending them to the cloud.Both the cloud and fog provide storage, computing and networking resources [7].
The purpose of fog computing in the IoT is to improve efficiency, performance and reduce the amount of data transferred to the cloud for processing, analysis and storage.Therefore, the data collected by sensors will be sent to network edge devices for processing and temporary storage, instead of sending them into the cloud, thus reducing network traffic and latency [8].
The integration of fog computing with the IoT creates a new opportunity for services, which is called fog as a service (FaaS), where a service provider builds an array of fog nodes across its geographic footprint and acts as a landlord to many tenants from many vertical markets.Each fog node hosts local computation, networking and storage capabilities [9].FaaS will enable new business models to deliver services to customers.Unlike clouds, which are mostly operated by large companies who can afford to build and operate huge data centers, FaaS will enable big and small companies to deploy and operate private or public computing, storage and control services at different scales to meet the needs of a wide variety of customers [10].
This paper provides an overview of the integration of fog computing with the IoT; this involves an investigation of the fog state-of-the-art, characteristics and benefits.The integration of the IoT with fog computing is also discussed by highlighting the integration benefits, emerging IoT applications and challenges encountered.Related models and articles that discuss the integration of the IoT with the fog are described.Open research issues regarding the IoT and fog computing are also discussed.
Compared to other surveys conducted on fog computing, which will be discussed in Section 4, this paper focuses on providing a review of fog computing in the context of the IoT.The contribution of this paper can be summarized as follows:

•
Discussing recent articles which investigate the integration of fog computing with different IoT applications.

•
Investigating IoT challenges and how they will be resolved by integrating the IoT with fog computing.

•
Providing various IoT applications that benefit from the integration of the fog with the IoT.

•
Discussing the challenges that result from integrating the IoT with fog computing.

•
Discussing future research directions regarding fog computing and the IoT.
The rest of this paper is structured as follows: Section 2 presents the challenges of integrating the IoT with cloud computing; Section 3 presents fog computing with its characteristics, architecture and benefits; Section 4 introduces integration of the fog with the IoT by discussing related works that discuss the convergence of the IoT with fog computing; Section 5 provides different IoT applications that rely on fog computing; Section 6 discusses the challenges facing the integration of the fog with the IoT; Section 7 presents open issues; and finally, Section 8 is the conclusion.

Challenges of the Cloud of Things
The integration of the cloud with the IoT, known as CoT, has many benefits.For instance, it helps to manage IoT resources and provides more cost-effective and efficient IoT services.In addition, it simplifies the flow of the IoT data and processing and provides quick, low-cost installation and integration for complex data processing and deployment [4,11].
The CoT paradigm is not straightforward, it also introduces new challenges to the IoT system that cannot be addressed by the traditional centralized cloud computing architecture, such as latency, capacity constraints, resource-constrained devices, network failure with intermittent connectivity and enhanced security [12].
In addition, the centralized cloud approach is not appropriate for IoT applications where operations are time-sensitive, or Internet connectivity is poor.There are many scenarios where milliseconds can have serious significance, such as telemedicine and patient care.This is the same scenario for vehicle-to-vehicle communications, where avoiding collisions or accidents cannot tolerate the latency caused by the centralized cloud approach [8].Therefore, an advanced cloud computing paradigm that improves the capacity and latency constraints is required to handle these challenges [5].Cisco suggested new technology called fog computing to address most of these challenges [6].

Fog Computing
This section provides an overview of fog computing, its characteristics, benefits and architecture.

Definition of Fog Computing
Fog computing is a paradigm with limited capabilities such as computing, storing and networking services in a distributed manner between different end devices and classic cloud computing.It provides a good solution for IoT applications that are latency-sensitive [13].
Although the term was originally coined by Cisco [6], fog computing has been defined by many researchers and organizations from a number of different perspectives.Yi et al. [14] have provided a general definition of fog computing.It is stated as; "Fog Computing is a geographically distributed computing architecture with a resource pool which consists of one or more ubiquitously connected heterogeneous devices (including edge devices) at the edge of network and not exclusively seamlessly backed by Cloud services, to collaboratively provide elastic computation, storage and communication (and many other new services and tasks) in isolated environments to a large scale of clients in proximity" [14].Whilst, Vaquero and Rodero-Merino [15] defined fog computing as; "a scenario where a huge number of heterogeneous (wireless and sometimes autonomous) ubiquitous and decentralized devices communicate and potentially cooperate among them and with the network to perform storage and processing tasks without the intervention of third parties.These tasks can be for supporting basic network functions or new services and applications that run in a sandboxed environment.Users leasing part of their devices to host these services get incentives for doing so".
Fog computing is also defined by the OpenFog Consortium [16] as; "a system-level horizontal architecture that distributes resources and services of computing, storage, control and networking anywhere along the continuum from Cloud to Things".

Characteristics of Fog Computing
Essentially, fog computing is an extension of the cloud but closer to the things that work with IoT data.As shown in Figure 1, fog computing acts as an intermediary between the cloud and end devices which brings processing, storage and networking services closer to the end devices themselves.These devices are called fog nodes.They can be deployed anywhere with a network connection.Any device with computing, storage and network connectivity can be a fog node, such as industrial controllers, switches, routers, embedded servers and video surveillance cameras [13,17].Fog computing is considered to be the building blocks of the cloud.According to Ai et al. [5] and Yi et al. [14], the characteristics of fog computing can be summarized as follows:

•
Location awareness and low latency: Fog computing supports location awareness in which fog nodes can be deployed in different locations.In addition, as the fog is closer to end devices, it provides lower latency when processing the data of end devices.

•
Geographical distribution: In contrast to the centralized cloud, the services and applications provided by the fog are distributed and can be deployed anywhere.

•
Scalability: There are large-scale sensor networks which monitor the surrounding environment.
The fog provides distributed computing and storage resources which can work with such large-scale end devices.

•
Support for mobility: One of the important aspects of fog applications is the ability to connect directly to mobile devices and therefore enable mobility methods, such as locator ID separation protocol (LISP) which needs a distributed directory system.

•
Real-time interactions: Fog computing applications provide real-time interactions between fog nodes rather than the batch processing employed in the cloud.

•
Heterogeneity: Fog nodes or end devices are designed by different manufacturers and thus come in different forms and need to be deployed according to their platforms.The fog has the ability to work on different platforms.

•
Interoperability: Fog components can interoperate and work with different domains and across different service providers.

•
Support for on-line analytics and interplay with the cloud: The fog is placed between the cloud and end devices to play an important role in the absorption and processing of the data close to end devices.

Benefits of Fog Computing
Fog computing expands the cloud computing model to the edge of the network.Although the fog and the cloud use similar resources (networking, computing and storage) and share many of the same mechanisms and attributes (virtualization, multi-tenancy), fog computing brings many benefits for IoT devices [18].These benefits can be summarized as follows:

•
Greater business agility: With the use of the right tools, fog computing applications can be quickly developed and deployed.In addition, these applications can program the machine to work according to the customer needs [17].

•
Low latency: The fog has the ability to support real-time services (e.g., gaming, video streaming) [19].

•
Geographical and large-scale distribution: Fog computing can provide distributed computing and storage resources to large and widely distributed applications [19].

•
Lower operating expense: Saving network bandwidth by processing selected data locally instead of sending them to the cloud for analysis [17].

•
Flexibility and heterogeneity: Fog computing allows the collaboration of different physical environments and infrastructures among multiple services [20].

•
Scalability: The closeness of fog computing to end devices enables scaling the number of connected devices and services [19].

Architecture of Fog Computing
Fog computing is an approach that takes some of a data centre's operations to the edge of the network.The fog provides limited computing, storing and networking services in a distributed manner between end devices and the classic cloud computing data centres.The primary objective of fog computing is to provide low and predictable latency for time-sensitive IoT applications [21].
According to Mukherjee et al. [22], Aazam and Huh [11,23] and Muntjir et al. [24], the architecture of fog computing consists of six layers-physical and virtualization, monitoring, pre-processing, temporary storage, security and transport layer-as shown in Figure 2. The physical and virtualization layer involves different types of nodes such as physical nodes, virtual nodes and virtual sensor networks.These nodes are managed and maintained according to their types and service demands.Different types of sensors are distributed geographically to sense the surroundings and send the collected data to upper layers via gateways for further processing and filtering [18].While at the monitoring layer, resource utilization, the availability of sensors and fog nodes and network elements are monitored.All tasks performed by nodes are monitored in this layer, monitoring which node is performing what task, at what time and what will be required from it next.The performance and status of all applications and services deployed on the infrastructure are monitored [22].In addition, the energy consumption of fog nodes is monitored; since fog computing uses many devices with different levels of power consumption, energy management measures can be both timely and effective [22,23].
The pre-processing layer performs data management tasks.Collected data are analyzed and data filtering and trimming are carried out in this layer to extract meaningful information.The pre-processed data are then stored temporarily in the temporary storage layer.When the data are transmitted to the cloud, they no longer need to be stored locally and may be removed from the temporary storage media [23,24].
In the security layer, the encryption/decryption of data comes into play.In addition, integrity measures may be applied to the data to protect them from tampering.Finally, in the transport layer, the pre-processed data are uploaded to the cloud to allow the cloud to extract and create more useful services [23,24].For efficient power utilization, only a portion of collected data is uploaded to the cloud.In other words, the gateway device connecting the IoT to the cloud processes the data before sending them to the cloud.This type of gateway is called a smart gateway [25].Data collected from sensor networks and IoT devices are transferred through smart gateways to the cloud.The data received by the cloud is then stored and used to create services for users [11].Based on the limited resources of the fog, a communication protocol for fog computing needs to be efficient, lightweight and customizable.Therefore, choosing the communication protocol depends on the application scenario of the fog [26].

Fog Computing with IoT
The current centralized cloud computing architecture is facing severe challenges for IoT applications.For instance, it cannot support IoT time-sensitive applications such as video streaming, gaming and augmented reality [27].In addition, it lacks location awareness as it is a centralized model.Fog computing is able to address these challenges.Table 1 summarizes differences between cloud and fog computing.Fog computing acts as a bridge between IoT devices and large-scale cloud computing and storage services.According to Cisco [17], fog computing is a part of the cloud computing paradigm that takes the cloud closer to the edge of the network.It provides a highly virtualized model of computation, storage and networking resources between end devices and classical cloud servers [28].
To increase the efficiency of IoT applications, most of the data generated by these IoT objects/devices must be processed and analyzed in real-time [29].Fog computing will bring cloud networking, computing and storage capabilities down to the edge of the network, which will address the real-time issue of IoT devices and provide secure and efficient IoT applications [30].
Fog computing provides different services and applications with widely distributed deployments.The fog has the ability to provide efficient real-time communication between different IoT applications, such as connected vehicles, through the proxy and access points positioned according to long highways and tracks.Fog computing is considered to be the best choice for applications with low latency requirements such as video streaming, gaming, augmented reality, etc. [31].
The integration of fog computing with the IoT will bring many benefits to various IoT applications.The fog supports real-time interactions between IoT devices to reduce latency, especially for time-sensitive IoT applications.In addition, one of the important features of fog computing is the ability to support large-scale sensor networks, which is a big problem with the ever-growing number of IoT devices, which will soon be counted in billions.Fog computing can provide many benefits to various IoT applications, as shown in Figure 3. Fog computing can provide effective ways to overcome many limitations of existing computing architectures that rely only on computing in the cloud and on end-user devices that are related to IoT devices.
According to M. Chiang and T. Zhang [10], fog computing can solve many of IoT challenges as described in Table 2.
Table 2. Fog computing provides new solutions to many IoT challenges.

Latency constraints
The fog performs all computation operation such as managing and analyzing data and other time-sensitive actions close to end users, which is the ideal solution to meet latency constraints of some of IoT applications.

Network bandwidth constraints
Fog computing enables hierarchical data processing along the cloud to IoT devices.This allows data processing to be carried out depending on application demands, available networking and computing resources.This, in turn, reduces the amount of data required to be uploaded to the cloud, which will save network bandwidth.

Resource-constrained devices
Fog computing can be used to perform operations that need huge resources on behalf of resource-constrained devices when such operations cannot be uploaded to the cloud.Therefore, this allows reducing devices' complexity, lifecycle costs and power consumption.

Uninterrupted services
Fog computing can run independently to ensure continuous services even when it has irregular network connectivity to the cloud.

IoT security challenges
Resource-constrained devices have limited security functions; therefore, fog computing acts as the proxy for these devices to update the software of these devices and security credentials.The fog can also be used to monitor the security status of nearby devices.
This section describes articles which discuss the convergence of the IoT with fog computing.As fog computing is still a recent research topic, there is a lack of concrete solutions supporting this computing paradigm.In this section, we survey existing works that discuss the integration of fog computing with the IoT in various applications.
There are related survey papers that cover different aspects of fog computing.For instance, K. Saharan and A. Kumar [32] have provided a survey of fog computing compared to cloud computing.They discussed the characteristics and motivation of fog computing and its applications for the IoT.Furthermore, S. Yi et al. [33] have provided a survey of fog computing by discussing different application scenarios for fog computing and various issues that might arise while implementing such systems.Also, Y. Shi et al. [21] have discussed the essential characteristics of fog computing in healthcare systems.
N. Peter [7] has discussed fog computing and its real-time applications.This paper shows that fog computing has the ability to handle big the data created by IoT devices.In addition, it showed that fog computing can address issues regarding congestion and latency.The paper also demonstrated that the fog can support an intelligent platform to manage the distributed and real-time nature of emerging IoT infrastructures and develop new services at the network edge; which in turn result in the creation of new business models and opportunities for network operators.M. Chiang and T. Zhang [10] presented an overview of the integration of the fog with the IoT.They started by discussing new issues in evolving IoT systems and how difficult it is to resolve these issues with current computing and networking models.The paper then discussed the necessity for a new architecture for computing, storage and networking and how this architecture can be used to create new business opportunities.The authors also discussed the characteristics of this fog architecture and its advantages and suggested solutions for some IoT challenges.
C. Puliafito et al. [34] investigated the issue of mobility support in a fog computing environment, focusing on mobile IoT devices and investigated the main challenges that will be faced.In addition, they identified and described three scenarios of the integration between the IoT and fog computing in which mobility support is essential.
Some related papers have discussed reference architectures of fog computing.For example, Dastjerdi et al. [35] presented a reference architecture model for fog computing.This model serves IoT requests in the local fog rather than involving the cloud.In the proposed reference architecture, central fog services are placed in a software-defined resource management layer [36].This provides a cloud-based middleware which prevents fog colonies from acting in an autonomous way.Instead, fog cells are analysed, orchestrated and monitored by the cloud-based middleware.Furthermore, F. Bonomi et al. [20] investigated the integration of the IoT with fog computing by examining key aspects of fog computing and how the fog complements and extends cloud computing.In addition, they proposed an hierarchically-distributed architecture for the fog.To test the characteristics of their architecture, they provided use cases for a smart traffic light system and wind farm.
Some related papers have presented resource management for fog computing.For example, M. Aazam and E. Huh [23] have provided a model for the management of resources through fog computing.This model uses resource prediction and resource allocation to manage resources in a realistic and dynamic way.They argued that their work can be a good benchmark towards more realistic research and development related to the IoT and fog computing and can adapt to different requirements of cloud service providers.In addition, O. Skarlat et al. [31] proposed a framework for fog resource provisioning.They formalized an optimization problem to provide delay-sensitive utilization of available fog-based computational resources.They evaluated their framework which results in a decrease in delays using a comparison with existing models.
Other related papers have discussed proposed frameworks and models for fog computing.F. Bonomi et al. [16] have proposed a fog computing platform.They argued that their platform is the best approach to support resource-constrained IoT devices.In addition, they provided three motivation scenarios including connected car, smart grid and wireless sensor networks (WSNs) to demonstrate that their fog platform can be used with different services and applications.Moreover, Hong et al. [37] presented a mobile fog (MF), which has the ability to distribute IoT applications across several devices in an hierarchical system architecture from the network edge to the cloud.The MF uses a dynamic node discovery process to combine devices together in parent-child associations where parent nodes use their computation resources to process the data received from child nodes.MFs provide several advantages to IoT applications as they can aggregate and process data locally at the network edge.In addition, MFs support load balancing between parent nodes so that child nodes are associated with underloaded parents, which improves overall system scalability.
A. Yousefpour et al. [38] have proposed a framework to understand, evaluate and model service delays in IoT-fog-cloud application scenarios.They proposed a delay minimizing policy for fog nodes to minimize service delay for the IoT nodes.The proposed policy employs fog-to-fog communication to reduce service delay by sharing the load.For computation offloading, the policy considers not only queue lengths but also different request types that have a variety of processing times.The authors also developed an analytical model to evaluate the service delay in IoT-fog-cloud scenarios in detail and performed extensive simulation studies to support the model and the proposed policies.In the same way, V. Gazis et al. [39] presented key challenges brought on by the industrial IoT and identify the main enabling technologies relevant to the fog computing paradigm.In addition, they proposed an adaptive operations platform (AOP) to provide end-to-end manageability for fog computing regarding the operational demands of the industrial process.They evaluated the performance of their proposed platform using two use cases; one related to the reduction of received data and one dealing with filtering the data traffic according to sources.
Other related papers have focused on the security issues of fog computing with the IoT.For instance, A. Alrawais et al. [40] discussed the security and privacy issues in IoT environments and proposed a mechanism for security enhancement that employs the fog to improve the distribution of certificate revocation information among IoT devices.In addition, they proposed a case study to solve security issues in distributing certificate revocation information in IoT environments using fog computing.Also, K. Lee et al. [41] investigated the security and privacy issues resulting from integrating fog computing with the IoT.They argued that the adoption of the IoT with fog introduces several security threats.In addition, they discussed existing security measures which might be useful to secure the IoT with fog and highlighted the need to configure a secure fog computing environment through different security technologies.Some related papers discussed fog computing with vehicles.X. Hou et al. [42] presented an overview of vehicles as the infrastructure for communication and computation, which is known as vehicular fog computing (VFC).They proposed the use of this architecture to facilitate collaboration between end users to perform communication and computation based on the resources of each vehicle.They also discussed four scenarios involving moving and parked vehicles as the communication and computational infrastructures while performing a quantitative analysis of the capacities of VFC.In addition, M. Sookhak et al. [43] presented VFC to utilize the unused resources of vehicles to leverage fog computing resources.In addition, they proposed a cross-layer architecture for VFC to explain the procedures of the decision-making process and how different types of services are distributed among vehicles as fog nodes.
Also, to identify the security issues of current models of fog computing, S. Khan et al. [44] provided a review of fog computing applications to identify common security issues.They argued that most fog applications do not consider security as part of the system, but rather focus on functionality, which results in many fog platforms being vulnerable.Therefore, their work focused on determining the impact of security issues and possible solutions able to provide future security-relevant directions for fog computing.Furthermore, I. Stojmenovic and S. Wen [45] discussed the state-of-the-art of fog computing, before focusing on the security and privacy issues of the current fog computing paradigm.They used the example of a man-in-the-middle attack to examine the central processing unit (CPU) and memory consumption of fog devices.
The most recent related paper was presented by Mahmud et al. [46].They discussed a taxonomy of fog computing according to its challenges and features.They discussed the differences between mobile edge computing, mobile cloud computing and fog computing.They also studied fog node configuration, networking devices and various metrics of fog computing.
Table 3 provides a summary of related papers that have discussed the integration of the IoT with fog computing, highlighting the contribution of each paper arranged by publication year.

Applications of Fog with the IoT
There are many significant areas where fog computing can play a vital role in different IoT applications.This section provides an overview of various IoT applications that can benefit from fog computing.

Connected Car
According to Cisco, autonomous vehicles is a new trend for cars [17].There are many beneficial features, which depend on the fog and Internet connectivity, that can be added to cars such as automatic steering and "hands-free" operation or self-parking features which mean that there is no need for a person behind the wheel to park the vehicle [17].
In the next few years, it is expected that all new cars will have the ability to communicate with nearby cars and the Internet.Fog computing will be the most efficient solution for all Internet-connected vehicles, since it provides a high level of real-time interaction.In addition, it will allow cars, access points and traffic lights to interact with each other to deliver a good service to users [7].
With the use of the fog instead of the cloud, collisions and other accidents can be reduced as it does not suffer from the latency of the centralized cloud approach, enabling it to start literally saving lives [47].

Smart Traffic Lights
Fog computing allows traffic signals to open roads depending on sensing flashing lights.It senses the presence of pedestrians and cyclists and measures the distance and speed of the nearby vehicles.Sensor lighting turns on when it identifies movements and vice-versa [17].
Smart traffic lights may be considered to be fog nodes which are synchronized with each other to send warning messages to nearby vehicles.The interactions of the fog between the vehicle and access points are improved with WiFi, 3G, smart traffic lights and roadside units [7].

Smart Home
The IoT has many sensors and devices connected in the home.However, these devices come from different vendors and have different platforms, making it difficult to get them to work together.In addition, some tasks need a large amount of computation and storage.Fog computing solves many of these issues.It integrates all different platforms and empowers smart home applications with flexible resources [14].
Fog computing has many benefits for home security applications.It provides a unified interface to integrate all different independent devices.In addition, it provides elastic resources to enable storage, real-time processing and low-latency [14,48].

Wireless Sensor and Actuator Networks
One of the key features of WSNs is the ability to increase battery life by functioning at mostly low power.Actuators are used to manage the measurement operation and changing behaviour forming a closed-loop system.Actuators may be considered to be fog nodes that provide different actions to control end devices with sensors.These WSNs require less bandwidth, less energy and very low processing power [7].

Healthcare and Activity Tracking
Fog computing plays a vital role in healthcare.It provides real-time processing and event responses which are critical in healthcare [49].In addition, the interaction of a large number of healthcare devices for remote storage, processing and medical record retrieval from the cloud requires a reliable network connection which is not available.It also addresses issues regarding network connectivity and traffic [50].

IoT and Cyber-Physical Systems
The integration of fog computing with the IoT and cyber-physical systems (CPSs) is becoming possible.The IoT is a network that is able to interconnect all world devices together with an identified address using the Internet and telecommunications [6].
On the other hand, the CPS is a combination of physical and computational elements.The integration of CPSs with the IoT will convert the world into a computer-based physical reality.Fog computing is designed with the notion of embedded systems, for instance, connected vehicles, medical devices and others.With the combination of fog computing with the IoT and CPS, it will become possible to develop intelligent medical devices, smart buildings, and agricultural and robotic systems [6,7].

Augmented Reality
Augmented reality (AR) refers to systems that add virtual information to the real world [51].AR has become an important application due to computing devices become smaller, faster and more ubiquitous.AR applications are extremely latency-sensitive since a small delay in the application response can damage the user experience [35].Fog computing has the ability to be a key player in the AR domain by employing both the fog and cloud servers to enable real-time applications.Zao et al. [52] have designed an augmented brain-computer interaction game (ABCI) based on fog computing.They have demonstrated that a combination of fog and cloud servers can provide a continuous real-time game.

Challenges of Fog with the IoT
Although the fog computing paradigm offers many benefits for different IoT applications, it faces many challenges that stand in the way of its successful deployment.These challenges include scalability, complexity, dynamicity, heterogeneity, latency and security, as shown in Figure 4.
(1) Scalability: The number of IoT devices is in the order of billions, which generates a huge amount of data and requires a huge amount of resources such as processing power and storage.Therefore, fog servers should be able to support all these devices with adequate resources.The real challenge will be the capability to respond to the rapid growth of IoT devices and applications [53,54].(2) Complexity: Since there are many IoT devices and sensors designed by different manufacturers, choosing the optimal components is becoming very complicated, especially with different software and hardware configurations and personal requirements.In addition, in some cases, applications with high-security requirements require specific hardware and protocols to function, which increases the difficulty of the operation [53].(3) Dynamicity: One of the important features of IoT devices is the ability to evolve and dynamically change their workflow composition.This challenge will alter the internal properties and performance of IoT devices.In addition, handheld devices suffer from software and hardware aging, which will result in changing workflow behaviour and device properties.Therefore, fog nodes will need automatic and intelligent reconfiguration of the topological structure and assigned resources [53].(4) Heterogeneity: There are many IoT devices and sensors which are designed by different manufacturers.These devices have various capabilities in communication radios, sensors, computing powers, storage, etc.The management and coordination of networks such heterogeneous IoT devices and the selection of the appropriate resources will become a big challenge [14].(5) Latency: One of the main reasons to replace the cloud with fog computing is providing low latency, especially for time-sensitive applications.However, there are many factors presenting a high latency of application or service performance on fog computing platforms.The fog with high latency will lead to user dissatisfaction [54].(6) Security: Although fog nodes will need to be protected by using the same policy, controls and procedures and use the same physical security and cybersecurity solutions [17], the fog environment itself is vulnerable and less secure than cloud computing.Existing security and privacy measurements of cloud computing cannot be directly applied to the fog due to its mobility, heterogeneity and large-scale geo-distribution [55].Many research studies focus on cryptography and authentication to improve network security to protect against cyber-attacks in fog computing [14,53].(7) Resource management: Fog end devices are often network devices equipped with additional storage and computing power.However, it is difficult for such devices to match the resource capacity of traditional servers, let alone the cloud.Therefore, sensible management of fog resources is required for efficient operation of the fog computing environment [27,35].
(8) Energy consumption: The fog environment involves a large number of fog end devices; the computation is distributed and can be less energy-efficient than the centralized cloud model of computation.Therefore, reducing energy consumed in fog computing is an important challenge that needs to be addressed [56].

Open Issues of Fog with the IoT
It is obvious that fog computing is a new technology that needs more research to address all the challenges previously mentioned.This section provides an overview of open issues and future research directions related to fog computing and its integration with the IoT.

Communications between the Fog and the Cloud
Fog computing is an extension of the cloud, which is a central controller of fog servers that are deployed at different locations.The cloud manages the applications and contents of the entire system.In a fog, only selective localized applications are provisioned and synchronized with the cloud [57].
With the dual functions of the cloud, the data delivery and update from the cloud to fog faces problems related to communications sessions created during the processing of fog nodes.Selecting the appropriate communication between the fog and cloud that ensures high performance and low latency of fog nodes is a key challenge [30,53].

Communications between Fog Servers
Each fog server manages a pool of resources at different locations.Communication and collaboration between fog servers are necessary to maintain service provision and content delivery between them.If the communication efficiency is increased, the performance of the entire system will be improved [53].
The data transmission between fog servers faces many challenges that need to be addressed.For instance, there is a need for service policies where fog servers are deployed at different locations with different entities to enable them to adapt to different policies defined by owners [58].In addition, the data transmission between fog servers needs to consider connection features.In other words, fog servers need to be able to connect to each other using either wired or wireless connection over the Internet [41].

Fog Computing Deployment
Fog computing places additional computing and storage resources at the edge of the system to process local service requests quickly using local resources.As fog servers are deployed at different locations, they need to adapt their services regarding management and maintenance costs.In addition, the network operator of a fog computing system needs to address the requirements of each IoT application and fog server collaboration [53].

Parallel Computation Algorithm
Optimization algorithms are typically time and resource-consuming when applied on a large scale.Therefore, parallel approaches will be needed to accelerate the optimization process.Since fog computing provides computation resources to billions of IoT devices, using an efficient computation algorithm will be necessary to work with large-scale IoT applications [59].
Some current work provides potential results to leverage an in-memory computing framework to perform operations in a cloud infrastructure.However, building a system with dynamic graph generation and partitioning at runtime still needs more research, especially where the system has to adapt to dynamicity and a large number of IoT components [8,60].

Security
There are well-studied security issues for cloud computing that require significant security measures to protect the cloud.However, these measures are not suitable for fog computing due to its different characteristics, notably mobility, heterogeneity and large-scale geo-distribution [55,61].In addition, the fog is an appealing target for cyber-attackers since the fog contains large volumes of sensitive data from both the cloud and IoT devices [33].Therefore, more research is required to improve fog security.

End User Privacy
Preserving the end user's privacy is a significant issue that faces fog computing as fog nodes are closer to end users, which allows them to collect more sensitive data including financial records, identity, usage of utilities, location and others [55].Furthermore, as fog nodes are distributed in large areas, maintaining centralized control is very difficult.Unsecured fog nodes can be the entry point for an attacker who can get into the network and steal user data that are exchanged among fog objects [62,63].Protecting the privacy of fog nodes is a challenging issue that requires more research.

Conclusions
In recent years, the IoT has attracted the attention of both academia and commercial organizations.It is becoming an integral part of our lives.It has the ability to connect almost everything to everything else in our environment.IoT devices are dynamic in nature and have limited storage and processing capabilities.However, the traditional centralized cloud has many issues, such as high latency and network failure.To resolve these issues, fog computing has been developed as an extension of the cloud, but closer to the IoT devices in which all data processing will be performed at fog nodes, thereby reducing latency, especially for time-sensitive applications.The integration of fog computing with the IoT will bring many benefits to different IoT applications.In this paper, we presented the state-of-the-art of fog computing, including a discussion of fog characteristics, architecture and benefits.The discussion also focused on different IoT applications that will be improved through the fog.Challenges of integrating the IoT with the fog and open issues are also discussed.In summary, the purpose of this paper was to provide a review in order to summarize up-to-date research contributions on fog computing and the IoT and its applications in our world, as well as demonstrating future research directions and open issues regarding integrating fog computing with the IoT.

Figure 1 .
Figure 1.Fog computing is an extension of the cloud but closer to end devices.

Figure 3 .
Figure 3. Fog computing supports many IoT applications to provide better service to customers.

Table 1 .
Comparison between cloud and fog computing.

Table 3 .
A summary of related works that investigated the integration of fog computing with the IoT.