Making reasonable decisions for service cache and task execution on edge devices with limited resources in the mobile edge computing can greatly improve the unloading efficiency and reduce processing delay of applications. With defining the task execution delay of associated edge devices, cooperative edge devices and remote cloud, a joint optimization algorithm was proposed by establishing a network model and service cache model to solve the optimal solution of service caching decision under the constraint of task execution delay on the problem of service cache and task unloading decision. The algorithm with PSO used integer encoding of mobile users’ tasks, optimization of task processing delay fitness and particle velocity updating to shorten the task delay time. The simulation results showed that the algorithm can obtain less completion time in the large-scale task scheduling than other strategies.