I had a chance to speak with Tom Donovan of QA. Talking to Tom is like
drinking from a fire hydrant, so I can't begin to capture everything he told
me.  

In short, on *nix, the java.lang.Runtime.exec() method in turn calls fork()
on the system.  The parent process then makes a duplicate copy of itself in
order to create a child process.  The child process inherits most of the
parent's properties, including memory profile.  However Unix and Linux
systems do some tricks such that total system memory does not increase by a
value equal to the parent process memory, but rather the OS has a single
memory space (like shared memory) that is mapped to both the parent process
and the child process.  If the child process ever makes references a
variable or other memory that is shared by the parent process then the OS
will give the child process its own copy of that memory.  So if the parent
was at 100MB and a child was spawned, the child would show in the process
list also as 100MB, however the total system memory used for both processes
wouldn't necessarily be 200MB, but just the 100MB of shared memory.

Since the child process in cfexecute's case needs to run some specific
binary such as /bin/tar in my example, the cfusion child process then calls
the shell's exec command such that the cfusion process then becomes a tar
process instead.  You would see the extra cfusion process disappear and a
tar process appear.  The memory profile for that tar process would then go
from the memory profile of cfusion process to the memory profile for a
typical tar process with its own memory.  If you were watching the child
process you would be expected to see the process memory go from say 100MB
after it forked to perhaps just 3 or 4 MB after the exec command, or however
much is required to run tar.  The total system memory would then show an
increase of that 3 or 4 MB correlating to tar's operation, which was in fact
what I saw (iirc).  

I think I paraphrased it right.  Again, this is like filtering an
encyclopedia through a 5 year old.

For more, I think you want to lookup copy-on-write for fork, as well as the
shell command exec.

Steve

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:14:3793
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/14
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:14
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.14
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to