In the IoT environment, a large number of devices are connected with each other, and it is not feasible to process all the streaming data available to those devices. Context-aware data processing enables sensors and devices to use context-specific information such as location, temperature, and the availability of a certain device to decide what data to collect and interpret to provide relevant information to other devices or users. For example, context-aware data processing can deliver relevant information to a user by knowing the user's current location (e.g., within a department store, a park, or a museum). Cognitive data processing integrates the human cognition process into IoT applications. Rather than being programmed to deal with every possible data-processing need, a cognitive data-processing application is trained using artificial intelligence algorithms to sense, predict, infer, and learn tasks and environments. For example, cognitive data processing uses image recognition techniques to understand the surrounding environment, processes data for a user, and utilizes feedback from the user to learn further. The optimization of data processing is critical to timely processing of the continuous stream of massive amounts of data. Technological advances in optimized data processing help make timely decisions in time-critical big data applications such as smart grids, environmental monitoring, and smart manufacturing.