Zig kernel when
Asterinas: OS kernel written in Rust and providing Linux-compatible ABI
181–190 of 234 posts
Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI
#182Earlier quoted context omitted.
"You are enthusiastic and write kernel device drivers in rust. Write a device driver for an Intel i350 4 Port gigabit ethernet controller"
Claude Sonnet 3.5 seemed happy enough to do it, and the start looked promising Absolutely! Let's dive into writing a device driver for the Intel i350 4 Port Gigabit Ethernet Controller using Rust. This is an exciting project that combines low-level hardware interaction with the safety and performance benefits of Rust. I'll create a basic structure for our driver, focusing on the key components needed to interact with…
Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI
#183Earlier quoted context omitted.
Rust code is usually well commented in my experience.
for the downvoters: it’s true, and it’s because of rustdoc and doctests. comments become publicly browsable documentation, and any code contained within is run as a part of the test suite.
Intuition tells me that Rust is young enough to attract a certain type of early adopter, the kind of programmer who is more likely to document their code well from the outset.
Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI
#184OT: if you're interested in Asterinas, you might also be interested in Redox (entire OS written in Rust). https://www.redox-os.org/
Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI
#185Earlier quoted context omitted.
It was true until LLMs arrive. Feature compilers + IDEs can be integrated with LLMs to help programmers. Rust was a great idea, before LLMs, but I don't see the motivation for Rust when LLMs can be the solution initial for C/C++ 'problems'.
Relying on LLMs to code for you in no way solves the safety problem of C/C++ and probably worsens it.
even if the LLM is trained on flawless C code (which it isn't) it still has no way of reasoning about a complex system, it's just "what token is statistically most likely to come next"
Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI
#186Earlier quoted context omitted.
Yes, but I wanted to bypass having the complexity of the Linux kernel completely, too. Basically single app directly to network (the world) and as little as possible else in between.
Linux kernel is not complex. Most of the code runs lock-free. For example, the slab allocator in the kernel uses only a single double_cmpxhg instruction to allocate an object via kmalloc(). The algorithm scales to any number of CPUs and has NUMA awareness. Basically, the most concurrent, lowest allocation latency allocator you can get in the market, which also returns the best objects for the requesting process on bi…
To reach a useful state, you only need to be highly performant on a handful of currently popular server architectures.
> Any normal Rust kernel will either have issues scaling on multi-cores or use tax-heavy synchronisation primitives.
I'm not sure how that applies to Asterinas. Is Asterinas any normal Rust kernel?
https://asterinas.github.io/book/kernel/the-framekernel-arch...
Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI
#187Earlier quoted context omitted.
If you’re writing C and don’t track ownership of values, you’re in a world of hurt. Rust makes you do from day one what you could do in C but unless you have years of experience you think it isn’t necessary.
Okay, I think it is is more like Typescript. You hate it but one day you just write small JS program and convert it to Typescript to discover that static analysis alone had so many code paths revealed that would have resulted in uncaught errors and then you always feel very uncomfortable writing plain Javascript. But what about tools like valgrind in context of C?
Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI
#188Earlier quoted context omitted.
I expect the downvotes to be there because it's talking positively about rust, which is blasphemy! /j
I'm guessing a lot of any perception of a lack of comments or documentation in a rust codebase comes down to how new or green a developer is to rust. If you're just starting out or doing something relatively simple, your goal is to get something working. This is so true regardless of the language.
But like I said, I've not looked at any Rust despite its marketing success.
Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI
#189Lol. I am Malaysian Chinese but I honestly don't think anyone will put into production a Chinese made kernel. The risk is too high, same as no one will use a Linux distro coming out of Russian, Iran or NK. It's just cultural bias in the west.
Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI
#190Earlier quoted context omitted.
Presumably missing session is an alternative scenario and thus should be reported as an error, then you match and handle this error. Your design complicates the common scenario: in case of valid session you need double unwrap, cf File::open that could return Result > if file is not found.
>> Presumably missing session is an alternative scenario and thus should be reported as an error But in this case, a query using an invalid session ID is not an error. It is asking for details about something that does not exist. >> cf File::open that could return Result > if file is not found. This type of query is not like File::open which gets a handle to a resource. Trying to get a handle to a resource that does…