Live data from Hacker News

Asterinas: OS kernel written in Rust and providing Linux-compatible ABI

github.com

191–200 of 234 posts

Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI

#191
post #140

Earlier quoted context omitted.

If tracking lifetimes is simple 90% of the time and complex 10% of the time, maybe a tool that lets you have them automatically managed (with some runtime overhead) that 10% of the time is the right way forward.

Then you can use a language and runtime like C# or Java. Or you can use patterns like Go promotes. There are lots of options if you want.

> Then you can use a language and runtime like C# or Java. Or you can use patterns like Go promotes.

But in that case you're stuck paying the overhead 100% of the time, even though 90% of the lifetimes are simple. (Perhaps a little less so with escape analysis etc., but doing it at compile time in a way that's understandable in the source feels a lot more reliable)

Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI

#192

Earlier quoted context omitted.

>> 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…

How does the caller know whether the response was empty because of an invalid session id ? You have conflated empty response with an erroneous situation. The simplest solution is just Result .

>> How does the caller know whether the response was empty because of an invalid session id ?

Documentation and how SQL database queries work.

The documentation states that a valid session id will return a SessionInfo struct (since it is an Option the type is Some(SessionInfo) ), and that an invalid session id will return None.

If the SQL query is something like "SELECT * FROM USER_SESSIONS WHERE USER_SESSION_ID = $1" then if an invalid session id is provided the database returns zero rows. The query was successful, but there were no matching sessions with that session id.

>> You have conflated empty response with an erroneous situation. The simplest solution is just Result.

Again, an empty response is not an error in this situation. If your database query returns zero rows, is it an error? The database query succeeded. There are no sessions with the provided session id. What error occurred?

Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI

#193
post #78

Earlier quoted context omitted.

It's a lot "simpler" to support a Linux userland as that means one needs to "just" emulate all the Linux syscalls, than to implement the literally countless internal APIs needed for drivers etc, as that would otherwise mean literally reimplementing the whole Linux kernel and that's neither realistic, nor too useful.

And that’s not all that simple, as has been experienced by Solaris (never released(?) Linux branded zones, illumos (lx brand), and Windows (WSL1) developers that have tried to make existing kernels act like Linux. It’s probably easier if the kernel’s key goal is to be compatible with the Linux ABI rather than being compatible with its earlier self while bolting on Linux compatibility.

I'm sure it's not trivial, but I was under the impression that illumos, FreeBSD, and NetBSD all have perfectly good Linux compatibility layers so it's clearly doable. (WSL1 excepted because NT apparently really doesn't want to be a unix-like)

Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI

#194
post #191

Earlier quoted context omitted.

Then you can use a language and runtime like C# or Java. Or you can use patterns like Go promotes. There are lots of options if you want.

> Then you can use a language and runtime like C# or Java. Or you can use patterns like Go promotes. But in that case you're stuck paying the overhead 100% of the time, even though 90% of the lifetimes are simple. (Perhaps a little less so with escape analysis etc., but doing it at compile time in a way that's understandable in the source feels a lot more reliable)

Java and C# are languages of different class. C# is perfectly capable of systems programming and manual memory management that is at least more convenient than C (but not C++ with move semantics and operator overloading abuse, otoh C#'s type system and build process are saner which at least partially pays for this).

Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI

#195

Earlier quoted context omitted.

Relying on LLMs to code for you in no way solves the safety problem of C/C++ and probably worsens it.

probably? 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"

I said that because it's very possible for someone to write a more flawed program without an LLMs help. The exact probabilities weren't central to my point.

Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI

#196
post #81

Earlier quoted context omitted.

I would imagine that virtualized device drivers would have a well-defined api and vastly simplified logic.

Shouldn't we start building hardware that have a builtin translation layer that makes them driveable by virtio drivers themselves? At least for the most capabilities?

I might be misremembering but I recall that Nvidia's BlueField DPUs use virtio when communicating with the host machine. From what I gather searching around it's virtio-net in specific

Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI

#197
post #158
post #107

Earlier quoted context omitted.

Context: I'm writing a novel kernel in Rust. Lifetimes aren't bad, the learning curve is admittedly a bit high. Post-v1 rust significantly reduced the number of places you need them and a recent update allows you to elide them even more if memory serves. Arc isn't any different than other languages, not sure what you're referring to by ref but a reference is just a pointer with added semantic guarantees, and Pin isn'…

Would you not want to use Pin when sharing memory with a driver or extension written in a different language (eg: C)?

Nah not really. Pin is for self-refefential data typically. It's compile time only so that information would get lost in C anyway, and there's no way to distinguish that data at runtime.

The kernel is doing so much anyway with memory maps and flipping in / out pages for scheduling and context switching that Pin doesn't add any value in such cases anyway.

It was also specifically built for async rust. I've never personally seen it in the wild in any other context.

Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI

#198
post #110

Earlier quoted context omitted.

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?

frama-c

Which is terrible for kernel development, and is generally very hard to work with, unfortunately.

Re: Asterinas: OS kernel written in Rust and providing Linux-compatible ABI

#199
post #97

Earlier quoted context omitted.

I don’t entirely agree, you can get used to the borrow checker relatively quickly and you mostly stop thinking about it. What tends to make Rust complex is advanced use of traits, generics, iterators, closures, wrapper types, async, error types… You start getting these massive semi-autogenerated nested types, the syntax sugar starts generating complex logic for you in the background that you cannot see but have to ke…

It's just overengineered. Many Rust folks don't realize it because they come from C++ and suffer from Stockholm Syndrome.

How is it overengineered?
Post reply on HN