Cloud computing provides computing and storage resources over the Internet to provide services for different industries. However, delay-sensitive applications like smart health and city applications now require computation over large amounts of data transferred to centralized cloud data centers which leads to drop in performance of such systems. The new paradigms of fog and edge computing provide new solutions by bringing resources closer to the user and provide low latency and energy efficiency compared to cloud services. It is important to find optimal placement of services and resources in the three-tier IoT to achieve improved cost and resource efficiency, higher QoS, and higher level of security and privacy. In this paper, we propose a cost-aware genetic-based (CAG) task scheduling algorithm for fog-cloud environments, which improves the cost efficiency in real-time applications with hard deadlines …