multithreading

Hey guys,

I'm trying to multi thread my program for finding the connected components in an image. I'm using 8-pixel connectivity, which means I start with the first row and then gradually checking subsequent rows, and then in a second round, after labeling every pixel, I go through them again and see if some are part of the same component.

I'm not sure where to include the sync() functions using the pthread.h header. I definitely know that I want to have as number of threads the total number of vertices and then check each row in parallel, perhaps.

Could somebody help me with this?
Why do You want to create as many threads as vertices?...
Do You have that many cores in your hardware O?o...
Usually having as many threads as cores or one more will result in the best performance - and for something like that I think performance is the only reason to use threads. If you haven't yet, I'd recommend to write it without multithreading first and reconsider implementing it later (Shouldn't not that much work then).
I did write it sequentially and it works perfectly, I just don't know how to multithread it? Have you, JoR, done this before and can help me?
The boost library will simplify using multiple threads. You also may wish to know what a "mutex" is, and what types exist. In fact, it's probably necessary that you do if you wish to write multi-threaded applications effectively.

Topic archived. No new replies allowed.