Re: trees



On 26 Jul, 22:48, sngtnai...@xxxxxxxxx wrote:
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 don't follow your logic. Maybe it's a nomenclature issue. I would
have thought that rather than having many schedulers you would have
one scheduler per CPU. (Of course, perhaps you have many CPUs...?) The
question then becomes one of how to allocate CPU-bound threads to
schedulers. I/O bound ones are less of an issue as they generally need
only short bursts of CPU time, less than a timeslice.

There are many methods for scheduling CPU-bound threads.

http://en.wikipedia.org/wiki/Scheduling_%28computing%29

HTH. On the other hand I may have misunderstood your query....

.



Relevant Pages

  • Re: trees
    ... I want to implement the following but Im not sure what data structure ... I have a list of jobs that need to be allocated to schedulers. ... without breaking the "balance" in the system. ...
    (comp.programming)
  • trees
    ... I want to implement the following but Im not sure what data structure ... I have a list of jobs that need to be allocated to schedulers. ... without breaking the "balance" in the system. ...
    (comp.programming)
  • Re: trees
    ... I have a list of jobs that need to be allocated to schedulers. ... without breaking the "balance" in the system. ... You will be free to revise the ...
    (comp.programming)