Will it be a big difference between this two scenarious:
- one instance of application creates 100 threads to process some jobs
- 10 instances of the same application creates 10 threads each to process jobs (total 100)
The number of threads in both cases will be the same. Is it some performance or any type of improvements of one over another?
Instance – is for example console application, so in second case it
will be 10 console application running. each of application has it’s
own folder.
A thread uses less resources than a process so theoretically option 1 would be “better”. However, you probably won’t notice much difference between the two, because 100 separate threads or processes all running simultaneously and fighting for the same O/S resources is pretty much guaranteed to grind your system to a halt.
I would choose option 3 – one process containing a fairly small thread pool. That way, some jobs will execute simultaneously and the rest will queue up and wait their turn. This approach also scales well if a very large number of jobs are going to be run.
See the ThreadPool class, or preferably, one of the many higher-level abstractions on top of it (e.g. the task library, or even plain old asynchronous delegates).