Follow-up from Yesterday's Recitation

 

Notes about execl()
Several students corrected me in class today, and I have verified what they
said about the execl() system call. Basically, when using this
function, the first parameter must be the fully-qualified pathname to the
executable that you wish to run, and the second paramater must be the value
that you want the OS to give to argv[0] when said program executes.
Typically, this will be the same as the executablet that you are executing.
Here is an example:

	execl ("/bin/df", "df", "-k", NULL);

This will correctly execute the "df" program, leaving the string "df" in
argv[0] and the string "-k" in argv[1].

 

When child processes die:
I expressed some uncertaintly today regarding whether-or-not child processes
terminate when their parent child terminates.

The example in the Dinosaur book (p. 100), states that only some
operating systems cannot tolerate child processes to continue after the life of
the parent, and lists VMS as an example.

Solaris is NOT such an operating system (nor is any other modern UNIX
variant).

Thus, if your parent exits while your children are still executing, they will
continue to execute, until they terminate. If this happens to you, follow the
following procedure:

	1. Type "ps -ef |grep ", where "process_name" is the name
	   of your program ("a.out", for example).
	2. Based upon that output, look for the PIDs for each process that you
	   wish to terminate.
	3. Terminate each process using the "kill" command.
	4. If "kill " doesn't work, try "kill -9 ".

 

Question about the "Wall clock" time:
There is some ambiguity concerning the "Wall Clock" time. You can either print
the current time at the beginning and end of your program, or the difference,
whichever you prefer. Also, it's not mandatory that you use the ctime()
function, but that is the easiest thing to do.

 

Don't worry about the BSD libraries!
On Solaris, the BSD libraries aren't necessary in order to use getrusage().
Just make sure that you have the following line in your .c file:

	#include < sys/resource.h >

And everything should work out.

 

Grading:
Some progress has been made on this front, and I expect Tekin to update his
webpage in the near future, posting with the "official" guidlines. Hooray.