|
CSE Home |
About Us |
Search |
Contact Info |
Due: Thursday, May 20, at 11 pm.
In this assignment we explore some of the basics of processes and threads.
value is a global variable and the function main is
the code that makes up the program. A wait(NULL) function call
causes a process to pause until its child processes exit. A return inside main terminates
the current process. The printf function prints the string "value
=" followed
by the contents of variable value.)
int value = 5;
int main {
pid = fork();
if (pid == 0) {
value = value + 15;
return 0;
} else {
wait(NULL); /* wait for child process to terminate */
printf("value = %d", value); /* LINE A */
return 0;
}
Turn-in Instructions: Use the turn-in drop box link on the main course web page to submit a file containing your solutions. You can use any common file format, including plain text, word, or pdf. If you wish, you could also scan in a hand-written solution and submit that, but if you do that, please be sure your handwriting is neat and legible. Please be sure to include your name at the top of your answers.
|
Computer Science & Engineering University of Washington Box 352350 Seattle, WA 98195-2350 (206) 543-1695 voice, (206) 543-2969 FAX [comments to Hal Perkins] |
|