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("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
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
Get step-by-step solutions from verified subject matter experts
