Answer to Question #315509 in UNIX/Linux Programming for Attique

Question #315509

How many number of processes will be created in the following program? Prove your answer by making a replica code that will count no of processes created.


int main()

{

  fork();

  fork();

  fork();

  fork();

}



1
Expert's answer
2022-03-24T18:13:41-0400
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(void)
{
  pid_t pid = fork();
  pid = fork();
  pid = fork();
  if (pid == 0)
  {
    fork();
  }
  fork();
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS