Asterinas
Home
Blog
Docs
Home
Blog
Docs
Forge the future of Rust OSes
Asterinas is an open-source community dedicated to crafting the
next-generation OS kernels using Rust with the framekernel architecture
Asterinas is an open-source community dedicated to crafting the next-generation
OS kernels using Rust with the framekernel architecture
Asterinas
OSDK
Introduce Asterinas
Asterinas is a Rust OS kernel designed to offer the following distinctive features:
Strong Security
Fortified against security vulnerabilities,
including memory safety concerns
Excellent Performance
Delivering top-tier performance
benchmarks
Broad Usage
Suitable to a wide array of hardware
platforms and usage scenarios
Seamless Compatibility
Effortlessly running Linux applications
without any need for modifications
The strong security and excellent performance of the Asterinas Kernel stem from its innovative<br>framekernel architecture.
Introduce OSDK
Asterinas Operating System Development Kit (OSDK) helps OS devs to create, build, run, and test<br>Rust<br>projects for OS kernels effortless. Imagine crafting kernels with the same simplicity as apps!
Jump start
Crate reuse
Rapid testing
Safe coding
Jump start
With OSDK, you can start building your own Rust OS kernel with three simple steps.
1.<br>Install Asterinas OSDK
cargo install cargo-osdk
2.<br>Create a Rust project for your "Hello World" kernel.
cargo osdk new my-first-os --kernel
3.<br>Compile the kernel, generate a bootable image, and run it in a VM with just one<br>single<br>command.
cd my-first-os && cargo osdk run
Crate reuse
All OSDK-based Rust crates for an OS kernel or library share a common foundation,<br>a crate called ostd.<br>This fosters a more vibrant ecosystem of OS crates,<br>reusable across different Rust OSes.
Rapid testing
Writing unit tests for OSDK-based Rust projects is a breeze with ktest.
#[cfg(ktest)]<br>mod tests {<br>#[ktest]<br>fn it_works() {<br>assert_eq!(true, true);
Running these unit tests in the kernel mode can be done with a simple command:
cargo osdk test
Safe coding
OSDK is based on ostd,<br>a minimal, expressive, and solid foundation<br>that enables OS devs to implement OS functionalities on top of it in safe Rust.
The effectiveness of ostd has been validated by our extensive experience in<br>developing Asterinas. In Asterinas, all unsafe Rust code is confined to<br>ostd,<br>whereas the rest of the kernel, including all drivers for peripheral devices, is<br>composed of safe Rust code exclusively.
With OSDK, you can start building your own Rust OS kernel with three simple steps.
1.<br>Install Asterinas OSDK
cargo install cargo-osdk
2.<br>Create a Rust project for your "Hello World" kernel.
cargo osdk new my-first-os --kernel
3.<br>Compile the kernel, generate a bootable image, and run it in a VM with just one single<br>command.
cd my-first-os && cargo osdk run
Writing unit tests for OSDK-based Rust projects is a breeze with ktest.
#[cfg(ktest)]<br>mod tests {<br>#[ktest]<br>fn it_works() {<br>assert_eq!(true, true);
Running these unit tests in the kernel mode can be done with a simple command:
cargo osdk test
All OSDK-based Rust crates for an OS kernel or library share a common foundation,<br>a crate called ostd.<br>This fosters a more vibrant ecosystem of OS crates, reusable<br>across different Rust OSes.
OSDK is based on ostd,<br>a minimal, expressive, and solid foundation that enables<br>OS devs to implement OS functionalities on top of it in safe Rust.
The effectiveness of ostd has been validated by our extensive experience in<br>developing Asterinas. In Asterinas, all unsafe Rust code is confined to ostd,<br>whereas the rest of the kernel, including all drivers for peripheral devices, is<br>composed of safe Rust code exclusively.
OSDK can be utilized to build any Rust kernel based on the framekernel architecture: Asterinas<br>is<br>built with OSDK; your kernel can too!
-->
Why a framekernel?
The speed of a monolithic kernel, the security of a microkernel
Asterinas adopts the novel framekernel OS architecture, which unleashes the full power of Rust<br>to<br>bring<br>the best of both monolithic kernels and microkernels.
A comparison between different OS architectures
TCB
Non-TCB
Slow path (e.g., syscall, RPG)
Fast path (e.g., func call)
TCB
Non-TCB
Slow path
Fast path
In the framekernel OS architecture, the entire OS resides in the same address space (like a<br>monolithic
kernel) and is required to be written in Rust. However, there's a twist---the kernel is<br>partitioned<br>in<br>two<br>halves: the privileged Framework (akin to a microkernel) and the unprivileged Services. Only<br>the<br>privileged<br>Framework is allowed to use unsafe features of Rust, while the unprivileged Services must be<br>written<br>exclusively in safe Rust.
The memory safety of the entire kernel is reduced to that of the Framework, a minimal,<br>expressive,<br>and
rock-solid foundation. Residing in the same address space, the rest of the kernel can<br>communicate<br>with
the Framework in the most efficient way.
Get involved
We are committed to...