ftl README

The project's README from github.com/nuta/ftl. As one markdown file: README.md.

FTL

FTL is a new operating system aiming to be an alternative OS in cloud environments to Linux/BSDs/Illumos.

    Container #1 (Linux compat)      Container #2 (custom OS)
┌────────────────────────────────┐     ┌─────────────────┐
│  VM space       VM space       │     │ VmSpace         │
│ ┏━━━━━━━━━━━━┓  ┏━━━━━━━━━━━━┓ │     │ ┏━━━━━━━━━━━━━┓ │
│ ┃            ┃  ┃            ┃ │     │ ┃             ┃ │
│ ┃   Linux    ┃  ┃   Linux    ┃ │     │ ┃ FTL native  ┃ │
│ ┃  Process   ┃  ┃  Process   ┃ │     │ ┃  unikernel  ┃ │
│ ┃            ┃  ┃            ┃ │     │ ┃             ┃ │
│ ┃ ╌╌╌╌╌╌╌╌ Linux ABI ╌╌╌╌╌╌╌╌┃ │     │ ┃╌╌╌╌╌╌╌╌╌╌╌╌╌┃ │
│ ┃   Linux compat library     ┃ │     │ ┃  Your own   ┃ │
│ ┃  (Process, VFS, TCP, ...)  ┃◀┄┄┐   │ ┃  custom OS  ┃ │
│ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ │ ┆   │ ┗━━━━━━━━━━━━━┛ │
└────────────────────────────────┘ ┆   └─────────────────┘
   ┆  Minimalistic system calls    ┆
   ▼                               ┆ user faults (syscalls)
╔════════════════════════════════════════════════════════╗
║                       Small kernel                     ║
║         (memory, vCPU, network multiplexing, ...)      ║
╚════════════════════════════════════════════════════════╝

Running locally

Install Rust toolchain, LLVM tools, and QEMU:

brew install rustup qemu        # macOS
apt  install rustup qemu-system # Ubuntu

Build and run:

./run.sh

You can start a specific Linux command:

./run.sh "/bin/echo Hello World"

To get an ISO image to run FTL on cloud:

ISO=1 ./build.sh

[!TIP]

Fun fact: ftl-os.org is served by FTL running on Google Compute Engine.

Design

Per-container userspace OS

Most of OS features such as the concept of Linux process is implemented in a userspace library, which we call "userspace OS". This design is similar to Exokernel where the traditional monolithic kernel features are moved to a userspace library (library OS).

FTL kernel provides hypervisor-like primitives: vCPU (thread), virtual address space (vmspace), virtual network, for example. The kernel does not interpret Linux system calls, and redirects them to the userspace OS's handler.

Each container instance has its own isolated userspace OS. This lets you run Linux containers on their own isolated Linux-like application kernels, similar to gVisor.

You can upgrade, add your own features, inject printfs for debugging, or optimize the userspace OS by simply starting a new container, without kernel programming or rebooting the machine.

Hypervisor-shaped kernel interface

FTL enables you to build your own OS best suited for your application. For example, the concept of Linux process is implemented in a userspace library, not in the kernel. VFS and TCP are also implemented in a library. This means the FTL kernel is more like a hypervisor, which multiplexes hardware resources and provides minimalistic interface like virtio.

FTL kernel interface is heavily inspired by hypervisors to narrow the attack surface, and to make userspace OS flexible. The difference from hypervisors is FTL uses the user mode to catch exceptions (not hardware-accelerated virtualization).

Linux compatibility layer

FTL is designed to support multiple personalities. The tier 1 personality is Linux which runs Linux executables without any modifications.

Foreign binary support (aka. ABI emulation) is a well-established technique that can be seen in modern operating systems, such as Windows Subsystem for Linux (WSL 1), FreeBSD's Linuxulator, and OSv, to name a few.

The key difference in FTL is that it is implemented as a userspace library, not as a in-kernel feature separate supervisor process. Each FTL container has its own isolated Linux-like application kernel.

We also aim to add our own personality to offer FTL's own system calls and features not available in Linux. That is, Linux ABI is just one of OS interfaces available on FTL.

Interceptors (planned)

Interceptor is a planned feature to control the behavior of OS components at runtime, just like middlewares in web frameworks. Rate limiting, security auditing, network packet routing, and live patching will be implemented as interceptors.

Batteries included

FTL will be more similar to BSD than Linux. We plan to provide FTL as an operating system bundled with userspace software integrated nicely.

License

FTL is dual-licensed under the MIT and Apache 2.0 licenses.

ftl (nuta/ftl)

Searching Database…

302 ·GitHub
这是什么?FTL 是一个用 Rust 编写的新型操作系统,目标是成为专门面向云环境的 Linux、BSD 和 Illumos 替代品。
FTL 是像 Linux 那样的宏内核,还是别的东西?不是,FTL 内核本身很小,形态更像虚拟机监控器,只暴露 vCPU 和虚拟地址空间等最小原语;Linux 系统调用和 TCP 等真正的操作系统特性则放在一个叫“用户态操作系统”的用户态库里,类似 Exokernel 的设计。
怎么在本地运行 FTL?安装 Rust 工具链、LLVM 工具和 QEMU,然后构建并运行该项目;你也可以启动某条特定的 Linux 命令,或者构建 ISO 镜像,把 FTL 跑在云服务商上。
构建 FTL 之前需要安装什么?你需要 Rust 工具链、LLVM 工具,以及用于本地仿真的 QEMU。
FTL 现在已经能运行未经修改的 Linux 二进制文件了吗?FTL 的目标是做一个 Linux 二进制兼容层,让未经修改的 Linux 可执行文件通过用户态 ABI 仿真运行,但一些计划中的功能,比如用于运行时行为控制的“Interceptor”,还没实现。
FTL 只面向大型云服务器,还是也能跑在更小的设备上?它主要面向云环境,但该项目也把自身占用控制在足够小,可以跑在资源受限的设备上。
FTL 里的“用户态操作系统”到底是什么?它是一个用户态库,为每个容器实现大部分传统操作系统特性(Linux 进程模型、VFS、TCP),因此每个容器都运行自己隔离的、可打补丁的应用内核,而不碰真正的内核。
这与直接用 gVisor 或 unikernel 有什么不同?与 gVisor 相似,每个容器都有一个处理 Linux 系统调用的隔离用户态内核;但与 unikernel 类似,你可以自己修补或扩展这个用户态操作系统,而无需做内核编程或重启机器。
FTL 真的在什么地方投入生产运行了吗?有,该项目自己的网站 ftl-os.org 就由实时运行在 Google Compute Engine 上的 FTL 提供服务,作为一个真实场景的演示。
该项目说的“batteries included”(自带电池)是什么意思?计划是最终把 FTL 作为一个完整操作系统发布,捆绑集成的用户态软件,让它更接近 BSD 的理念,而不是 Linux 的最小内核路线。
Creator
nuta
Size
1.5 MB
Stars
302
Age
8mo
Commits · 90 Days