egrath Posted July 5, 2005 Posted July 5, 2005 (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 Edited July 5, 2005 by egrath
egrath Posted July 6, 2005 Author Posted July 6, 2005 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now