How does the Urbit operating system (Arvo) work?


Arvo is the Urbit’s operating system. To understand how it works and its main differences from other traditional systems such as Windows, macOS and Linux, we first need to understand what an operating system is.


How does an operating system work?

An operating system (OS) is a set of programs whose main function is to manage the hardware and software resources of a computer. It stands midway between the user and the hardware of the device.

How so?

The user usually interacts at the top layer, the visual layer. For example, when you write a text and save a Word document in Windows, underneath there is a programming language (in this case C++ and C#) that is at work.

You don’t need to write any code in C++ because Word’s visual interface automatically assigns all your actions to the required code, making things easier. In practice, it is as if you are writing code.

This code will interact directly with the operating system. That is, the operating system is always ready to receive instructions, and these instructions are provided by the programs you are using.

The communication between the operating system and the Word application (that is using C++) takes place through APIs. These APIs are like “bridges” between the application and the operating system. They allow software that uses different programming languages to communicate.

Once the communication has been made with the OS, the OS will manage the hardware resources needed for the task to be completed, such as: managing CPU time, RAM usage, permission to read or write files on the hard disk, etc.

In summary, we have this dynamic: the user makes actions on some application, this application converts the actions into code, this code is sent to the OS through APIs, and the OS uses its own code to mess with the hardware or perform other low-level functions.

operational system layers between user and hardware

What is the “kernel” of an operating system?

The kernel is the most important central part of an OS. Everything we have explained so far about management and communication with the hardware is done by the kernel.

But besides the kernel, an OS is also composed of other resources such as:

  • APIs (for developers to create applications that interact with the kernel)
  • Shell (interface that allows the user to communicate directly with the kernel);
  • Daemons (processes that run in the background independently of user applications, such as network services, power management, and automatic updates).

Why is Arvo OS special?

Now that we know what an operating system is, we can better understand what makes Arvo special:

Arvo’s architecture:

Unlike systems like Windows, Arvo’s architecture is designed with simplicity and modularity in mind. Modularity is the separation of components into independent modules, rather than one giant monolithic architecture.

These modules can be tested, updated and maintained independently of each other. Each module is responsible for a specific set of functionalities and interacts with other modules through well-defined interfaces.

To make it less abstract, imagine that 5 pickup trucks can store the same amount of materials as a transport truck. Each truck is carrying a separate set of materials, while in the truck everything is mixed together. If one truck decides to change course, it can do so without impacting the other trucks. If someone needs an item that is in one of the trucks, they can just interact with that truck.

That would be the difference between a modular architecture and a monolithic architecture. There is no way to tinker or make a decision regarding one item carried in the truck without influencing the others.

Besides Arvo being modular, Arvo’s kernel is built with a functional programming language called Hoon, which makes the code easier to maintain and more readable, making things more predictable.

This is important for Urbit’s philosophy, which aims to be an open source project where people should be encouraged to develop applications and features on the system.

To give you an idea, the Arvo kernel is only 1000 lines of code, which allows any developer to analyze and understand the complete architecture.

In direct comparison, the kernels of systems like Windows, macOS and Linux have tens of millions of lines of code.

This is one reason why the Urbit protocol may end up developing quickly: the ease for developers to implement their ideas and projects.

Arvo organizes its applications into “vanes” and “agents”. Vanes are integral parts of the operating system and manage essential functionality such as network communication, state management, and event storage.

Agents are user applications that run on top of and interact with the vanes. Can you see the idea of modularity here? Vanes and agents are like the pickup trucks we just talked about.

This separation allows developers to create applications with specific, well-defined responsibilities, making it easier to track down and fix problems, as well as upgrade or replace parts of the system as needed.

Since the Arvo kernel is very lean, it does little by itself. The remaining functions are delegated to the vanes, which are also known as kernel modules. Each vane has a purpose. For example: Ames is the vane responsible for the network. Behn is the vane responsible for the timer. Clay is the vane responsible for file storage. And so on.

urbit vanes and urbit kernel

Practical example: if you wanted to create any application in Arvo, you would create an agent responsible for handling the specific functionality of this application. This agent would interact with the relevant vanes to access system resources, such as storage and network communication, without interfering with other agents or vanes.

In Windows it would be different!

The Windows architecture is more complex and monolithic, consisting of a kernel, system libraries, device drivers, and various system services that interact with each other. Applications in Windows are not as tightly separated as in Arvo, and modularity is much less emphasized. This results in complex dependencies and increased difficulty in updating or maintaining individual system components.

Practically speaking, when creating any application in Windows, you would need to interact with more components, have more risks of incompatibilities, dependencies, monitoring, etc.


Does Arvo run inside another operating system?

Currently, Arvo usually runs as an application on a “host” operating system, such as Linux, Windows or macOS.

This is because Urbit is not yet a full operating system, in terms of hardware compatibility and features, as you would find in conventional operating systems. Therefore, Arvo runs on top of another operating system to take advantage of its drivers and hardware resources.

It is possible that in the future Arvo could be developed to run more independently without depending on a host operating system, but for the time being it still needs to run in conjunction with another operating system.

So, at first, Arvo is not designed to replace Windows or Linux, but it exists in a browser-like way, i.e., it is a resource that you use to access another environment.

In practice, to access Urbit you are installing Arvo on top of your OS (Windows, MAC, Linux…) and this Arvo will communicate with Arvo from other machines.

arvos communicating on top of other os

How does Arvo communicate?

The Arvo on your computer will communicate with Arvos on other machines through vane Ames, Urbit’s peer-to-peer networking protocol. This communication happens in a decentralized fashion, without relying on centralized servers. The machines in the Urbit network, also called “ships“, interact with each other to share information and resources.

When you run Urbit and connect to the network, your Arvo becomes part of the Urbit ecosystem and can communicate with other Arvos around the world. In other words, you are part of one Internet, the Urbit Internet.


How does data storage work on Urbit?

A traditional system like Windows/MAC/Linux depends crucially on being plugged into some source of power, since much of the operating system’s state is stored in RAM, which is volatile.

Whenever you restart the computer or suddenly lose power, all the information stored in RAM is lost.

On the Arvo, a sudden loss of power does not affect the state of the operating system. When you boot your ship back up, it will be exactly as it was before the failure. Your information will never be lost.

The reason is that the handling of the operating system state is very similar to an SSD. An SSD (solid state hard drive) stores the data permanently. If the computer suffers a sudden loss of power, the data saved on an SSD physically remains there.

The interesting thing is that you don’t need to know anything about the system that is using the SSD to know everything about that SSD. There is no such thing as “rebooting” an SSD, it simply stores data, and when power is restored, it is in exactly the same state as it was when power was lost.

Technically speaking, Arvo has this feature because it is a “solid state interpreter”. But we will leave this explanation for another article. The most important thing to point out here are the characteristics of:

Determinism:

Arvo is a deterministic operating system, meaning that if the same initial state and the same sequence of events happen, the system will always produce the same result.

This is different from operating systems like Windows, macOS, and Linux, where the execution of programs can be affected by external variables, such as interrupts and interactions between processes.

Practical example: If you run a program on Arvo several times with the same inputs, it will always produce the same output. Whereas in other systems, when running the same program, the output may vary due to external factors.

Immutability:

Arvo is built around immutable trees. This means that instead of modifying the current state of the system, Arvo creates a new state from the previous state whenever an update occurs. In traditional systems, the state of the system is usually mutable and can be changed by various running processes.

Practical example: if you install software in Arvo, the system will create a new state that includes the installed software, without changing the previous state. On the other hand, on Windows/MAC/Linux, the software installation can modify existing files and change the system state irreversibly.

Now that we have gone through the various concepts, we can explain what Arvo is with a summary capturing the main points.


So, what is Arvo?

  1. Arvo is an operating system created to enable a new peer-to-peer internet. In this internet, users have full control of their data without having to rely on a third party. It is the centerpiece of the Urbit protocol.
  2. Arvo is a modular and simple OS, allowing developers to create specific applications using only the necessary modules, without interfering or needing to worry about the other components of the system.
  3. Arvo is an OS that handles memory permanently, without the volatility and file loss common due to RAM dependency in traditional systems.
  4. Arvo is a deterministic and predictable OS, where the same conditions result in the same outputs.

Arvo was written in Hoon, the standard language for development in Urbit. Hoon, in turn, is compiled to the Nock language.


Next Steps

To continue learning about Urbit, the next step is to understand the Hoon language.