Last time on Fuchsia Friday, we dug into two prototype devices that Google is developing to run on Fuchsia, and mentioned that there’s a third “device” in the works. Today we’ll take a look at Machina, Fuchsia’s built-in emulator.
One of the greatest struggles of creating an entirely new OS, especially today, is the chicken-and-egg problem. Without good apps, why would consumers buy a product? And conversely, with no consumers, why would developers make apps?
We’ve looked, time and time again, at the possibility of Fuchsia getting Android compatibility, but what if it didn’t stop there? If Fuchsia is to be a full-fledged laptop/desktop OS, shouldn’t it also have some compatibility with apps for a traditional OS?
This is where the ‘Guest‘ app becomes relevant. Guest allows you to boot up a virtual OS, inside of Fuchsia. Officially, Guest supports Zircon (Fuchsia) and Linux-based OSes (including Debian), but there’s also evidence that suggests it’s being tested to work with Chrome OS. At the time of writing, I’ve only been able to successfully test Guest with a simple version of Linux.
This is, of course, nothing special, as we’ve been doing this for years with apps like VMWare and QEMU. Where Guest will set itself apart will be in its more direct connection between your Fuchsia device and its ‘guest’. To make this possible, Guest takes advantage of a library called Machina.
According to the official documentation:
Machina is a library that builds on top of the Zircon hypervisor to provide virtualized peripherals that integrate with a garnet system.
That seems pretty vague, so let’s dig in a bit. Generally speaking, Machina is a framework for running a second, virtual operating system on top of Fuchsia. In this way, it’s a bit like QEMU, (the emulator used by Android Studio for simulating Android devices), which is why Machina also appears in Zircon’s master device list like QEMU, to let the OS know that it’s running in an emulator.
One of the main mechanisms that Machina uses is called ‘Virtio.’ Virtio is a project to standardize OS virtualization, and was also chosen for use in Linux’s KVM. Part of the Virtio standard is ‘vsock’ (short for virtual socket) which can open direct channels between a host operating system and its guest, to allow for conveniences that would be otherwise impossible.
Vsock is still a fairly new technology (Linux only gained support for it in 2016), which means good examples of it are a little hard to come by. Not to mention Fuchsia will likely find its own unique uses for it. However, we can look at some benefits offered by another vsock system to get an idea of what to expect:
- No mouse lag
- Automatic adjustment of resolution
- Support of copy and paste (text and images)
- Support for transferring files
- Support for multiple displays
These Linux compatibility features might sound familiar, as the Chromium team has been working on very similar features for Chrome OS. With its recent Crostini project, Chrome OS devices will soon have the ability to install and run Linux apps, with support for important things like the clipboard and more.
Under the surface, Crostini and Machina are actually very similar projects. With that in mind, it’s reasonable to guess that they may work similarly, with Linux apps opening like any other app. Earlier this week, we even got a glimpse at a streamlined Files view coming to Chrome OS to make Android and Linux files more accessible. It’s very possible that Fuchsia will gain a similar interface for managing files between Android, Linux, and Chrome OS.
What does it all mean?
It’s clear with Fuchsia’s Machina and Crostini on Chrome OS, we’re beginning to see a future where the line between mobile and desktop apps is blurred. Interestingly, there’s nothing stopping Guest and Machina from working on a mobile device. In this possible future, you’ll be able to use “desktop” apps from your phone, and vice-versa.
For now, the reality isn’t too exciting, but know that we’re keeping an eye on it going forward.