double fork using vfork

Posted by Oren S on Stack Overflow See other posts from Stack Overflow or by Oren S
Published on 2010-04-11T14:09:52Z Indexed on 2010/04/11 14:13 UTC
Read the original article Hit count: 238

Filed under:
|
|
|

HI
I am writing a part of a server which should dispatch some other child processes.
Because I want to wait on some of the processes, and dispatch others without waiting for completion, I use double fork for the second kind of processes (thus avoiding the zombie processes).
Problem is, my server holds a lot of memory, so forking takes a long time (even the copy-on-write fork used in Linux which copies only the paging tables)
I want to replace the fork() with vfork(), and it's easy for the second fork (as it only calls execve() in the child), but I couldn't find any way I can replace the first one.
Does anyone know how I can do that?
Thanks!

The server is a linux (RH5U4), written in C++.

© Stack Overflow or respective owner

Related posts about c++

Related posts about c