GithubHelp home page GithubHelp logo

managarm / managarm Goto Github PK

View Code? Open in Web Editor NEW
1.3K 30.0 69.0 8.67 MB

Pragmatic microkernel-based OS with fully asynchronous I/O

License: MIT License

C++ 95.23% Assembly 1.32% C 2.17% Meson 1.05% Python 0.21% Makefile 0.02%
operating-system microkernel asynchronous-io posix-compatible modern-cpp x86-64 hacktoberfest

managarm's Introduction

The managarm Operating System

CI Documentation

Screenshot

What is this about?

This is the main repository of managarm, a microkernel-based operating system.

What is special about managarm? Some notable properties of managarm are: (i) managarm is based on a microkernel while common Desktop operating systems like Linux and Windows use monolithic kernels, (ii) managarm uses a completely asynchronous API for I/O and (iii) despite those internal differences, managarm provides good compatibility with Linux at the user space level.

Aren't microkernels slow? Microkernels do have some performance disadvantages over monolithic kernels. managarm tries to mitigate some of those issues by providing good abstractions (at the driver and system call levels) that allow efficient implementations of common user space functionality (like POSIX).

Is this a Linux distribution? No, managarm runs its own kernel that does not originate from Linux. While the managarm user space API supports many Linux APIs (e.g. epoll, timerfd, signalfd or tmpfs), managarm does not share any source code (or binaries) with the Linux kernel.

Official Discord server: https://discord.gg/7WB6Ur3. This is our primary real-time communication channel.

Official IRC channel: #managarm on irc.libera.chat, with many more available! Type /msg alis list managarm to find them.

Features

  • 64-bit operating system with SMP (i.e., multicore) and ACPI support.
  • Fully asynchronous microkernel and servers.
  • Support for many modern hardware devices such as USB 3 controllers.
  • Networking support.
  • POSIX and Linux API compatibility.
  • Support for Linux-style special files (epoll, signalfd, ...) and pseudo file systems (/sys, /proc, ...).

Trying out managarm

If you want to try out managarm without building the whole OS, you can download a xz-compressed nightly image; these images are automatically compiled on our build server and reflect the current state of Managarm development. To run the (uncompressed) image using qemu, we recommend the following flags:

qemu-system-x86_64 -enable-kvm -m 2048 -cpu host,migratable=off -device qemu-xhci -device usb-kbd -device usb-tablet -drive id=hdd,file=image,format=raw,if=none -device virtio-blk-pci,drive=hdd -vga vmware -debugcon stdio

Supported Software

Programs supported on managarm include Weston (the Wayland reference compositor), kmscon (a system console), GNU Coreutils, Bash, nano and others.

Supported Hardware

General USB (UHCI, EHCI)
Graphics Generic VBE graphics, Intel G45, virtio GPU, Bochs VBE interface, VMWare SVGA
Input USB human interface devices, PS/2 keyboard and mouse
Storage USB mass storage devices, NVMe, AHCI, ATA, virtio block

Building managarm

While this repository contains managarm's kernel, its drivers and other core functionality, it is not enough to build a full managarm distribution. Instead, we refer to the Managarm Handbook for build instructions.

managarm's People

Contributors

64 avatar a-andreyev avatar apache-hb avatar arsenarsen avatar austanss avatar avdgrinten avatar cflaviu avatar cleanbaja avatar d-tatianin avatar dennisbonke avatar electrodeyt avatar geertiebear avatar ikbenlike avatar jimx- avatar kitere avatar matt8898 avatar mintsuki avatar no92 avatar piotrrak avatar positrontheory avatar qookei avatar qwinci avatar thomtl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

managarm's Issues

thor: WorkQueue should be per-cpu

The current approach is not thread-safe and cannot be made thread-safe without compromising scalability. Make WorkQueue per-cpu and let it handle priorities.

thor: Implement PCIDs

PCIDs should give a significant performance boost to the OS as task switches are very frequent.

posix: VFS and device support

The posix subsystem lacks the following features:

  • Character and block device allocation
  • Proper VFS + mounts
  • tmpfs and devtmpfs
  • Process specific file system information (i.e. root, current directory and umask)
  • Mount namespaces
  • Proper support for major and minor numbers in device allocation
  • Bind mounts

general: Write a README.md

Include a pretty screenshot, some explanation what managarm is (not), an overview of the programs that it can run and an overview of the hardware that we support.

thor: Implement a proper scheduler

Currently we only schedule cooperatively. We need to implement a scheduler that pays attention to different priorities and enables real-time tasks. This is required for timing-sensitive drivers.

hel: Missing futex features

We lack a bunch of important futex features:

  • The futex API currently only accepts int futexes. Use unsigned int instead? Allow other data types / operation sizes?
  • FutexWake does not have a "count" parameter (currently it wakes up all waiters).
  • We do not have futex requeue operations.
  • We do not have PI or robust futexes.
  • Implement non-PI kernel based lock/trylock/unlock primitives? That would avoid possible starvation on NUMA system.
  • Do we need asynchronous wait operations?

posix: Signals need to save FPU state

Currently, we only save GPRs; however, it is quite easy to call memcpy() from signal handlers (e.g. by calling mlibc POSIX primitives). memcpy() clobbers the FPU state.

posix: Implement SO_PEERCRED

wayland-server uses SO_PEERCRED to get the remote PID of a Wayland socket. Weston's desktop shell needs this information for correct Meta+k force killing.

posix: Private file mappings do not work

Private file mappings should be handled via CoW. While the kernel supports CoW, it is only invoked after fork(). Add a flag to helMapMemory to allow the construction of CoW mappings with fork.

thor: Implement remapping memory views

Implement memory views that can be dynamically remapped from user space. This allows us to implement complex device files (e.g. in the DRM core) as single memory views. In turn, this allows us to get rid of one context switch in the common Mesa/libgbm render path.

thor: Dispatch PCI interrupts in the kernel

Improve PCI interrupt handling by letting the kernel read all possible ISRs when a PCI interrupt happens. Then, provide a separate IRQ object to each driver that only reports the IRQs of the specific device.

thor: Uncached memory

The kernel needs to provide support for uncached and write-combining memory regions.

thor: Optimize insertion into current work queue

Currently, we lock the work queue on post(). That is not necessary for the work queue of the current thread. As wakeup() is not necessary either, tracking the current work queue properly in every context would be a good performance improvement.

hel: Refactor queue construction interface

Currently, constant queue parameters are extracted from HelQueue which is unnecessary and requires an expensive user-space memory access from the kernel. Pass the constant values to the construction function instead.

general: Use libarch API to allocate DMA buffers

Inspect the drivers to check where this makes sense.

Some locations that need to be refactored:

  • core/virtio: Performs manual contiguous allocations
  • drivers/virtio: Use DMA API inside the block driver

thor: Log early boot messages to framebuffer

Currently, thor can log to VGA textmode, bochs' debugging port or the serial port. Add another option to log to a VBE framebuffer. This would require the inclusion of a nice (e.g. 8x16) bitmap font and possibly a two-column layout to be able to display more messages on one screen.

drivers: Support VTs

Virtual terminals (VTs) are not supported at the moment. Add a driver to provide a Linux-compatible ioctl() interface for VTs. Display the kernel log on one of the VTs.

thor: Thread safety

Several kernel data structures and algorithms are not thread-safe.

  • Memory objects are not protected by locks.
  • Mapping objects need a better interface or need to be protected by RCU.
  • The kernel does not perform proper TLB shootdown.
  • Thread switching code needs to be safe in presence of maskable interrupts, NMI and MCE.

thor: Reenable IRQ watchdog

Commit 333dc9e broke the IRQ watchdog: It was disabled because it runs in fiber; fibers are not available during early boot anymore. Fix this by starting the watchdog later in the boot process.

drivers/usb-hid: Respect maximal report size

Currently, we limit packets to the maximum packet size which can be smaller than the maximum report size. In other words, reports consisting of multiple packets are not supported right now.

posix: Signal support

Signal support is the most important ingredient that is missing for a fully functional shell.

thor: Measure RTC read time

The delay between update-in-progress clear and read completion should be measured. In theory, IRQs can interrupt the kernel fiber that performs the read, leading to a stale result. Warn and/or reread the RTC time if the delay was too large.

thor: Interrupt NAK mechanism?

Implement some mechanism that determines if an interrupt was not accepted by any consumer. This should not happen in normal situations but will aid in debugging interrupt issues.

drivers/usb-hid: Support absolute input devices

Support absolute input devices (e.g. touchscreens, tablets). This is a major advantage for VMs as absolute devices allow seamless mouse integration.

For this to work, we need to support the EVIOCGABS ioctl in libevbackend. Some work on the USB HCDs might also be necessary.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.