Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum process Id on Windows?

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.

like image 597
Shinjikun Avatar asked Jul 25 '13 20:07

Shinjikun


People also ask

What is the maximum limit of PID?

On 32-bit platforms, 32768 is the maximum value for pid_max.

How long can a process ID be?

On Solaris, the maximum value of a process ID is a kernel tunable parameter — pidmax in /etc/system — that defaults to 30,000 and that can be set anywhere between 266 and 999,999.

What happens when Max PID is reached?

On a 32-bit system, the maximum PID is 32767. Each time the limit is reached, the kernel resets its process ID counter so that process IDs are assigned starting from low integer values. And it will be reset to 300, rather than 1.

How many digits is a PID?

All PIDs are nine digit numbers that begin with a 7.


2 Answers

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).

like image 152
Sergey Podobry Avatar answered Sep 22 '22 07:09

Sergey Podobry


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.

like image 26
HerrJoebob Avatar answered Sep 19 '22 07:09

HerrJoebob