9 messages in com.xensource.lists.xen-develRE: [Xen-devel] a question about pope...
FromSent OnAttachments
xuehai zhang23 Nov 2005 12:25 
Petersson, Mats24 Nov 2005 02:07 
xuehai zhang24 Nov 2005 06:01 
Petersson, Mats24 Nov 2005 06:47 
xuehai zhang24 Nov 2005 07:40 
Petersson, Mats24 Nov 2005 07:50 
xuehai zhang25 Nov 2005 16:36 
Rustam Bhote26 Nov 2005 21:30 
Petersson, Mats28 Nov 2005 02:01 
Subject:RE: [Xen-devel] a question about popen() performance on domU
From:Petersson, Mats (mats@amd.com)
Date:11/28/2005 02:01:10 AM
List:com.xensource.lists.xen-devel

Because it's using the same source for glibc! glibc says to use _IO_fork(), which is calling the fork syscall. Clone would probably do the same thing, but for whatever good or bad reason, the author(s) of thise code chose to use fork. There may be good reasons, or no reason at all to do it this way. I couldn't say. I don't think it makes a whole lot of difference if the actual command executed by popen is actually "doing something", rather than just an empty "return".

Mats, I am not very sure about your comment in the last sentence. Are you suggesting the command passed to popen should have no big effect on popen's performance?

No, my point was that clone and fork are very similar, and if you ACTUALLY do something in the forked/cloned process, the difference betweent the two process creating mechanisms would be very similar - however, if you don't do anything inside the popen, you get to see the difference. The thing is that popen is meant to spawn a process that actually does something - at least that's the general idea. That is why this sort of microbenchmark that tests a paricular system call is often quite useless - if you where to spawn of a gcc compile, do you think the time taken to actually perform popen would be noticable, compared to the compiling of some kilobytes of source-code [if you use -pipe on gcc I believe it would use popen to create the next level compile]?

Application benchmarks are much more meaningfull for the end users and with the right tools can be used to direct the kernel developers to look at the right areas of the kernel to increase the performance of the system - which is probably not going to be suboptimisations inside popen.

Thanks. Xuehai