Operating system written in Erlang and Rust
BOSS (BEAM-based Operating System with Security) is a proof-of-concept operating system written in Erlang together with Rust. Its distinctive features include:
This project strives to achieve the following, in order of decreasing importance:
Yes. Erlang is a very cool functional (at a low level) / object-oriented (at a high level) concurrent language. Erlang makes it easy to write code that scales almost effortlessly across multiple cores, processors or even machines. Existing implementations of Erlang (most notably, the official BEAM virtual machine) are very performant in both single-core and multi-core operations. This implementation is not. Like, not at all. But it works and it's a starting point!
The basis of this project is the emulator, a multiprocessing-aware Erlang VM that runs on bare hardware. It only implements the bare minimum it has to implement in order to reach this objective; for example, it does parse some ACPI tables (since that is required for multiprocessing to work) (or, at least, it will once this feature is actually implemented), but it does not run AML bytecode - that task is left up to the BEAM bytecode it runs. The emulator only supports the x86_64 ISA, UEFI and ACPI 2.0+, i.e. it will run on machines from approximately 2010 onwards. It could be argued that the emulator is a microkernel since it implements the things a uK would (scheduling and IPC), but it's my project and I prefer not to name it that.
Even though the emulator is a BEAM, it's not the BEAM. It is compatible with Erlang's standard binary module format and its bytecode instructions, but that's about where the similarities end. This incompatibility is a conscious design decision that was made to introduce isolation and capability-based security into the BEAM. Here's an incomplete list of the differences:
% this calls the function `baz' from the module `bar' in the application `foo'
% this will only be allowed if `foo' "exports" the module `bar'
'foo:bar':baz(). % far call
% this calls the function `baz' from the module `bar' in the current app
bar:baz(). % external call
% this calls the function `baz' from the current module in the current app
baz(). % local call
Self = self(),
Self ! hello,
receive
{Self, hello} -> yay,
hello -> nay
end.
The current implementation is not the fastest, but it's a starting point to get things working.
On startup, the emulator loads the BOSS base image (BOSBAIMA.TAR
) that
contains initial emulator configuration and just enough BEAM modules to
bootstrap a functional OS. It's akin to OTP's kernel
app.
As was previously said, there is no clear kernel-userspace divide; instead, BOSS goes for the supervision tree model that forms the basis of Erlang/OTP.
Emulator:
Base image:
"Userland":
Currently, the OS does not display anything on the screen. Instead, refer to output from the serial port. Nix and Just scripts instruct QEMU to redirect serial port output to the terminal.
You can download an ISO built from the latest commit over on the Releases page. However, I suggest that you instead build the OS from scratch.
Clone the project with:
$ git clone https://github.com/portasynthinca3/boss.git
$ cd boss
Build an ISO with:
$ nix --extra-experimental-features flakes build .#iso
Launch in QEMU with:
$ nix --extra-experimental-features flakes --extra-experimental-features nix-command run
Clone the project with:
$ git clone https://github.com/portasynthinca3/boss.git
$ cd boss
To build an ISO, you will need:
1.33.0
)4.0.44
)2.42.0
)1.82.0-nightly (7120fdac7 2024-07-25)
)Erlang/OTP 27 [erts-15.0.1]
, 26 and below willBuild an ISO with:
$ just iso
To run the ISO in QEMU, you will need:
Launch QEMU with:
$ just qemu
Thank you to: