Re: Global data concurrent access ?



Chris Mullins [MVP] <cmullins@xxxxxxxxx> wrote:
"Kunal" <koolkunal@xxxxxxxxx> wrote
There are about 10 new threads created per second. Threads do some
processing and die. All threads process based on data read from the
global structure.

You want to abandon this architecture as quickly as you can. The cost of
creating and destroying threads is very high, and at 10 threads per second,
you're application is spending 95% of it's time creating threads, and 5%
doing the work you want done.

While I agree that creating a lot of threads is reasonably expensive, I
don't think it's quite as bad as all that.

On my laptop, creating and starting 500 threads takes about 120-170ms.
(I haven't got the energy to work up a good benchmark - this is about
as crude as they come.)

Assuming linear scaling (and it should actually be better than that,
because with only 10 threads at a time there'll be less context
switching) that would suggest that 10 threads would take less than 4ms
to start - i.e. under 1% of the time. Yes, it's a very crude benchmark
- but I do think 95% is higher than reality.

Just to reiterate though, I totally agree that the OP should move away
from that architecture ASAP :)

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: New fully open ISA challenges
    ... implementation cost, performance, power consumption, and/or ... While opening the Architecture to allow others to ... no cost or at modest cost tends to increase the adoption of the ... ISAs are a different matter. ...
    (comp.arch)
  • Re: Fast addition for n+1 or n+0
    ... |:Is there more fast method for computing n+i than direct computing that sum? ... architecture that I've ever heard of, ... when working from instruction cache, ... the cost of the bitwise AND operation plus the cost of the ...
    (comp.lang.c)
  • Re: Fast addition for n+1 or n+0
    ... |:Is there more fast method for computing n+i than direct computing that sum? ... architecture that I've ever heard of, ... when working from instruction cache, ... the cost of the bitwise AND operation plus the cost of the ...
    (comp.lang.cpp)
  • Re: New fully open ISA challenges
    ... While opening the Architecture to allow others to ... no cost or at modest cost tends to increase the adoption of the ... small code size and very small silicon area for a 16 bit design. ... I designed the ISA for minimal area silicon and code size, ...
    (comp.arch)
  • on to the parliament
    ... architecture. ... If you'll abandon Lakhdar's monolith with supervisors, ...
    (sci.crypt)