Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No maintainer is obligated to not break any part of Linux other than the user space API, there are no stable in-kernel APIs




What they mean is that the Linux kernel has a long-standing policy to keep the whole kernel compilable on every commit, so any commit that changes an internal API must also fix up _all_ the places where that internal API is used.

While Rust in the kernel was experimental, this rule was relaxed somewhat to avoid introducing a barrier for programmers who didn't know Rust, so their work could proceed unimpeded while the experiment ran. In other words, the Rust code was allowed to be temporarily broken while the Rust maintainers fixed up uses of APIs that were changed in C code.


So does this mean that the C developers might need to learn Rust or cooperate more with the rust developer team basically?

I guess in practice you'd want to have Rust installed as part of your local build and test environment. But I don't think you have to learn Rust any more (or any less) than you have to learn Perl or how the config script works.

As long as you can detect if/when you break it, you can then either quickly pick up enough to get by (if it's trivial), or you ask around.


The proof of the pudding will be in the eating, the rust community better step up in terms of long term commitment to the code they produce because that is the thing that will keep this code in the kernel. This is just first base.

No matter how hard you try to paint it as such, Rust is not a tribe. This is such a weird characterization.

Rust contributions to the Linux kernel were made by individuals, and are very obviously subject to the exact same expectations as other kernel contributions. Maintainers have responsibilities, not “communities”.


Not only that, those individuals were already Linux kernel contributors. This is not an amorphous external group forcing their will on Linux, it's Linux itself choosing to use Rust.

Learn rust to a level where all cross language implications are understood, which includes all `unsafe` behaviour (...because you're interfacing with C).

Yes it does.


Depends on the change being made.

If they completely replace an API then sure, probably.

But for most changes, like adding a param to a function or a struct, they basically have to learn nothing.

Rust isn't unlike C either. You can write a lot of it in a pretty C like fashion.


>"Rust isn't unlike C either. You can write a lot of it in a pretty C like fashion."

I think that with all of the Rust's borrowing rules the statement is very iffy.


C has a lot of the same borrowing rules, though, with some differences around strict aliasing versus the shared/exclusive difference in Rust.

Most of the things people stub their toe on in Rust coming from C are already UB in C.


Rust's borrowing rules might force you to make different architecture choices than you would with C. But that's not what I was thinking about.

For a given rust function, where you might expect a C programmer to need to interact due to a change in the the C code, most of the lifetime rules will have already been hammered out before the needed updates to the rust code. It's possible, but unlikely, that the C programmer is going to need to significantly change what is being allocated and how.


Not talking allocations, more like actual borrowing, aliasing, passing as parameters.

That's exactly the original question.

There is, I understand, an expectation that if you do make breaking changes to kernel APIs, you fix the callers of such APIs. Which has been a point of contention, that if a maintainer doesn't know Rust, how would they fix Rust users of an API?

The Rust for Linux folks have offered that they would fix up such changes, at least during the experimental period. I guess what this arrangement looks like long term will be discussed ~now.


Without a very hard commitment that is going to be a huge hurdle to continued adoption, and kernel work is really the one place where rust has an actual place. Everywhere else you are most likely better off using either Go or Java.

Aren't large parts of a web browser and a runtime for a programming language also better written in Rust than in Go or Java?

Rust is being used a lot in video and audio processing where C and C++ had been the main players. Fixed-latency streaming is not really the best place for Go, Java, or Python.

I'd say no, access to a larger pool of programmers is an important ingredient in the decision of what you want to write something in. Netscape pre-dated Java which is why it was written in C/C++ and that is why we have rust in the first place. But today we do have Java which has all of the rust safety guarantees and then some, is insanely performant for network code and has a massive amount of mindshare and available programmers. For Go the situation is a bit less good but if you really need that extra bit of performance (and you almost never really do) then it might be a good choice.

> But today we do have Java which has all of the rust safety guarantees and then some, is insanely performant for network code and has a massive amount of mindshare and available programmers.

I'm not entirely convinced that Java has much mindshare among system programmers. During my 15 years career in the field I haven't heard "Boy I wish we wrote this <network driver | user-space offload networking application | NIC firmware> in Java" once.


I've seen plenty of networking code in Java, including very large scale video delivery platforms, near real time packet analysis and all kinds of stuff that I would have bet were not even possible in Java. If there is one thing that I'm really impressed by then it is how far Java has come performance wise, from absolutely dog slow to being an insignificant fraction away from low level languages. And I'm not a fan (to put it mildly) so you can take that as 'grudging respect'.

The 'factory factory' era of Java spoiled the language thoroughly for me.


I never said it is due to performance considerations (although developers in a projects like you described tend to always become experts in things like tuning Java GC). It is more like "If we wanted to write this in a shitty verbose OOP language we would just use C++".

While it might be possible to get the performance required for a web rendering engine out of Java, I think you'd miserable writing Java in the style you'd need to get that kind of performance. And you'd likely still end up with issues around memory usage, app bundle size (remember that browsers ship to client devices), GC pauses, and integrating with the JavaScript engine.

All the mainstream browsers do their own low-level graphics rendering (e.g., of text and icons and such). Is Java performant enough to do that?

Absolutely. Again, not a fan of the language. But you can transcode 10's of video streams on a single machine into a whole pile of different output resolutions and saturate two NICs while you're at it. Java has been 'fast enough' for almost all purposes for the last 10 years at least if not longer.

The weak point will always be the startup time of the JVM which is why you won't see it be used for short lived processes. But for a long lived process like a browser I see no obstacles.


It’s only fast enough if it is as fast or faster than the alternatives. Otherwise it is wasting battery power, making older/cheaper computers feel sluggish and increasingly inefficient.

Are the streams actually transcoded in Java, or is Java just orchestrating FFMpeg (and likely platform accelerators)?

> which has all of the rust safety guarantees and then some

That's not really true. Data races are possible in Java.


Data races are possible on some types, specifically `long` when not declared as `volatile` - but these do not directly cause memory unsafety.

Not just some types - any object with members. Shared references are a thing in Java and if not careful can cause data races left and right.

Rust controls that quite a bit.


Browsers already eat up GBs of ram... I don't want to know how bad it would get written in Java.

The runtime for a programming language, yes. The web browser thing is really not clear to me, but it certainly beats C++.

I'm using it for frontend web development and it's perfect. Much better than Go or Java would be. It's pretty wild that the language I use in the browser is also in the kernel.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: