Re: trees
- From: pjb@xxxxxxxxxxxxxxxxx (Pascal J. Bourguignon)
- Date: Sun, 27 Jul 2008 02:45:23 +0200
sngtnair84@xxxxxxxxx writes:
Hello
I want to implement the following but Im not sure what data structure
to use.
I have a list of jobs that need to be allocated to schedulers. The
number of schedulers in the
system depend upon the number of jobs. Each scheduler can handle
between n & m jobs. Each scheduler handles at the max m jobs.
The resulting tree structure should be "balanced" - in the sense there
shouldn't be any scheduler with too few jobs and none with too many. I
should be able to freely move around the jobs to different schedulers
without breaking the "balance" in the system.
What data structure will be best for this situation?
In my current implementation, I have fixed the number of jobs that can
be handled by the scheduler to m. The problem is suppose there are x
schedulers in the system, then x-1 schedulers have m children and the
xth scheduler can have any number from 1 to m.
I want to improve it with what I have written above, but dont know
what data structure/algorithm to use.
I request you all for some suggestions.
There is no need for any data structure.
Let J be the number of jobs.
Let S be the number of schedulers.
If J<S*n then there is no solution.
If S*m<J then there is no solution.
Otherwise, allocate J div S jobs to each scheduler,
and the remaining J mod S jobs to the J mod S first schedulers.
--
__Pascal Bourguignon__ http://www.informatimago.com/
"Logiciels libres : nourris au code source sans farine animale."
.
- References:
- trees
- From: sngtnair84
- trees
- Prev by Date: trees
- Next by Date: Re: trees
- Previous by thread: trees
- Next by thread: Re: trees
- Index(es):
Relevant Pages
|