Jump to content

Recommended Posts

Posted (edited)

Hi,

recently i have discovered a situation which is to my knowledge not possible. In 32 Bit Windows there exists a limit of about 2000 Threads per Process due to the fact that every thread reserves 1MB Stack Space.

Take a look at the screenshot attached. There is a single Java Process which has over 2500 Threads! How is this possible? The machine is a standard Win2k Advanced Server.

Any ideas?

Egon

post-57416-1120562129_thumb.jpg

Edited by egrath

Posted

Hi,

found one possible solution.

The default stack size of a Thread is 1MB. Therefore you can only create about ~2000 Threads per Process due to the 2 GB Limit per Process on 32 Bit Windows. But if you know that your Threads never will need a Stack of 1 MB you can decrease the size when creating a new one with the CreateThread Win32 API Function.

If you for example use a stack size of 0.5 MB you can have about 4000 Threads and so on ...

Egon

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...