Given the following environment
#include
#include
int main()
{
pid_t pid;
// Code Fragment Goes Here
return 0;
}
Write a code fragment that creates a child process and displays a message telling the user whether the process is the parent process or the child process along with the Process ID.
pid = fork();
if (pid == 0)
cout << " Child - Process ID " << getpid() << endl;
else
cout << "Parent - Process ID " << getpid() << endl;
You might also like to view...
Which of the following is a collection of articles and amendments that provide a framework for the American government and define citizens’ rights?
A) The Constitution B) The Torah C) Data Protection Act D) Consumer Credit Act
_________________ provides proof of the genuineness of the user.
Fill in the blank(s) with the appropriate word(s).
The ____ method of the Math class returns the square root of the number.
A. SquareRt(x) B. SqRoot(x) C. SquareRoot(x) D. Sqrt(x)
The superscalar approach can be used on __________ architecture.
A. RISC B. CISC C. neither RISC nor CISC D. both RISC and CISC