using a function to calculate task priority which can be run