开发者

Prescheduling Recurrent Tasks

At work, we are given a set of constraints of the form (taskname, frequency) where frequency is an integer number which means the number of ticks between each invocation of the task "taskname". Two tasks cannot run concurrently, and each task invocation takes one tick to complete. Our goal is to find the best schedule in terms of matching the set of constraints.

For example, if we are given the constraints {(a, 2), (b,2)} the best schedule is "ab ab ab..." On the other hand, if we are given the constraints ({a,2}, {b, 5}, {c, 5}) the best schedule is probably "abaca abaca abaca..."

Currently we find the best schedule by running a genetic algorithm which tries to minimize the distance between actual frequencies and the given constrai开发者_如何学运维ns. It actually works pretty well, but I wonder if there's some algorithm which better suits this kind of problem. I've tried to search Google but I seem to lack the right words (scheduling is usually about completing tasks :(). Can you help?


First off, consider the merits of jldupont's comment! :)

Second, I think 'period' is the accurate description of the second element of the tuple, e.g. {Name, Period[icity]}.

That said, look to networking algorithms. Some variant of weighted queuing is probably applicable here.

For example, given N tasks, create N queues corresponding to tasks T0...Tn, and in each cycle ("tick") based on the period of the task, queue an item to the corresponding queue.

The scheduler algorithm would then aim for minimizing (on average) the total number of waiters in the queues. Simple starting off point would be to simply dequeue from the quene Qx which has the highest number of items. (A parameter on queued item to indicate 'age' would assist in prioritization.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜