2

I started using SmartThreadPool after i read it is recommended as a replacement of thread in cases you want your threads to have their own pool.

I set the max threads number to 5 but still see in task manager that it uses 10-12 threads.

Is this problem familiar for some of you?

FelProNet
  • 689
  • 2
  • 10
  • 25
  • read this thread, it does not answer your question straight, but it explains a lot http://stackoverflow.com/questions/2043909/threadpool-setmaxthreads-and-setminthreads-magic-number – Kamil Budziewski Jul 07 '13 at 14:25
  • It explains a lot about thread pool. But SmartThreadPool suppose to be "smarter" and non static so it can be like a private pool for vip threads. As i see now it is not enough. – FelProNet Jul 07 '13 at 14:37
  • 2
    That class doesn't do anything to limit the number of threads that the CLR itself uses. – Hans Passant Jul 07 '13 at 14:47
  • I create new SmartThreadPool in my windows service and set MaxThreads=5. So i expect that my smart thread pool that i initialized will use max 5 threads. I do not care what other process do with my other system threads. – FelProNet Jul 07 '13 at 14:53
  • Great reading,might help you...http://www.codeproject.com/Articles/7933/Smart-Thread-Pool – terrybozzio Jul 07 '13 at 15:15
  • Why don't you use the Threads window in the visual studio debugger to see what the other threads are doing? Like others suggested, It's possible that the extra threads have nothing to do with your smart thread pool at all – Pete Baughman Jul 07 '13 at 18:48

1 Answers1

1

The threads used by the SmartThreadPool and the threads used by the whole application are different things. The thread pool is a collection of threads used to to some work, but a .net app will have multiple background threads (e.g. garbage collector) running at the same time, which is what you're seeing in the task manager.

Tudor
  • 61,523
  • 12
  • 102
  • 142