Dividing workload on several threads
Asked Answered
S

4

7

I was wondering if anyone knows about a good article which describes dividing workload on to several Threads? Preferebly it would be written for C# but it's really the concept I'm after, so it's not an issue if it's written for a different, similar, language.

I have a problem where I would have to divide a large amount of computing into several threads and then Sum the generated data after one iteration completes (so I would need to know that all threads have finished) and then start a new iteration, supplying all the threads with the data generated in the last iteration (the data would be modified before the end of each iteration).

I hope this makes sense, and is possible. Either way I would appreciate some advice on how to tackle the problem of computing large amounts of data divided on to several threads (so I can use more than one processor's core).

Thank you for your answers!

Selfmade answered 16/1, 2009 at 7:30 Comment(0)
H
6

You should look at Parallel FX (PFX), you can find the blog here and the download link here (Thanks Marc).

Unfortunately I don't know if this will be released for .NET 2.0/3.5 as it is currently slated for .NET 4.0.

If you're looking at implementing it yourself, look into Work Stealing Algorithms.

There is also a library named Power Threading, by Jeffrey Richter from Wintellect which has some rather good classes available for you.

Hygro answered 16/1, 2009 at 7:37 Comment(1)
CTP: microsoft.com/downloads/…Wsan
M
4

Lasse and Marc have already spoken about Parallel Extensions. I have a couple of blog articles (with code) about using and benchmarking it:

These might be helpful to show various different ways that work can be broken up.

Mangan answered 16/1, 2009 at 8:3 Comment(0)
W
3

"Parallel Extensions" is designed for this, in particular the Parallel class (which allows you to split work up between the threads very easily). The aggregation of results is trickier; some quick searching shows some mixed results - but I don't know what will be in the final release (i.e. it could be easier).

The CTP is available here, or wait for .NET 4.0.

Wsan answered 16/1, 2009 at 7:36 Comment(0)
H
0

Paint.NET does this quite well (for image processing) and the source code to older versions of might still be freely available somewhere.

For more information, please move over to my question regarding a white paper by the author I once saw about this subject. When I wanted to show that article it to a co-worker recently I (that is: Google) was not able to find this any more, hence the question.

Helices answered 16/1, 2009 at 8:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.