[This question is for UNIX/Linux users.] Use functions fork and exec to emulate function system. The parent should use the wait function to wait for a child process to finish be- fore continuing. Run the command "cat ex18_03.py".
What will be an ideal response?
```
#!/usr/local/bin/python
import os
import sys
pid = os.fork() # create first child
if pid != 0: # parent
straggler = os.waitpid( pid, 0 )
elif pid == 0: # child
os.execvp( "cat", [ "cat", "ex18_03.py" ] )
else: # error creating first child
sys.exit( "Problems forking child" )
```
# Exercise 18.3: ex18_03.py
#!/usr/bin/python
import os
import sys
pid = os.fork() # create first child
if pid != 0: # parent
straggler = os.waitpid( pid, 0 )
elif pid == 0: # child
os.execvp( "cat", [ "cat", "ex18_03.py" ] )
else: # error creating first child
sys.exit( "Problems forking child" )
You might also like to view...
How many Book objects are created by the following statement? Book[] books = new Book[10];
a. 10 b. 0 c. 5 d. None of the above.
The system recovery drive provides an option for ____ a system image previously created.
A. scanning B. booting C. backing up D. restoring
In general, what guidelines should you follow as you work on projects in Microsoft Office 2013?
What will be an ideal response?
A(n) ____ is a master copy of an object that is stored in the library.
a. vector b. instance c. embed d. symbol