4 ms·
So, it seems like the main speedups were from removing a ton of kernel modules, replacing the init system with the target application, and then some optimizatio
by fouric 5y ago
So, it seems like the main speedups were from removing a ton of kernel modules, replacing the init system with the target application, and then some optimization of the target application. That's pretty neat!
But let's go further - while we're trading flexibility for performance, why couldn't the entire kernel and userspace be precompiled+loaded into a single image file - like a Smalltalk/Lisp image - and loaded directly into memory, modulo some really-truly-has-to-be-done-upon-power-up initialization?
Sure, there's hardware that has to be brought up - so, right after initializing basic access to the SD card and RAM, this hypothetical bootloader could initialize another core and use that to bring up the random SoC subsystems while the kernel image is being copied into RAM.
And, yes, this would mean that you would need to re-compile that image every time you updated the kernel (or any of the userspace stuff inside) - but, again, we're sacrificing flexibility for performance.
Is this possible? Has anyone done something like it before?
- fanf2 5y agoSounds like installing the application as init inside the kernel’s initramfs.
- yissp 5y agoI'm not super familiar with the concept, but isn't this sort-of what a "unikernel" is?
- userbinator 5y agoAt that point, why not just get rid of the OS? That's what small embedded systems basically are --- there's not bootloader or any other extraneous complexity, the MCU starts up from the reset vector directly into the "application code". Using Linux or some other full-blown OS is why a lot of newer embedded stuff like "smart" TVs, set-top boxes, etc. need to "boot" before they're usable. Regardless of how much you try to optimise the process, it won't beat a simple MCU or the "old school" non-computerised systems from power-on until usable.
- fouric 5y agoBecause the thing I described is still more flexible than having no OS at all. If you bundle some of the userspace into the kernel image, then you trade-off some security, and needing to have to rebuild this large image periodically, for much faster startup times, and (optionally) load times for some userspace applications - but you can still install and load other userspace tools, they'll just start up "normally".