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

main()
{
pid_t val;
int n;

	printf("PID before fork(): %d\n", (int) getpid());

	if(val = fork()) {
		printf("PID after fork(): %d - so who am I ?\n", (int) getpid());
		int cpt = 0;
		while(1) {
			if(cpt%2 == 0) {
				for(n = 0; n < 50000000; n++);
				printf("%d \n", cpt);
			}
			cpt++;
		}
	}
	else {
		printf("PID after fork(): %d - so who am I ?\n", (int) getpid());
		int cpt2 = 1;
		while(1) {
			if(cpt2%2 == 1) {
				for(n = 0; n < 50000000; n++);
				printf("%d \n", cpt2);
			}
			cpt2++;
		}
	}
}
