3 ms·
One reason to avoid bare metal is drivers. There is a lot of hardware around. New hardware is released every day. And you need to write and maintain drivers for
by vbezhenar 6y ago
One reason to avoid bare metal is drivers. There is a lot of hardware around. New hardware is released every day. And you need to write and maintain drivers for that hardware. That's a tremendous effort and hardware manufacturers usually write drivers for a very few operating systems and Go unikernel certainly won't be one of them.
Using virtualization provides a simple common layer, so host operating system can deal with drivers and guest operating system can deal with more interesting things.
- toast0 6y agoOf course you'll need to write a OS specific driver for critical hardware like interrupt controllers and system timers, but drivers for other things like network cards and disk controllers can be reused if you adopt the other OS's interfaces. Things like ndiswrapper exist to use windows drivers on Linux or FreeBSD; Linux, FreeBSD, and NetBSD also have a large pool of drivers, which can be used depending on which system's driver model you like best.
- voltagex_ 6y agoLet's say I grabbed the e1000 driver from Linux, how much of the Linux kernel would I end up re-writing (badly)?
- Koshkin 6y agoWhy not just grab some other parts of Linux? Or, better yet, link your application right into it?
- toast0 6y agoI haven't done it, and the e1000 driver is pretty big, so it's hard to scan quickly, but the general shape is you'd need to support the kernel functions the driver calls, and setup compatible kernel structures for the driver. At least the parts of the driver you call. Things like kernel malloc to setup pages and what not, mapping the device address, allocating interrupts, DMA (maybe), PCI, logging, maybe locking, basic c library stuff (memcpy etc). Some of those, you can probably just stub out, but some if it you have to do (badly or not). Some of that you probably need or want to build anyway. It's a fair bit of work, but if you want to support a lot of hardware, it's probably less work than porting a bunch of drivers.
- voltagex_ 6y agoThe e1000 came to mind because it's a commonly emulated network card. I wonder now what is more common in real servers.
- toast0 6y agoe1000 is pretty common in servers, too. It's got a lot of variations though, which makes the full driver pretty big. virtio-net is a lot easier to write a driver for, of course. :)