Question: A simple C-program with multiple fork() is given as: main() { if (fork) || !fork()) fprintf(AA '); else if (!fork() && fork()) fprintf(BB ');

 A simple C-program with multiple fork() is given as: main() { if (fork) || !fork()) fprintf(  

A simple C-program with multiple fork() is given as: main() { if (fork) || !fork()) fprintf("AA '); else if (!fork() && fork()) fprintf("BB '); else if (fork()) else fprintf("CC '); fprintf("DD '); } a) How many processes are created totally? b) How many "AA", "BB", "CC" and "DD" are printed after the program is excuted?

Step by Step Solution

3.48 Rating (148 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The question involves a piece of C code that uses the fork system call to create child processes fork is a Unix system call that creates a new process by duplicating the calling process The new proces... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!