[Development] QProcess fork() failure and overcommit

Thiago Macieira thiago.macieira at intel.com
Wed Mar 8 15:29:28 CET 2017

Em quarta-feira, 8 de março de 2017, às 14:44:51 CET, Ulf Hermann escreveu:
> > That said, look at the numbers: it increased from ~100 µs to 16.9 ms in
> > the
> > worst case. You can't perceive that difference.
> This limits the number of processes you can spawn per second to about 60
> (and it goes lower if you eat more RAM).

Why would Qt Creator want to spawn more than 60 processes per second? 

> I certainly can notice this
> when using the version of qbs compiled into QtCreator to compile a
> project. In order to keep an 8-core CPU loaded and send extra jobs to
> icecream you need a higher rate.
> There is a workaround for that by now, which just uses a separate
> process to spawn the children, but it used to be a problem.

Oh, that explains.Separate process is the correct solution. I

've just tried gmake in a very simple project and it called vfork() 26 times 
in a total runtime of 0.5 seconds -- that is, 52 times per second. That's a 
total count in the same order than the overhead inside Qt Creator.

Note: gmake uses vfork(), whose stated goal is to avoid doing a page table 
duplication; QProcess and forkfd cannot do that.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Development mailing list