Cloud computing is a rapidly growing technology in the field of distributed computing that enables users to access virtual machines for computation and storage on a pay-per-use basis. Its primary goal is to provide seamless access to remote and geographically dispersed resources. However, cloud computing faces numerous challenges, and scheduling is one of them. Scheduling refers to the process of ordering the execution of tasks in a computer system. An effective scheduler should adapt its scheduling strategy to changes in the environment and the type of task being performed. In this research paper, we introduce a Generalized Priority algorithm that optimizes task execution and compare it with traditional scheduling algorithms, such as FCFS and Round Robin Scheduling. We test the algorithm using the cloud Sim toolkit and show that it outperforms other conventional scheduling algorithms, making it a more efficient and effective scheduling strategy for cloud computing.