working implementation of priority scheduling algo - 1