In this paper, a Pareto based fruit fly optimization algorithm (PFOA) is proposed to solve the task scheduling and resource allocating (TSRA) problem in cloud computing environment. First, a heuristic based on the property of minimum cost is proposed for initializing the population. Second, a resource reassign operator is designed to generate non-dominated solutions. Third, a critical path based search operator is designed to improve the exploitation capability. In addition, the non-dominated sorting technique based on the concept of Pareto optimum is adopted and visual memory is also employed to deal with multiple objectives in solving the TSRA problem by the PFOA. Finally, the effectiveness of the PFOA is demonstrated by the comparative results and statistical analysis by using some test instances.