Works for Priority and FCFS