## 1 Introduction
However, processing capability of a Fog Node is restricted, thus small tasks or processing requests with short delay will be prioritized to be processed on Fog Computing infrastructure, while tasks that have delay-tolerant and tasks of larger scale will still be pushed to Cloud layers. Eventually, Fog computing complements the Cloud to form a new computing paradigm, Cloud-Fog computing. The Cloud-Fog computing model has numerous advantages, including reduced latency, reduced network traffic and increased energy efficiency, however, this new model also comes with a set of challenges. One of them is resource allocation and tasks scheduling. A highly distributed system such as Cloud-Fog computing is an ideal platform to deploy Bag-of-Tasks (BoT) applications, which are those parallel applications whose tasks are independent to each other. BoT applications appear in many scenarios, including data mining, massive searches (such as key breaking), fractal calculations, computational biology [2], computer imaging [3], video encoding/decoding, and various other IoT applications. The main challenge is scheduling tasks in the pool of processing nodes including cloud nodes (such as servers or virtual machines) and Fog nodes. The goal of task scheduling in Cloud-Fog system is aimed at the benefit of users or service providers. On the users side, they are concerned about some criteria of makespan, budget, deadline, security, and cost. On the other hand, the purpose of the service providers is load balancing, resource utilization, and energy efficiency. To guarantee the QoS, response time plays an important role when directly influencing the user's experience. In addition, the implementation cost is also an aspect that users are very interested. A task schedule, which minimizes completion time and saves monetary cost, will satisfy Service Level Agreement (SLA) signed with users. In this paper, we concentrate on task scheduling problem in Cloud-Fog environment, a highly distributed computing platform, for processing large-scale BoT applications. A Time-Cost aware Scheduling (TCaS) algorithm is proposed to solve this problem. The major objective of the TCaS algorithm is to achieve a good trade-off between execution time and monetary cost to complete a bag of tasks in Cloud-Fog system. In addition, this algorithm can flexibly adapt with the requires of various users in which someone wants to prioritize the execution time at current time and others have a desire that their tasks are completed with a tight budget. Our approach was experimentally evaluated and compared with Bee Life Algorithm (BLA) [4], Modified Particle Swarm Optimization (MPSO) and Round Robin (RR) algorithm on many datasets with various size. The results prove that the proposed algorithm achieved better QoS and was more optimal in balance between time and cost efficiency than BLA. The rest of the article is organized as follows. In Section 2, the related works are presented. Section 3 specifies the mathematical model for the task scheduling problem in the Cloud-Fog computing environment. Section 4 presents our proposed algorithm in detail. Experimental results are given in Section 5. Finally, Section 6 concludes the article and future works are discussed.