On Mon, Aug 4, 2014 at 3:36 PM, Dicebot via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> Most likely those threads either do nothing or are short living so you don't > get actually 10 000 threads running simultaneously. In general you should > expect your operating system to start stalling at few thousands of > concurrent threads competing for context switches and system resources. > Creating new thread is rather costly operation though you may not spot it in > synthetic snippets, only under actual load. > > Modern default approach is to have amount of "worker" threads identical or > close to amount of CPU cores and handle internal scheduling manually via > fibers or some similar solution. That's what I guessed. It's juste that I have task that will generate other (linked) tasks, in a DAG. I can use a thread pool of 2-8 threads, but that means storing tasks and their relationships (which is waiting on which, etc). I rather liked the idea of spawning new threads when I needed them ;) > > If you are totally new to the topic of concurrent services, getting familiar > with http://en.wikipedia.org/wiki/C10k_problem may be useful :) I'll have a look. I'm quite new, my only knowledge comes from reading the concurrency threads here, std.concurrency, std.parallelism and TDPL :)