A static library archive le 362 abelian group 56

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 8.14(c). There are a total of four processes, each of which prints a single “hello” line. Thus, the program prints four “hello” lines. Problem 8.3 Solution: [Pg. 408] This program has the same process hierarchy as the program in Figure 8.14(c). There are four processes. Each process prints one “hello” line in doit and one “hello” line in main after it returns from doit. Thus, the program prints a total of eight “hello” lines. Problem 8.4 Solution: [Pg. 411] 726 APPENDIX B. SOLUTIONS TO PRACTICE PROBLEMS A. Each time we run this program, it generates six output lines. B. The ordering of the output lines will vary from system to system, depending on the how the kernel interleaves the instructions of the parent and the child. In general, any topological sort of the following graph is a valid ordering: --> ‘‘0’’ --> ‘‘2’’ --> ‘‘Bye’’ / ‘‘Hello’’ \ --> ‘‘1’’ --> ‘‘Bye’’ parent process child process For example, when we run the program on our system, we get the following output: unix> ./waitprob1 Hello 0 1 Bye 2 Bye In this case, the parent runs first, printing “Hello” in line 8 and “0” in line 10. The call to wait blocks because the child has not yet terminated, so the kernel does a context switch and passes control to the child, which prints...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online