Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite the kernel in Rust (2nd try) #52

Open
nuta opened this issue Feb 18, 2021 · 2 comments
Open

Rewrite the kernel in Rust (2nd try) #52

nuta opened this issue Feb 18, 2021 · 2 comments

Comments

@nuta
Copy link
Owner

nuta commented Feb 18, 2021

Interestingly, Resea Kernel is used to be written in Rust. However, it soon be rewrote in C because of the following drawbacks:

  • It tends to consume too much kernel stack (especially core::fmt).
  • It implicitly employs panics to prevent undefined behaviors.
  • libcore is too large for the microkernel (occupies approximately 30% of .text).
  • Writing intrusive data structures (e.g., LinkedList, SpinLock) is painful.

I do think C is better for a minimalistic microkernels as of this writing, that said, I also believe that the problems might be addressed someday.

@Sologix
Copy link

Sologix commented Nov 7, 2021

Small codebases in C are not a problem. Microkernels of a few thousand lines are therefore no problem.

It's when codebases approach hundreds of thousands or millions of LOC that it becomes unwieldy.

The kernel is pretty small (3200 LoC) but the entire Resea operating system exceeds 90.000 LoC (including the kernel). Wouldn't it therefore be more logical to rewrite just the servers in Rust?

P.S.: I used the following command to calculate the LoC: find . -name '*.c' | xargs sed '/^\s*#/d;/^\s*$/d' | wc -l

Repository owner deleted a comment Jul 31, 2023
Repository owner locked and limited conversation to collaborators Jul 31, 2023
@nuta
Copy link
Owner Author

nuta commented Jul 31, 2023

Locked because this issue is becoming another place to enjoy meaningless "Rust vs. C" dispute.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants