#include
#include
#include
Int main ()
{
Int pid1=fork ();
If (pid1 & lt; 0)
{
Printf (" failed to create the child \ n ");
}
Else if (pid1==0)
{
Printf (" \ n B ");
}
Else if (pid1 & gt; 0)
{
//create a child process
Int pid2=fork ();
If (pid2 & lt; 0)
{
Printf (" failed to create the child \ n ");
}
Else if (pid2==0)
{
Printf (" C \ n ");
}
The else
{
Printf (" A \ n ");
}
}
return 0;
}
CodePudding user response:
Because A and C are not output together, they two output in different processes, are independent of each other,A, B, C to output that is random ~
CodePudding user response:
To solve theProblem: virtual machine is a single core
Then increase the quantity of nuclear to normal
CodePudding user response:
How to increase the number of nuclearCodePudding user response: