<story><title>Building a unikernel that runs WebAssembly – part 1</title><url>https://flavio.castelli.me/2023/02/07/building-a-unikernel-that-runs-webassembly---part-1/</url></story><parent_chain><item><author>JonChesterfield</author><text>Say a non-OS hacker wants a unikernel. What&amp;#x27;s the sanest way to go about getting to that?&lt;p&gt;Options that come to mind are:&lt;p&gt;- build your application as a linux kernel module, load it into a normal kernel, and generally ignore the userspace that runs anyway&lt;p&gt;- take Linux and hack it down pretty aggressively plus splice your code into it&lt;p&gt;- find some github unikernel effort and go from there (which I think the OP does)&lt;p&gt;- take some other OS - freebsd? - and similarly hack out parts&lt;p&gt;Other?&lt;p&gt;I like the idea of a x64 machine running a VM connected to a network card as a generic compute resource that does whatever tasks are assigned by sending it data over the network. It&amp;#x27;s not been worth the hassle relative to a userspace daemon, but one day I may find the time and would be interested in the HN perspective on where best to start the OS level hackery.</text></item></parent_chain><comment><author>walterbell</author><text>RedHat has been looking at Linux-as-unikernel since 2018, &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;research.redhat.com&amp;#x2F;blog&amp;#x2F;article&amp;#x2F;unikernel-linux-ukl-moves-forward&amp;#x2F;&quot; rel=&quot;nofollow noreferrer&quot;&gt;https:&amp;#x2F;&amp;#x2F;research.redhat.com&amp;#x2F;blog&amp;#x2F;article&amp;#x2F;unikernel-linux-ukl...&lt;/a&gt;&lt;p&gt;&lt;i&gt;&amp;gt; The Unikernel Linux (UKL) project started as an effort to exploit Linux’s configurability.. Our experience has led us to a more general goal: creating a kernel that can be configured to span the spectrum between a general-purpose operating system, amenable to a large class of applications, and a highly optimized, possibly application- and hardware-specialized, unikernel... other technologies occupying a similar space have come along, especially io_uring and eBPF.  io_uring is interesting because it amortizes syscall overhead.  eBPF is interesting because it’s another way to run code in kernel space (albeit for a very limited definition of “code”).&lt;/i&gt;&lt;p&gt;Code, &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;unikernelLinux&amp;#x2F;ukl&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;unikernelLinux&amp;#x2F;ukl&lt;/a&gt;&lt;p&gt;&lt;i&gt;&amp;gt; Unikernel Linux (UKL) is a small patch to Linux and glibc which allows you to build many programs, unmodified, as unikernels. That means they are linked with the Linux kernel into a final vmlinuz and run in kernel space. You can boot these kernels on baremetal or inside a virtual machine. Almost all features and drivers in Linux are available for use by the unikernel.&lt;/i&gt;</text></comment>
<story><title>Building a unikernel that runs WebAssembly – part 1</title><url>https://flavio.castelli.me/2023/02/07/building-a-unikernel-that-runs-webassembly---part-1/</url></story><parent_chain><item><author>JonChesterfield</author><text>Say a non-OS hacker wants a unikernel. What&amp;#x27;s the sanest way to go about getting to that?&lt;p&gt;Options that come to mind are:&lt;p&gt;- build your application as a linux kernel module, load it into a normal kernel, and generally ignore the userspace that runs anyway&lt;p&gt;- take Linux and hack it down pretty aggressively plus splice your code into it&lt;p&gt;- find some github unikernel effort and go from there (which I think the OP does)&lt;p&gt;- take some other OS - freebsd? - and similarly hack out parts&lt;p&gt;Other?&lt;p&gt;I like the idea of a x64 machine running a VM connected to a network card as a generic compute resource that does whatever tasks are assigned by sending it data over the network. It&amp;#x27;s not been worth the hassle relative to a userspace daemon, but one day I may find the time and would be interested in the HN perspective on where best to start the OS level hackery.</text></item></parent_chain><comment><author>bboozzoo</author><text>For starters, assuming the Linux variant, build a statically compiled application, pack it into an initramfs as the only file there, for simplicity name it `&amp;#x2F;init`, bundle the initramfs with the kernel, boot. At this point, your app should be the PID 1 and the only process running (with the exception of a bunch of kernel threads). At this point you can do whatever you want.</text></comment>