Jamie Lokier wrote: > Avi Kivity wrote: > >>> I know this has been discussed before, but isn't this why there are >>> things like vfork()? >>> >> vfork() doesn't work with threads - it requires that the calling process >> be halted until exec() is called. >> > > On Linux (NPTL), vfork() is good for this. It only halts the calling > thread. Other threads continue to run, and when the vfork'd thread > called exec*(), it doesn't affect the other threads. Of course this > behaviour isn't portable, but then again, neither is KVM. > Yup, see attached program. Here's the output which confirms this is the case. tick sleeping tick tick tick tick tick tick tick tick tick done sleeping vfork() returned hello world Regards, Anthony Liguori