Recently I blogged about HighPid, a tool to generate high PID (process id) and TID (thread id). Although this tool considers IDs high if they are more than 2^16, I wondered if I can get the IDs to be real high. Well after recompiling and running the tool I could not generate IDs beyond around 300,000. Here is a plot of how the system PIDs reached to 300k+ after roughly around 35000 iterations on my Vista x86 host.
Contrary to what I expected, the ID generation in Vista seems pretty predictable especially at higher ranges. [There are serious security implications of this but that would perhaps be another post.] At the 300k+ range , process creation eventually fails and HighPid gives up. The simple design of HighPid needed to be rethought out. Since thread creation via win32 API CreateThread was much cheaper than creating a process (CreateProcess), it seemed like a more scalable option to try out. The new HighPid (v2.0) help text looks like below.
Note the /g option that lets one specify ID values higher than 65535 (the default minimum).
After several other tweaks to the source, it was time to try things out. And as it turned out, claiming IDs by calling CreateThread paid off big time. I could generate much higher process and thread IDs than I could with the previous code. Here is a snapshot of HighPid v2.0 in action.
It is nice to see 7 million+ PIDs (23 Bits) on the same system after claiming around 1.8 million+ thread IDs (and consequently thread handles) in a single process. CreateThread eventually fails with ERROR_NOT_ENOUGH_MEMORY (Error 8 – Not enough storage is available to process this command) or ERROR_NOT_ENOUGH_QUOTA (Error 1816 – Not enough quota is available to process this command).
While that is a 20+ time improvement over previous runs, can HighPid go even higher ? Stay tuned.
Hello Satya and all
-> Great Tool!
I’d like to use it on XP and Windows Server 2003 for some strange undefined corba behaviour.
However I can’t use the /g opton of Highpid V2.0
eg. I’d like to force a pid higher 16000 -> /g 0A—3E80 or 3E80 or 0A—3e80 or 3e80 doesn’t work.
I’am always getting the following Message: Create Thread failed with error 8. Handels leaked 2018 Maximum ID claimed 12824
Event I I try a lower pid with /g option Dez 5000 -> Hex 1388 I get the same Error, just the Maximum ID changes.
Would be great to get any solution or an example of the syntax if it’s not depending on XP or Windows 2003.
Thank You and Regards,
Tap