Skip to main content

Unix Function To Get Process Identification Number

Process Identification

getpid() is the Unix function which enables us to get the identification number of a process.

Example Program For getpid()

     Int pid;
     pid = getpid();
     printf("Process ID is %d\n", pid);

The pid value will depend on the number of processes already running. It will always be unique. This pid cannot be changed although it may be re-used once the process no longer exists. UNIX itself, takes care of this.