Description about why the Interix process IDs are different from the Windows process IDs in Windows Services for UNIX 3.0 and for UNIX 3.5 (328860)



The information in this article applies to:

  • Microsoft Windows Services for UNIX 3.0
  • Microsoft Windows Services for UNIX 3.5

This article was previously published under Q328860

INTRODUCTION

Each Microsoft Interix process has two process identifiers (PIDs). You can view the Interix PIDs by using the ps command and the Interix functions. You can view the Microsoft Windows PIDs by using Task Manager and Microsoft Windows functions.

MORE INFORMATION

There are two reasons why the Interix PIDs and the Windows PIDs must be different:
  • When an Interix process calls the exec function, the new executable program must appear to all Interix processes as if it were the same process. For example, the PID for the new program must be the same as the PID for the old program that called the exec function.

    However, Windows requires that the new process must have a different PID than the previous one. When Windows starts the new program, Windows treats the new program as a new process. There is a very brief window-of-time where both the old process and the new process exist at the same time. The old Windows PID is still in use when the new program is created. Therefore, the old Windows PID cannot possibly be assigned to the new program.
  • While a Portable Operating System Interface (POSIX) process group exists, the Interix PID that corresponds to the POSIX group identifier (GID) cannot be re-used.

    For example, in a case where the Interix process 2045 establishes itself as the leader of a new process group, the Interix process 2045 GID is -2045. This is the negative value of the PID for the process that created the group. Process 2045 then calls the fork function and then creates a new process with Interix PID 4093 in group -2045. Then, process 2045 exits. GID -2045 still exists because process 4093 is still running. Until that group no longer exists when the last process in the group quits or otherwise leaves the group, the POSIX standards and the UNIX standards dictate that no new process can be assigned ID 2045.

    However, Windows is not constrained from reusing PIDs. If a process with Windows PID 2000 exits, and then a new process is created, Windows can assign the process a PID of 2000.
The requirements of POSIX, the requirements of UNIX, and the way that Windows itself works, make it impossible for the Interix identifiers and the Windows identifiers to be the same.

Modification Type:MajorLast Reviewed:7/27/2004
Keywords:kbinfo KB328860 kbAudDeveloper kbAudITPRO