The rapid growth of the cloud computing landscape has created significant challenges in managing the escalating volume of data and diverse resources within the cloud environment, catering to a broad spectrum of users ranging from individuals to large corporations. Ineffectual resource allocation in cloud systems poses a threat to overall performance, necessitating the equitable distribution of resources among stakeholders to ensure profitability and customer satisfaction. This paper addresses the critical issue of resource management in cloud computing through the introduction of a Dynamic Task Scheduling with Virtual Machine allocation (DTS-VM) strategy, incorporating Edge-Cloud computing for the Internet of Things (IoT). The proposed approach begins by employing a Recurrent Neural Network (RNN) algorithm to classify user tasks into Low Priority, Mid Priority, and High Priority categories. Tasks are then assigned to Edge nodes based on their priority, optimizing efficiency through the application of the Spotted Hyena Optimization (SHO) algorithm for selecting the most suitable edge node. To address potential overloads on the edge, a Fuzzy approach evaluates offloading decisions using multiple metrics. Finally, optimal Virtual Machine allocation is achieved through the application of the Stable Matching algorithm. The seamless integration of these components ensures a dynamic and efficient allocation of resources, preventing the prolonged withholding of customer requests due to the absence of essential resources. The proposed system aims to enhance overall cloud system performance and user satisfaction while maintaining organizational profitability. The effectiveness of the DTS-VM strategy is validated through comprehensive testing and evaluation, showcasing its potential to address the challenges posed by the diverse and expanding cloud computing landscape.