Consider the following piece of C code running on UNIX: void main() { int pid fork(); if (pid == 0) fork(); pid fork(); if (pid != 0) fork(); exit(0); How many child processes are created when executing this program? Your answer must only contain a number. Answer:

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question

Consider the following piece of C code running on UNIX:How many child processes are created when executing this program? Your answer must only contain a number. Answer

Consider the following piece of C code running on UNIX:
void main() {
int pid fork();
if (pid == 0)
fork();
pid fork();
if (pid != 0)
fork();
exit(0);
How many child processes are created when executing this program? Your answer must only contain a number.
Answer:
Transcribed Image Text:Consider the following piece of C code running on UNIX: void main() { int pid fork(); if (pid == 0) fork(); pid fork(); if (pid != 0) fork(); exit(0); How many child processes are created when executing this program? Your answer must only contain a number. Answer:
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,