#include <iostream>
using namespace std;
#include <sys/types.h> 
#include <unistd.h> 

/* getpid() and fork() are system calls declared in unistd.h.  They return */
/* values of type pid_t.  This pid_t is a special type for process ids. */
/* It's equivalent to int. */

int main(void) 
{ 
	pid_t childpid;

	int x = 5;
	childpid = fork();
	while (1) {
		cout << "This is process " << getpid() << endl;
		cout << "The parent of this process has id " 
			<< getppid() << endl;
		cout << "childpid = " << childpid << endl;
		cout << "x = " << x << endl;
		sleep(1);
		x++;
	}

	return 0;
}

