Reputation: 590
What is the maximum process id I can get by calling DWORD GetProcessId(HANDLE)
or DWORD GetCurrentProcessId()
? It is not documented on the API's documentation page.
Upvotes: 20
Views: 25462
Reputation: 7199
According to the Pushing the Limits of Windows: Processes and Threads blog post by Mark Russinovich number of processes is limited only by available memory. So theoretically maximum process id is DWORD_MAX aligned to 4: 0xFFFFFFFC (as pid/tid values are aligned to 4 on Windows).
Upvotes: 19
Reputation: 2313
I couldn't find an official statement on it but since it's stored and returned as a DWORD you should assume it can use the entire 32-bit range. In practical systems I've never seen a PID large than ~200,000 though - since Windows will reuse PIDs they rarely get larger.
Upvotes: 5