So I've got this program I made, and I wanted to speed it up, using multithreading, to make use of my quad core. The program itself fully supports multithreading. The problem is, that when I'm running the program, using just one; CreateThread() it finishes in 6seconds, if I run 2 it finishes in about 12, and with the same result, why would single threading be faster? - The timer is started after the thread creation, so it isn't the extra overhead!

Please help me out, my brain is hurting >.<

Could it be the Windows API threads?

Recommended Answers

All 3 Replies

Thread management takes cpu cycles...

Thread management takes cpu cycles...

True, but equal to 3CPU cores out of 4?

Multi-threading really works only if your process is going to be waiting on certain conditions. If your process locks up the CPU for 5 minutes, then running 2 processes will lock it up for 10 minutes. But if your process has some idle time somewhere, then you could get a gain.

Multi-threading is really used to support simultaneous processes, such as a web server etc and not really to speed up a process -at least on a single computer. If you want to use 2 computers with two seperate chips and buses, then that's a different story.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.