In order to solve the problem of low efficiency in resource scheduling in cloud computing, an improved chicken swarm optimization (CSO) is proposed for task scheduling. Firstly, the concept of opposition-based learning is introduced to initialize the chicken population and improve the global search ability. Secondly, the concepts of the weight value and learning factor in particle swarm optimization (PSO) are introduced to improve the positions of chickens, and the individual positions of chickens are optimized. Thirdly, the overall individual positions of the CSO are optimized by the difference algorithm. Finally, the possible cross-boundary of individual positions in the algorithm is prevented as a whole by boundary processing. In the simulation experiment, the optimized CSO is compared with the basic CSO, PSO, and ant colony optimization (ACO) in terms of completion time, cost, energy consumption, and load balancing, and good results are achieved.