Cloud computing service provides elastic and infinite computing resources to meet users' QoS requirements such as deadline and service cost. However, some tasks may be delayed because of the long waiting time before their resources are available. So, how to supply dynamic resource scaling and task migration is an important question which determines users' Service-level agreement(SLA) whether can be achieved. In this work, we construct the Torque Cloud management system to support dynamic task scheduling in the Cloud through applying Torque distributed resource management software to Eucalyptus Cloud platform. And also an idle resource cached dynamic scheduling algorithm(Idle Cached) is proposed to dynamically adjust tasks, which will take full advantage of idle resources in the resource pool. The results prove that the algorithm can quickly meet tasks' resource demands, minimize users' service cost and system energy-consumption.