0

When can you determine if you are using too many threads? Assuming I have complete control and mutex locks and what not, when does it slow my program down, rather than speed it up by splitting up processing into sectons and passing between FIFO queues. Thanks.

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by Salem
0

ok, thanks. Also, If I am passing a class into my thread function, and use the same class in a different thread, but a different function of the class, can they operate in parellel, or would I have to wrap in mutex locks or make 2 different classes? Thanks.

0

It's not the functions of the class you have to worry about, it's the instances.

Two threads could work on two separate instances of the class, and call the same functions. So long as the class member functions themselves were reentrant (no static / global data for example).

Well if you've got lots of processing to do, then you start to lose when you exceed the number of cores you have on your processor.
Context switching and message passing just become useless and unproductive overhead at that point.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.