For the sake of argument i'm trying to define an algorithm that creates a pool of tasks (each task has an individual time-slice to operate) and managing them without the system clock.
The problem that i've encountered is that with each approach that I was taking, the tasks with the higher time-slice were starved.
What i've tried to do is creating a tasks vector that contains a pair of task/(int) "time". I've sorted the vector with the lowest "time" first & then iterated and executed each task with a time of zero (0). While iterating through the entire vector i've decreased the "time" of each task.
Is there a better approach to this kind of "problem". With my approach, startvation definitely will occur.