Apr 23
old business : homework
There were some questions last week about the waitpid() system call;
see "man waitpid".
#include <sys/types.h>
#include <sys/wait.h>
pid_t waitpid(pid_t pid, int *status, int options);
args :
pid child process id to wait for. -1 means "any child process".
*status address of location to put status on return.
NULL means don't return status information.
options whether to return immediately or not. 0 means wait.
The generic "reap exited children" call is
waitpid(-1, NULL, 0)
It's probably also worth mentioning the environment
variables example I threw in at the end of that file - I've had
folks confused by that in the past.
future business : projects
Questions on final project lab assignement?
I would like you to do class presentations
on the last day of class ... which is two weeks from today.
Expect lighter weekly homework ... and use the time well.
Do ask questions as they come up, eh?
new business : chap 9, virtual memory
Start in on the chapter 9 material, on virtual memory and malloc.
We'll see how far we get through this material,
and continue Thursday.
What you should focus on:
- virtual memory - basic ideas only - we're skimming details
- mmap - a cool "file copy" trick
- malloc & garbage collection - fundamental to coding practice
Practice 9.5
mmap copy ; see /code/mmap
Practice 9.6
* blocks in multiples of 8
* 4 byte header ; +1 if allocated
Walk through 9.11 : "common memory related bugs"; discuss.
(Homework for next week is to write code examples.)