January 23, 2006
Coverage: [USP] Chapter 3
Fork and Wait Exercises
- exercise 3.10 from [USP], p. 69
- exercise 3.18 from [USP], p. 74
- exercise 3.20 from [USP], p. 75
- exercise 3.21 from [USP], p. 76
Investigating Questions from Last Class
(courtesy William Kimball)
- why go through the overhead of copying process image if you
are simply going to replace it with another image?
- newer versions of fork (see 3.0BSD) do not copy the
process image on a fork until a modification to address space is made
- this is called a copy-on-write
- does system address this?
- investigate vfork
- same as fork but suspends the parent until
an exec or exit is called
- does not copy the process image, instead it
shares it
- system
calls vfork and exec then waitpid,
blocks until child terminates
- can the l family of exec calls be used
when the number of arguments are unknown until run-time?
- build a string representing the call to execlp and
then invoke it
- trivial in an interpreted, functional language such as Scheme
- how about in C?