P0.c



// USO SIMPLE DE fork()

#include <unistd.h>
#include <stdio.h>


int main()
{
	int id;

	id = fork();
	if(id == 0)
	{
		printf("%s %d\n", "soy el hijo con id: ", getpid());
		sleep(5);
	} else {
		wait(0);	// o (NULL) para que espere a cualquier hijo
		printf("%s %d\n", "Padre con id: ", getpid());
	}
}