execute a user process in the kernel

Dag-Erling Smørgrav des at des.no
Sat Sep 25 07:35:19 PDT 2004


Bruce M Simpson <bms at spc.org> writes:
> On Sat, Sep 25, 2004 at 01:35:07PM +0200, Dag-Erling Smørgrav wrote:
> > > If we were to implement POSIX spawn(), we'd need something like this.
> > Uh, no.  posix_spawn(3) can be implemented entirely in userland and
> > does not require any special kernel support.
> Discussions with peter@ and others on IRC have been ongoing regarding doing
> it in kernel space, so as to avoid unnecessarily expensive VM fork operations
> when 'spawning' a process.
>
> I'd be interested to hear more about your proposal for doing this in userland.

posix_spawn(3) can be implemented in terms of fork(2) / execve(2), and
if you're worried about VM overhead you can always use vfork(2) (which
has the additional benefit of allowing you to pass an error code back
to the parent process, since the child can write to the parent's
address space until it calls execve(2)).

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-hackers mailing list