Re: Other window managers and desktop environments
Re: Other window managers and desktop environments
- Subject: Re: Other window managers and desktop environments
- From: Eric Dahlman <email@hidden>
- Date: Mon, 27 Jan 2003 09:10:56 -0600
On Monday, January 27, 2003, at 06:20 AM, Nick Zitzmann wrote:
Whats the difference between typing "exec gnome-session" and just
"gnome-session"?
The main difference is "exec gnome-session" will try to make the shell
run the program even if you don't have the execute "privilege".
Sorry that is wrong. Exec has absolutely nothing to do with
circumventing execution privileges. This is all related to how child
processes are created so lets assume I am process 97 then the folling
lines do different things
xterm
Creates a child process 104 which "runs" the xterm and we wait for
that process to terminate before we go on.
xterm &
Creates a child process 107 like above but we don't wait for it to
terminate. It can go on its merry way and if we terminate before it
does the init process will adopt it.
exec xterm
This basically says make ME the xterm process. This erases the
calling process (me) and replaces it with the xterm so in this case the
xterm process has PID 97 and I am gone. My parent process which
started me out as a shell script now has an xterm for a son as the
result of a radical process change operation - the shell script they
knew and loved is just gone.
One important result of this is that if you have a script like this
xeyes &
exec xterm
find_cure_for_cancer &
That third line will never be executed since after the second line the
process which was processing the shell script is not itself any more,
it is an xterm, and it has no memory of its previous life as a shell.
So why is that actually usefull? Well in days of old before copy on
write and shared libraries keeping that process around just to have it
terminate was really a waste of resources, so exec let you free up
those resources. It also has a minimalist charm to it as the basis for
all process creation. In Unix there is not really a "start another
process" call but rather a "copy me" call followed by a "replace me
with this (exec)" call in one of the copies.
Prolly clear as mud now huh?
Hope that helped,
-Eric
_______________________________________________
x11-users mailing list | email@hidden
Help/Unsubscribe: http://www.lists.apple.com/mailman/listinfo/x11-users
Do not post admin requests to the list. They will be ignored.