The embodiment of the invention discloses a packet scheduling algorithm and a device thereof, belonging to communication field. The packet scheduling algorithm includes the following steps: partitioning the service packets into real-time service packets and non-real-time service packets according to headers of the service packets; judging whether legal real-time service packets exist in the real-time service packets according to shaping virtual clock algorithm, if yes, sending out the legal real-time service packets, and if no, sending out the non-real-time service packets; if new legal real-time service packets appear during the process of sending out the non-real-time service packets, suspending the sending of the non-real-time service packets and sending out the new legal real-time service packets. The device comprises a sort module, a judge module, a real-time service sending module, a non-real-time sending module and a notification module. The packet scheduling algorithm and the device can ensure that the sending of the real-time service packets is free from the influence of the non-real-time service packets and can avoid the occasion that the non-real-time service packets wait for too long. Therefore, the packet scheduling algorithm and the device have strong practicability, reliability and effectiveness.