How many threads / mutexes can we use? |
How many threads / mutexes can we use? |
Ryan C. Gordon
Guest
|
There's no limit to the number of threads in SDL, and it doesn't look like most modern OSes have serious limits either (but if nothing else, you can easily run out of address space for each thread's stack in a 32-bit process, etc). For Windows: http://blogs.msdn.com/b/oldnewthing/archive/2005/07/29/444912.aspx For Linux: http://stackoverflow.com/questions/344203/maximum-number-of-threads-per-process-in-linux But I would say if you're spinning this many threads, reconsider. Most of the time, one thread doing heavy work per CPU core can be a win (at a cost of having to maintain multithreaded code), but most things after that turn out to be a design mistake, if having threads at all isn't one in itself. --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
How many threads / mutexes can we use? |
Jorge Rodriguez
Guest
|
I'm hardly an expert in parallel programming but in my experience the benefit of more threads drops drastically after it begins to exceed the number of physical processor cores. After a while the overhead of more threads will exceed any benefits.
If your goal is to have something that's always responsive to eg network traffic or sound then a better solution may be to scatter NetworkUpdate () etc calls around your frame (and not do any blocking operations in that function) to make sure you don't miss anything. El jul 26, 2014 8:32 PM, "Ryan C. Gordon" escribió:
|
|||||||||||||||
|