Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Date: Wed, 3 Jun 2015 23:14:47 -0400
From: Rich Felker <>
Subject: posix_spawn vs fork+exec test program

The attached test program can be used to measure the performance of
posix_spawn vs fork+exec under simulated memory conditions in the
parent. The options it takes are:

-n bytes	memory to allocate
-r		fragment memory into alternating ro/rw vmas
-d		dirty allocated memory
-f		use fork+exec (instead of default posix_spawn)

At -n 200000000 -r -d, I've observed a nearly 300x performance

As (somewhat) expected, with large -n but neither -r or -d, fork+exec
performs well -- all pages are COW zero pages and easily forked. But
if the pages are dirty, or if there are lots of vmas (even non-dirty
ones), fork gets very slow.


View attachment "spawntime.c" of type "text/plain" (1753 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.