Re: Out of control threads



In this case, I would use the threadpool and queue up the threads. You get
the benefits of the parallel operations but don't saturate your physical
resources.

Mike.

"Ashot Geodakov" <a_geodakov@xxxxxxxxxxx> wrote in message
news:OOIRsIwVHHA.528@xxxxxxxxxxxxxxxxxxxxxxx
Hmm, and if you needed to visit 1000 websites (or databases) would you
have created a 1000 threads?

I am sure the method works great, but I still have doubts whether or not
it can give you any gain in performance.

There's still a network cable which allows only this much information to
pass at any moment. Say, 100 kbits per second. What if you need 100 kbits
from each of the 10 websites? They'll not come all in one second because
of multithreading. They'll take exactly 10 seconds.

And during multithreading doesn't CPU pass a token between threads and run
just a portion of a thread funtion and then move on to the next thread?
How is it different from running thread functions sequentially? Besides
all the extra steps that CPU has to take because of multithreading?

Sometimes you may want to do 10 things in parralel (like visit 10
websites and scrape some info). This is much faster when you use 10
threads, then doing it sequentially, as the bottleneck is latency, not
CPU. I have personally used a method described above, and it works
great.

You may need to retrieve values from different databases, and then
perform some calculation using them. You can only start the
calculation once you have the 10 values.







.



Relevant Pages

  • Re: Out of control threads
    ... and if you needed to visit 1000 websites (or databases) would you have ... And during multithreading doesn't CPU pass a token between threads and run ...
    (microsoft.public.dotnet.framework)
  • Re: Atmel releasing FLASH AVR32 ?
    ... the solution is to have more associativity in the cache. ... in a separate CPU to avoid real time response conflicts and can ... I am saysing that it is cheaper to use asymmetric multithreading ... additional constraint to your "interrupt" system. ...
    (comp.arch.embedded)
  • [patch -mm] scheduler cache hot autodetect, isolcpus fix
    ... > For a cpu-exclusive cpuset cpu, ... > The expense of the migration_costcalculation can be sizeable. ... > reflect true migration costs. ...
    (Linux-Kernel)
  • Re: merits of Lisp vs Python
    ... calculations a CPU can do per time unit could be a way to do that. ... So you already know his calculation. ... If it was a single cpu then super computers were ca. 1000 times faster. ... Lisp compilers will generate better and better code. ...
    (comp.lang.lisp)
  • Re: Atmel releasing FLASH AVR32 ?
    ... Same solution: more fast on-chip memory. ... in a separate CPU to avoid real time response conflicts and can ... asymmetric multiprocessing or asymmetric multithreading? ... If you do not understand the differences between cores like Itanium-2, ...
    (comp.arch.embedded)

Quantcast