This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tapsets/9925] task_execname(task) incorrect in process.create


------- Additional Comments From jistone at redhat dot com  2009-03-05 17:32 -------
(In reply to comment #3)
> It may be expected (given what process.create really is) but it is not
> "correct". That however can be fixed by updating the documentation...
> 
> The "task" in process.create is half the new process and half the old. I fear
> this will confuse people even if the documentation/manpage is updated.

It is as correct as we can be with the way Linux defines processes.

When a process calls fork(), a new process is created as an exact copy of the
old.  This is not half-anything -- it is a real bash process with a new PID. 
Then when the process calls exec(), that process starts running in a new
executable without changing PIDs.  From the kernel perspective, this is not a
new process at all.

>From a user perspective, the completed combination of fork-exec represents a new
process, which is probably why you say it's half-done.  However, there's nothing
that says that fork and exec must happen back-to-back.  In general, fork and
exec can be called independently at any time.

For example, a daemon might be idle listening for incoming connections.  When a
connection comes in, it calls fork.  The new PID from the fork will handle the
request, while the old PID goes back to listening for other connections.  In
this case, you have a fork creating a new process, without ever having an exec.

You may also have execs without a fork.  Consider a command like "sudo ls".  The
process flow will look something like:

  pid-1 bash calls fork -> creates pid-2 bash
  pid-2 bash calls exec -> becomes pid-2 sudo
  (sudo changes the user id to root)
  pid-2 sudo calls exec -> becomes pid-2 ls

So many different combinations of fork/exec can occur...

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=9925

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]