Each process is created with a unique process id (type pid_t is an integer).
A process can lookup its own pid, and the pid of its parent:
#include <unistd.h>
#include <sys/types.h>
pid_t getpid(); // returns calling process's pid
pid_t getppid(); // returns calling process's parent's pid