Threads and Performance

BlitzMax Forums/BlitzMax Programming/Threads and Performance

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

One thing I also noticed when I implemented a thread pool, is that I got less performance than expected. But what I didn't factor in was the way the o/s redistributes system threads. If I run a single threaded app it will hog all of the time of the core it runs on and all other threads seem to get shifted to the other core (with time to spare). So then I measure the time it takes and figure that I could double that when I move to multithreaded. But that's not true - the system threads and other threads still have to get their time. It ended up being more like adding an extra 60-70% cpu time by running a second thread in the pool, rather than a 100% speedup. That said, I expect if you had like 3 or more cores you would start to see a bigger speedup for each core you add since you aren't adding more system threads.