# An Overview of Fog Data Analytics for IoT Applications
### Introduction to IoT and Fog Computing  
As we have seen in the previous section, Industry 4.0 focuses on smart devices. The devices become smart by getting equipped with sensors or actuators that help them to identify their surroundings, process the data collected from them in the brain, make a decision, and then react according to the decision. This brings us to the IoT paradigm and the definition of IoT, which is somewhat as follows.  
The network of all of these smart devices that are connected to sense, communicate, and interact within them and with the external environment on real-time data and make decisions by processing these data is collectively called the Internet of things or the IoT. All IoT devices are connected centrally to the cloud to compute the enormous amount of data that IoT devices collect [10; 11]. The cloud also has a vast data storage capacity and is generally remotely located from the devices. Furthermore, the cloud provides different kinds of services, such as software as a service (SaaS), platform as a service (PaaS), and infrastructure as a service (IaaS), heading towards anything as a service (XaaS).  
The vast number of interconnected devices drives out huge amounts of data in a raw format that needs to be processed, and decision making needs to be performed based on that data in real time. However, only one cloud is remotely situated and serves many devices, all of which need to respond quickly to the data. Consider the case of a driverless car that sends all of its sensors' data to the cloud to make decisions [12; 13]. The car's camera sends out the image of the signal turning red just now, but as the decision to stop comes from the cloud, it has already crossed the signal, causing an accident. There are many such use cases in the real world where decisions need to be made instantaneously. At that time, it was clear that there were better things to carry out than sending all of the data directly to the cloud and waiting for the response to act. Therefore, a new paradigm is known as edge computing or fog computing. Although most people attribute both as the same thing, and it is not easy to distinguish between them, there is a subtle difference separating them. Other important paradigms similar to these have also been developed, such as dew computing or mobile cloud computing or a hybrid of any of these, which will be discussed later in the paper [14]. Fog computing aims at becoming a mediator between IoT devices and the cloud by cloning activities performed by the cloud but with lesser strength than the cloud itself. This process aims at bringing efficiency and scalability in two ways: vertical (by reducing the time taken to reach the cloud) and horizontal (fewer data needed to process and manage) [15; 16]. However, the cloud now has a role. The high latency problem of the cloud can be overcome by using idle resources of various devices near users. However, fog computing still relies on the cloud for complex processing, which does not require real-time attention. The fog itself addresses the tasks that need such real-time attention. Its abstracted view is passed on to the cloud for complex data analytics, maintaining a global view of the interconnected devices and pushing local updates to the connected fog nodes [17].  
Figure 1: Industrial revolution.