Rust-Lang on Xen hypervisor

Hello,
Can I run Rust directly on Xen hypervisor? Something like, Erlang, Elixir, Go,...

Thanks.

I don't really understand your question.

If you're asking if it's possible to write an operating system in Rust, then yes - there are currently active projects that are developing operating systems/kernels in Rust: redox-os, https://os.phil-opp.com/, https://github.com/gamozolabs/chocolate_milk.

It should be possible, but I don't know how easy things are today.

I know through this 2015 blogpost (https://gandro.github.io/2015/09/27/rust-on-rumprun/) that rust could be compiled into a unikernel image.

There are other discussion on the forum about unikernel also.

1 Like

There is no std for the hypervisor that you can link against if that's what you're asking. It's bare metal, like running software on a computer with no OS installed.

I think that for most intends and purposes the CPU architecture is the same as the host, but I don't have real experience here, so take with a grain of salt.

update: There actually is tier 2 std support for x86_64-rumprun-netbsd, that might run on xen. There is also an std for redox which will give you an experimental micro kernel OS.

1 Like

What OP wants here is called unikernel or libos. It's an approach to run user code directly on the kernel mode. There's no syscall overhead as the syscall is not even exist, you can "call" the OS functionality via standard function call interface.

Quick googling gives me the hermit project. Haven't used it myself but the project seems active.

3 Likes

The platform support page says for std support of x86_64-unknown-hermit:

? These are targets that haven't yet been documented here. If you can shed some light on these platforms support, please create an issue or PR on the Rust Forge repo.

If people try it out, it would be nice to update that.

Did you see "https://elixir-lang.org/blog/2013/05/02/elixir-on-xen/" ?
How about Rust?
Is redox-os a linux distro or it is a new OS?

Didn't see elixir-lang before.
Redox is a new OS, it's not based on Linux.

Can redox-os be successful?

It depends on how you define "successful". If you mean running on almost all systems, then only Windows, Linux and macOS (and Minix, as the ME in intel processors uses it) will likely be successful for a very long time. If you mean that it is usable to work on, then yes it can be successful. Take a look at https://gitlab.redox-os.org/redox-os/cookbook/-/tree/master/recipes.