At the moment I am trying to understand the implementation of dynamic priorities in my project.

I have an object, let's call it Request . The object has the time of the last call ( long timeLast ) and the frequency of the call ( double period ). The priority is calculated by the formula - (currentTime(нынешнее время) - timeLast)/period .

I create an ArrayList such objects. I need to get the current priority at each moment of time and, depending on the priority, to sort this ArrayList (the sorting is implemented by a comparator, everything is OK there). How could I realize this, honestly, there are simply no ideas on this. I know about the existence of the EDF algorithm, but it was not possible to find its implementation in the Internet. Thank you very much.

  • Do not understand why this is? - Stranger in the Q
  • Well, you can use any timer and make it head on. Or is this option too reward system? - pavel
  • In the forehead how? I honestly do not quite understand how to approach this. It is necessary to control the processes in time. For which process the priority is now higher - that is what is being fulfilled, and after the completion of the process the priority of the process is reset. And processes are performed approximately every 16ms. - Ilya Novikov
  • 2
    Or maybe it is easier to make a turn of execution (taking into account time) and just add tasks to it? For why recalculate so often all priorities, if they really change only when called? - Riĥard Brugekĥaim
  • Riĥard Brugekĥaim, wow, interesting option, I will try to implement. Thank. - Ilya Novikov

0