[Interest] how to run 21 threads concurrently

Sujan Dasmahapatra sujan.dasmahapatra at gmail.com
Thu Oct 4 16:07:44 CEST 2012

I agree with you Thiago. QtConcurrent runs as many threads as are
processor. I submitted 21 threads through a for loop. Then the first 8
threads should be running intially right. When anyone thread is finished
the does it take automatically 9th thread? and so on. I am currently doing
exactly the same. But although I submitted 21 threads through
QtConcurrent::run in a for loop, but I doubt if all threads are being run
properly. Thats why some of the data are not being written onto the file.
Let me know if I am able to make you  understand the situation.
On Thu, Oct 4, 2012 at 4:51 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

Sujan Dasmahapatra
skype: sujan.dasmahapatra
yahoo msn : dasmahapatra.aerodynamics at yahoo.co.in
Mobile no : +966-530184511
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121004/91ec52b1/attachment.html>

More information about the Interest mailing list