In the last reading, we were introduced to the concept of a process, which is a program in execution. In this reading we’ll learn how to control processes, including how to create them, how to make them stop, and how to make them change what they are doing.
Sections 8.3 - 8.4 (pp. 737-756) from the course textbook.
Each student will be responsible for learning and demonstrating proficiency in the following objectives PRIOR to the class meeting. The reading quiz will test these objectives.
fork system call.fork and exit, draw a process graph.execve and describe how it differs from the fork function.fork and execve are used by a shell.getpid, getppid, exit, fork, wait, sleep, and execve. The following objectives should be mastered by each student DURING and FOLLOWING the class session through active work and practice.
fork, determine how many processes there will be each point during execution.fork and execve).These exercises are geared towards mastering the BASIC learning objectives listed above. You are expected to submit them before class and it is highly recommended that you complete them before attempting the reading quiz.
Give a one sentence summary of the functionality of the following system calls. Use your own words (i.e. don’t just copy from the book).
getpidgetppidwaitexecveWhat is meant by the statement, “fork is called once but returns twice?” Again, use your own words, not the book’s.
Draw a process graph for the following code, using the style show in Figure 8.17 in your textbook. Assume that calls to Fork always succeed.
int main() {
if (Fork() == 0) {
Fork();
printf("yay!");
exit(0);
}
printf("woohoo!");
Fork();
exit(0);
}How does the address space of a newly create process compare with the address space of its parent?
How does a shell use the fork and execve to execute a program that you type in?