#include <iostream>
#include <unistd.h>
#include <cstdlib>
#include <sys/types.h>
#include <sys/stat.h>

using namespace std;

int main(void){
	pid_t pid=fork();
	if (pid==0){
		//parent
		cout << "started parent zombie gactory PID" << pid;
		}
	setsid();
	cout <<"factory in the background:" <<endl;
		for (int i=0; i<5; i++) {
			pid_t child=fork();
			if (child==0){
				_exit(0);
				}
			sleep(10);
			}
		cout << "create 5 zombies:" ;
		while (true){
			sleep(15);
			}

return 0;
};
