[Development] QProcess fork() failure and overcommit

Christian Kandeler christian.kandeler at qt.io
Wed Mar 8 13:51:49 CET 2017


On 03/07/2017 10:05 PM, Thiago Macieira wrote:
> Em terça-feira, 7 de março de 2017, às 17:53:41 CET, René J.V. Bertin 
> escreveu:
>> One tends to forget (I do at least) that spawning a little helper process
>> can be quite expensive, sometimes prohibitively so. Makes you wonder what
>> kind of cross-platform alternatives there are!
> 
> It shouldn't be.
> 
> fork() does need to copy the page tables and mark the pages as shared. It also 
> means COW of certain pages. But the overhead shouldn't be that big.
> 
> If anyone is seeing this, can you run your application with strace to get the 
> timings? 
> 
> 	strace -T -e clone

I use the default settings for overcommit (0/heuristic). My application
starts QProcesses in a loop. If the application has not allocated
additional memory, strace -T for clone() gives:

<0.000079>
<0.000091>
<0.000205>
<0.000090>
<0.000119>
<0.000112>
<0.000231>
<0.000096>
<0.000114>
<0.000112>

Here's the same application using 1GB of additional memory:

<0.012753>
<0.016715>
<0.015152>
<0.014449>
<0.012960>
<0.016914>
<0.013560>
<0.013337>
<0.012911>
<0.013019>

So, factors around 100?
(Also, I get lots of ERESTARTNOINTR in the latter case).


Christian



More information about the Development mailing list