开发者

TaskFactory in Windows service

My app is using TaskFactory to do its work . If the user wants some instances of my app to start, when they log on, they put it as an startup entry. To avoid this I wish t开发者_如何学Pythono make a service which will spawn multiple threads, which will do the same work as my app. Because TaskFactory uses ThreadPool and there is only one thread pool per app instsnce, will that affect my performance?


No, it's unlikely you'd see any performance hits. The ThreadPool starts with many available threads. Unless you're using more threads than available in the thread pool (which suggests you need a different architecture anyways), you should be fine.

Keep in mind that more threads does not necessarily mean better performance. If you have a 4 core CPU, your max throughput is 4 threads. (And even then, that's if no other apps are using those cores.) Throwing more threads at the problem from that point will not improve the performance of your app.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜