#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>

int main(){
	int i, n; 
	pid_t childpid;
	n = 5;
	printf("Jestem ojcem (moj PID: %i, moj PPID: %i).\n", getpid(), getppid());
	for (i = 1; i < n;  ++i)
	{
		childpid = fork();
		if (childpid == 0) // potomek
		{
			sleep(5);
			printf("Jestem procesem nr %i (moj PID: %i, moj PPID: %i).\n", i, getpid(), getppid());
			break;
		}
	}
	return 0;
}

