[Interest] how to run 21 threads concurrently
Constantin Makshin
cmakshin at gmail.com
Thu Oct 4 16:18:56 CEST 2012
Sujan said he uses threads to generate files, so there's some chance that
his task'll be IO-bound and extra threads will actually increase overall
performance.
But this is just a guess and running 21 threads on an 8-core CPU is
probably an overkill (unless the task is *really* IO-limited).
On Oct 4, 2012 5:52 PM, "Thiago Macieira" <thiago.macieira at intel.com> wrote:
> On quinta-feira, 4 de outubro de 2012 15.46.57, André Somers wrote:
> > If you think that running 21 threads on an 8 core system will run make
> > your task go faster, then Thiago is right: you don't understand your
> > problem.
>
> If you run 8 threads on an 8-core system and they use the CPU fully, then
> you're running as fast as you can.
>
> If you have more threads than the number of processors and if all threads
> are
> ready to be executed, then the OS will schedule timeslices to each thread.
> That means threads get executed and suspended all the time, sometimes
> migrating between processors. That adds overhead.
>
> If it adds overhead, it's slower. Depending on your OS, it might be
> considerably slower.
>
> If you do not understand what I said, understand this: there's a reason why
> QtConcurrent runs as many threads as there are processors.
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121004/cdad8102/attachment.html>
More information about the Interest
mailing list