thread pool
-
hai, what is the limit for number threads we can create in our machine...i heard that is 2000...is it right? if it is so, den Using IOCP in a thread pool, how many threads, we can create..? reply me Mani
Born to win...!
-
hai, what is the limit for number threads we can create in our machine...i heard that is 2000...is it right? if it is so, den Using IOCP in a thread pool, how many threads, we can create..? reply me Mani
Born to win...!
I don't know if there is a real physical limitation but for you, I think the limitation will be how far would you accept the slowdown of your program ? Using that many threads will bring your program to its knees and it will spend more time switching between the threads than doing effective things. Some people already told you that, so why do you want to go that direction ? Why do you want to try to readh the limits of your system ? It's certainly not the most efficient way to do it.
Cédric Moonen Software developer
Charting control [v1.2] -
hai, what is the limit for number threads we can create in our machine...i heard that is 2000...is it right? if it is so, den Using IOCP in a thread pool, how many threads, we can create..? reply me Mani
Born to win...!
As stated in MSDN the maximum maximorum number of threads you can create is 2028. That is the limit for the default stack size of 1 MByte. However if you increase the stack size (see dwStackSize, second parameter in CreateThread documentation), the number of threads that can be created decreases accordingly. -- modified at 3:31 Friday 23rd November, 2007 ... and don't forget to count the threads already existent ... ;)
Ovidiu Cucu Microsoft MVP - Visual C++
-
I don't know if there is a real physical limitation but for you, I think the limitation will be how far would you accept the slowdown of your program ? Using that many threads will bring your program to its knees and it will spend more time switching between the threads than doing effective things. Some people already told you that, so why do you want to go that direction ? Why do you want to try to readh the limits of your system ? It's certainly not the most efficient way to do it.
Cédric Moonen Software developer
Charting control [v1.2]hai, just i want to know the maximum limit for the threds when Using IOCP..., Creating that many threads is the complex way, that is correct...i am accepting... but i want to know how many threads we can create in IOCP....
Born to win...!
-
hai, what is the limit for number threads we can create in our machine...i heard that is 2000...is it right? if it is so, den Using IOCP in a thread pool, how many threads, we can create..? reply me Mani
Born to win...!
I'm not sure if I answered this for you a couiple days ago, but here it is again... There's almost NO need to have more threads than you have processors. There's never going to be more threads than the number of available processors executing at the same time, so any other threads are sitting there wasting memory and other resources. The whole idea of an IOCP is based on these facts. The IOCP acts like a FIFO queue where each operation is queued to the next available thread. It's extremely efficient in both speed and resource usage, since you only need at most, a couple threads per processor. If you're even considering the maximum number of threads Windows is going to let you create, then an IOCP is useless and you're going to have a serious performance problem with your application. Here's some handy articles - they are socket related, but the same IOCP principles apply (IOCPs can be used for more than just servers :)) Writing Windows NT Server Applications in MFC Using I/O Completion Ports[^] Windows Sockets 2.0: Write Scalable Winsock Apps Using Completion Ports[^] INFO: Design Issues When Using IOCP in a Winsock Server[^] <-- see tip #2 here for choosing thread pool size!! Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I'm not sure if I answered this for you a couiple days ago, but here it is again... There's almost NO need to have more threads than you have processors. There's never going to be more threads than the number of available processors executing at the same time, so any other threads are sitting there wasting memory and other resources. The whole idea of an IOCP is based on these facts. The IOCP acts like a FIFO queue where each operation is queued to the next available thread. It's extremely efficient in both speed and resource usage, since you only need at most, a couple threads per processor. If you're even considering the maximum number of threads Windows is going to let you create, then an IOCP is useless and you're going to have a serious performance problem with your application. Here's some handy articles - they are socket related, but the same IOCP principles apply (IOCPs can be used for more than just servers :)) Writing Windows NT Server Applications in MFC Using I/O Completion Ports[^] Windows Sockets 2.0: Write Scalable Winsock Apps Using Completion Ports[^] INFO: Design Issues When Using IOCP in a Winsock Server[^] <-- see tip #2 here for choosing thread pool size!! Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
There's almost NO need to have more threads than you have processors. Just almost.
Ovidiu Cucu Microsoft MVP - Visual C++ Cofounder CODEXPERT.RO
-
There's almost NO need to have more threads than you have processors. Just almost.
Ovidiu Cucu Microsoft MVP - Visual C++ Cofounder CODEXPERT.RO
Yes, almost. For threads that wait for periods of time, like doing device I/O, there can be an advantage having more threads since during those I/O waits other threads can get some work done. It's something that has to be tuned depending on what the threads are or can be doing, available resources, etc. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: