run the priority queue simultaneously, solve the infite loop problem