2 in this discussion we refer to the period during

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: 443 #include "csapp.h" void doit() { if (Fork() == 0) { Fork(); printf("hello\n"); exit(0); } return; } int main() { doit(); printf("hello\n"); exit(0); } code/ecf/forkprob5.c Homework Problem 8.11 [Category 1]: How many “hello” output lines does this program print? code/ecf/forkprob6.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #include "csapp.h" void doit() { if (Fork() == 0) { Fork(); printf("hello\n"); return; } return; } int main() { doit(); printf("hello\n"); exit(0); } code/ecf/forkprob6.c Homework Problem 8.12 [Category 1]: What is the output of the following program? code/ecf/forkprob7.c 444 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 CHAPTER 8. EXCEPTIONAL CONTROL FLOW #include "csapp.h" int counter = 1; int main() { if (fork() == 0) { counter--; exit(0); } else { Wait(NULL); printf("counter = %d\n", ++counter); } exit(0); } code/ecf/forkprob7.c Homework Problem 8.13 [Category 1]: Enumerate all of the possible outputs of the program in Problem 8.4. Homework Problem 8.1...
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