Leveraging process descriptors for process creation without fork

From: John Ericson <list_at_johnericson.me>
Date: Mon, 10 Jan 2022 08:55:39 UTC
Hi, I have long been interested in seeing an alternative to fork+exec implemented in a real-world Unix OS. What I have in mind is:

1. Load an executable into a fresh new unscheduled process (we might call this an "embryonic" process)
2. Set file descriptors and other state on that process
3. Submit it to the scheduler

I am far from the first person to think of this interface, of course. Since becoming interested in this, I have been referred to this paper[1], which very nicely describes the concept in detail, and also evaluates an all-userspace implementation of it.

I must admit I first emailed the Linux mailing list about this.[2] The reception was positive, but the multitude of other features[3] supported in the relevant code makes refactoring it to elegantly implement both the existing and new interfaces a rather large task.

I checked, and FreeBSD's fork and exec code is, surprise surprise, a great deal simpler, and therefore a better venue for demonstrating this feature's viability. Also, as I am interested in the feature in the context of efforts like Capsicum and CloudABI, FreeBSD is a natural starting point for cultural and historical reasons.

I am under no illusion that, even with FreeBSD's comparative simplicity, I will have time to finish this project in the near future, but I hope it is still OK to discuss the merits of the idea itself.

Thanks,

John

[1]: http://catern.com/rsys21.pdf

[2]: https://lore.kernel.org/lkml/f8457e20-c3cc-6e56-96a4-3090d7da0cb6@JohnEricson.me/T/#m6be1994668e6f34837496c86f37f9fe52bfae990

[3]: Especially binfmt_misc, if anyone was curious