5

I have a programs that works with threads. I want to know what is the maximum threads limit per process in windows 10 or what is the maximum threads windows 10 can handle?

2

1 Answer 1

7

You'll hit other problems rather than any explicit cap. As explained by Raymond Chen, every thread requires some memory for bookkeeping, notably its stack (where the thread is in its execution of the program). 32-bit processes can only address 4 GB of memory, which will fit about 2,000 threads with the default 1 MB stack allocation per thread or about 12,000 with the smallest possible allocation of 64 KB per thread. 64-bit processes don't have problems with address space, but rather with the actual allocations. My system runs out of memory a little after testlimit64 -t passes 270,000 threads created.

However, programs should not approach any such limit or need to worry about it. Quoting the previously linked post (with broken links fixed):

The “one thread per client” model is well-known not to scale beyond a dozen clients or so. If you’re going to be handling more than that many clients simultaneously, you should move to a model where instead of dedicating a thread to a client, you instead allocate an object. [...] Windows provides I/O completion ports and a thread pool to help you convert from a thread-based model to a work-item-based model.

You must log in to answer this question.

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