Click to See Complete Forum and Search --> : windows internals!
kunjachan
December 8th, 2005, 08:03 AM
Hi!!
am trying to figure out answers to following qns in a windows environment:
-how many threads are allowed per process , any known limitations?
-what is the process space/address space/stack size allocated per process?
-whats the max. memory that could be available for allocation per process/thread?
I am just finding myself curious with windows internals. Could somebody answer me...also some nice kool links on relevant topics?!
Thanks! :wave:
googler
December 12th, 2005, 02:51 PM
-how many threads are allowed per process , any known limitations?
There is no hardwired limit. You're limited by the amount of system memory. It's also possible to enable quotas on NT/XP, so that may limit you but I don't know the details. Quotas are not usually on.
-what is the process space/address space/stack size allocated per process?
I don't know what you mean by process space. The user-mode address space size on 32-bit Windows is 2GB. You can raise it to 3GB with a boot-time switch. On 64-bit Windows the sky is the limit.
To get the current size of the stack for the current thread, use
((PNT_TIB)NtCurrentTeb())->StackBase
((PNT_TIB)NtCurrentTeb())->StackLimit
The system grows the stack as needed, so the size may change. The maximum size for the stack is given in the header of the executable file,
see
IMAGE_NT_HEADERS::IMAGE_OPTIONAL_HEADER::SizeOfStackReserve
-whats the max. memory that could be available for allocation per process/thread?
If quotas are not enabled, then any thread in any process can allocate all of the memory remaining in the pagefile. If quotas are enabled, it's up to the quotas.
wildfrog
December 12th, 2005, 03:42 PM
-how many threads are allowed per process , any known limitations?There is a limit of 2^24 kernel object handles per process, but as googler said, the actual amount is limited by memory. In addition, the default stack size for a thread is 1MB, giving a default limit of ~2000 threads per process.
- petter
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.