logoISU  

CS 456 - Systems Programming

Spring 2024

Displaying ./code/feb08/fork.c

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

int main(int argc, char **argv){
	

	printf("I'm printed once!\n");
	fork();
	// Now there are two processes running
	// and each process will print out the next line.
	printf("You see this line twice!\n");
	fork();
	printf("How many times will we see this line?\n");
	fork();
	printf("and this?\n");


	return 0;
}