Norbert Nemec Wrote:

> Robert Jacques wrote:
> > Norbert, you are confusing threads with fibers. OS Threads have never 
> > been, nor will ever be, "light-weight" in any sense of the word.
> 
> What I had in mind were discussions about OSes that make thread creation 
> extremely cheap, but indeed: OS threads will probably always carry 
> sufficient overhead to leave plenty of room for application-level 
> mechanism...
> 
> Does anyone know how expensive thread creation is for typical and for 
> experimental OSes? How does this compare to the overhead of initializing 
> thread-local data? I.e.: How much should one actually worry about TLS?

Your worries looks like 'premature optimization' to me. I had little 
experieance with similar story while ago, web server that was happily creating 
bunch of threads for each request. XP handled it well, up to couple hundred 
threads, then started to suffocate. CentOS did better up to 1000, then some 
strange bugs emerged. On both I had to do manual memory management as GC wasn't 
smart enough (finished thead is not deleted thread, and os wont give you more 
before). Most headaches were. of course,  synchronization of operations on 
complex data types (arrays and such), handles etc.

Hate to say it, but there were some issues I couldn't track down, so I switched 
to multi process instead of multi threaded, and it works fine :D

Lot of people are saying that threads are evil. There might be something in it 
:D

Reply via email to