in reply to Re: How to bucket a Hash
in thread How to bucket an Hash

That was a test program and it didn't take care of the all the cases :). Thanks for fixing that issue.

As I was looking to different solutions which can be used while assigning jobs to multiple threads. As I want a fixed size queue is assigned to each thread. As the job items are present in a HASH, I was looking a method through which this slicing can be done on a faster way as the total keys can be high.

Replies are listed 'Best First'.
Re^3: How to bucket a Hash
by Random_Walk (Prior) on Nov 27, 2013 at 09:41 UTC

    Why do you want a fixed work unit size for each thread? Given the vagaries of multitasking, some thread is sure to finish a fixed length task before another doing the same size task. Why not just pour all your data into a Thread::Queue and have a pool of workers servicing this queue? If you have a very large amount of data it can also be handy to have a size limited queue, BrowserUK gives a great example here: Re^5: dynamic number of threads based on CPU utilization.

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!