Blogs

Contents

rtdev logo

Archis: A Rust based operating system

Boot flow

Synchronization primitives

Memory manager

Scheduler

Driver model

Filesystem & Userspace

Contents

The project is fully open source. Please refer to the following link https://github.com/RohitRTdev/Archis. Before we proceed to the details of each subsystem within the os, lets look at a demo.

Archis booting and running the shell from an emulator

When you are writing an application, you'd like to not worry about system level information. Things such as cpu architecture, the gpu card model, whether the system has a touch screen or uses a keyboard. The OS is essentially a big library of routines that a process can call into to get what they want. For ex: when you call the input() method in python, the os is doing the heavy lifting of finding the attached input devices (keyboard, touch screen etc), abstracting away the low level details required to fetch the data from these devices and then giving you the input. Python is simply calling into an OS routine to do this.

Python
name = input("Enter your name: ")
print(f"Hello, {name}!")

On Windows, that single line of Python unwinds into roughly this sequence of Win32 calls:

C
/* 1. Grab a handle to the console's input buffer */
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);

/* 2. Block until the console driver (condrv.sys) has line-buffered
      keystrokes terminated by Enter, then copy them into our buffer */
DWORD read;
char buffer[256];
ReadConsoleA(hStdin, buffer, sizeof(buffer), &read, NULL);

/* 3. Write the prompt/response back out the same way */
HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
WriteConsoleA(hStdout, "Hello, ...\n", 11, &read, NULL);

ReadConsoleA itself is a thin wrapper: it issues an ALPC (type of IPC) request to conhost.exe (the console host process), which owns the actual input queue and line-editing state, and which in turn is fed keystrokes by the keyboard driver stack through the Windows message loop.

Archis is also such an operating system that provides a host of these routines to user. In addition, the os is also responsible for initializing and powering on the devices within the system and provides a platform for the user. This platform is the first thing you see once you login to a system. In modern GUI based operating systems, it's mostly a file manager process (In windows, explorer.exe). In general, it is referred to as the shell process.

Most operating systems also allow you to multitask. We take it for granted nowadays, but it wasn't always the case. Early systems like GM-NAA I/O (1956) ran a single job at a time - the computer belonged entirely to whatever program was loaded, with no notion of a "process". Multiprogramming changed that: systems like IBM's OS/360 (1960s) began juggling several jobs in memory at once to keep the CPU busy while one waited on I/O, which is where the process abstraction as we know it emerged. Threads came later still, letting a single process run multiple concurrent paths of execution, popularized by systems like Mach and Windows NT in the late 1980s/early 90s.

Archis is a multitasking operating system without a GUI. The shell is a simple terminal. You can type commands such as ls to list the files in the current working directory. Shutdown system with the shutdown command, be able to create/read/write/rename/delete files and much more. If you have used any linux distro or bsd (or wsl or cygwin in windows), then you would already be familiar with the terminology.

In case of queries or mistakes you may find, please reach out to me via my email - rohit20011002@gmail.com