Threading and the Garbage handler mess.

Sergey Gromov snake.scaly at gmail.com
Sun Sep 7 07:57:21 PDT 2008


Alan Knowles <alan at akbkhome.com> wrote:
> - But I still think that a large multi-threaded application having to 
> rely on the GC is not a pretty prospect, and that being able to manage 
> memory in a tighter clearer, and cleaner way would be preferable.. - 
> imagine 500 threads being paused and scanned every few seconds to ensure 
> memory doesn't get out of hand - this doesn't sound efficient... 
> (althought I'm not sure I've got any great answers yet)

Unless you've got 500 cores, you're actually pausing 2, 4, okay 8 
threads, in case of 100% efficiency of your code.  There *should* be a 
benefit from collecting garbage in parallel, especially after number of 
cores raises to dozens.

Also, overhead of scanning 500 threads is to scan 500 stacks instead of 
one.  Doesn't sound like a big deal.

> It's also a wake-up call to the authors of things like DBI - which 
> really should read this and understand that you can not send connect() 
> the username/password etc. without adding root to them.... - which I 
> doubt currently many  libraries in dsource address..

Well, yes, connect() is an asynchronous call which requires specifically 
that buffers passed must stay valid while request is in progress.  This 
causes troubles in C either.



More information about the Digitalmars-d mailing list