3

Do some versions of Windows 7 (32 or 64 bits) manage the number of threads that any specific process are creating? If so, is there a way to configure a maximum limit of threads on system (in the registry for example)?

4
  • Is this a question for your own program? Or do you want to limit other programs on your system?
    – EBGreen
    Jun 21, 2011 at 20:23
  • I want to limit the thread number that my windows handle.
    – Diogo
    Jun 21, 2011 at 20:27
  • Nothing you can do about it then if you didn't write the program that is creating threads.
    – EBGreen
    Jun 21, 2011 at 20:28
  • And just to be clear, even if there were a way to limit it, you would most likely just break the program that is trying to make a new thread. If the program was properly coded it would handle the failure to create the thread, but at best it means that the program would not be able to do whatever it was creating the tread to do.
    – EBGreen
    Jun 21, 2011 at 20:31

3 Answers 3

4

The OS does not explicitly limit the creation of threads. It is essentially controlled by resource constraints. If the OS has the resources the the process can create as many threads as it wants until there are no more resources.

1
  • In a 32-bit app running without the "large address aware" option, assuming the app has not overridden the default stack allocation, there is a derived limit of somewhat less than 2000 threads per process. This is because the default reserved stack size is 1 MiB, and the process user mode address space is 2 GiB. "Somewhat less" is because there is already some stuff in the address space just to support any simple program (so you don't have quite 2 GiB free in a new process, and what you do have isn't all in one contiguous chunk). Oct 24, 2015 at 18:29
1

The technical concept to achieve this is a Job which allows for Limits.

There's pretty much that can be limited, but not the threads (at the time answering the question).

1

Yes, you (sort of) can. With multi-processor cpu's, you can set the number of cores used by a program. For instance, an I8 cpu with 8 cores, you can limit your computer to use a max of only 7 cores (or 6,5,4..). Run task manager (ctrl-alt-del), goto Processes and select the program. Right click on the program name and select 'set affinity'. A window will open up showing available cores for the program and here you can remove, or add later, cores for your program to use.

1
  • 1
    I don't believe there is an i8 CPU. Intel only has i3, i5, and i7 CPUs. Please clarify. Feb 1, 2018 at 17:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .