Write a program that takes a single integer argument n from the command line and creates a binary tree of processes of depth n. When the tree is created, each process should display the phrase “I am process x” and then terminate. The nodes of the process tree should be numbered according to a breadth-first traversal. (example and diagram omitted)
Make sure that the original parent process does not terminate until all of its children have
died. This is so that you can terminate the parent and its children from your terminal with a
Control-C.
This program should call fork () twice to generate two child processes for each level. The child
code segment will need to print the message and then check to see if it is the last level to be
generated. If it is not, then it should repeat a pair of fork () processes of its own. The parent should
call wait () to wait on each of its children to terminate.
You might also like to view...
Which of the following is not a serial interface?
a) USB b) IEEE 1394 (FireWire or iLink) c) SCSI d) none of the above
What would the browser output if the following script is executed?
```
< SCRIPT LANGUAGE = "JavaScript" >
var array = [ [ 1, 2, 3 ], [ 1, 2, 3 ] ];
for ( var i in array ) {
for ( var j in array[ i ] )
document.write( array[ i ][ j ] + " " );
document.writeln("
");
}
< /SCRIPT >
```
a) Nothing, the script would generate an error
b) 1 2 3
c) 1 2 3 4 5 6
d) 1 2 3 1 2 3
All of these facts describe multiprocessing systems EXCEPT ____.
A. An example is the Macintosh Multifinder B. Involves running a single program on several CPUs at once C. A related development was the ability of a program to start another program D. The concept of a single user running several programs at once was extended to desktop microcomputers in the late 1980s
What types of networks supply a great deal of complexity, security, and power, and are made possible through the use of advanced networking devices? (Select all that apply.)
A. virtual private networks (VPNs) B. Ethernet LANs C. dial-up D. virtual LANs E. Both A and D