The effective dwell scheduling algorithm must be studied to make full use of the radar system's limited resources. In this study, a real-time dwell scheduling in phased array radar is investigated, where the optimisation problem model that takes the importance, urgency and desired execution time criteria into consideration is built. A real-time dwell scheduling algorithm for phased array radar based on a backtracking strategy is proposed to solve this problem. Based on the scheduled task pointed by the time pointer, when it is not interleaved with the previously scheduled tasks, two previously interleaved blocks are backtracked, and the actual execution time of tasks in these two blocks are adjusted. In order to guarantee real-time scheduling, the concept of the virtual dwell task is introduced to reduce the dimension of the original execution time optimisation problem first, then it is converted into two convex optimisation problems and their analytical solutions are deduced. Simulation results demonstrate that the proposed algorithm can realise real-time dwell scheduling, and it has the lowest Task Drop Ratio, the highest Hit Value Ratio, Time Utilisation Ratio and low Average Time Shifting Ration compared with conventional and up-to-date algorithms.