Due to the rapid increase in the network traffic load, the Internet service system must improve to meet the requirement. Fifth generation (5G) mobile networks aim to deal with this problem, and cloud radio access networks (C-RANs) is a popular approach to this goal. In a C-RAN, baseband processing units are centralized into a pool, which allows us to have a better resource utilization. In this thesis, we use the Lagrangian relaxation method combined with bin packing, scheduling, and traffic shaping to derive a task allocation strategy in a C-RAN that tries to maximize the profit of a network operator who may face multiple kinds of constraints during its operation. After that, we will present the experimental results to show the effectiveness of our proposed method.