News for hackers. Stuff that matters.
Re:Rust in Linux kernel is just a beginning by mejutoco on Tuesday October 25, 2022 @08:42AM (#33329702)
Does C# not have a GC? I thought that would immediately disqualify it for kernel work.
Re:Rust in Linux kernel is just a beginning by pjmlp on Tuesday October 25, 2022 @09:27AM (#33330176)
For Linux yes, for those that aren't blinded by anti-GC religion, no.

https://www.wildernesslabs.co/

Re:Rust in Linux kernel is just a beginning by Ygg2 on Tuesday October 25, 2022 @12:25PM (#33332745)
Anti GC isn't a religion. GC is a performance cliff in some cases.
Re:Rust in Linux kernel is just a beginning by pjmlp on Tuesday October 25, 2022 @12:41PM (#33332976)
It is certainly a religion, as most people that advocate against it hardly ever learned to use a profiler, or bothered to learn that not all GC languages are alike, and many of them offer the same capabilities like C and C++ for low level coding.
Re:Rust in Linux kernel is just a beginning by Ygg2 on Tuesday October 25, 2022 @01:17PM (#33333459)
It's not, collaborating on a C# game engine and what I've seen is basically a lot of skirting around GC, because it's impact shows up in profiler. It has gotten to a point arrays and stack alloc are prefered over List and HashSet were basically forbidden in the hottest path.

Except most of C# ecosystem relies on classes and GC. A lot of these problems are caused by overuse of GC-ed classes, and their ease of use.

Re:Rust in Linux kernel is just a beginning by pjmlp on Tuesday October 25, 2022 @03:12PM (#33334897)
Don't confuse Unity runtime with C#, specially since it lacks all the nice features post C# 7.

C and C++ aren't immune to heap abuse as well.

You do on C# just like on them, think about data structures, and avoid heap during render loop

Re:Rust in Linux kernel is just a beginning by Ygg2 on Tuesday October 25, 2022 @06:30PM (#33337010)
Did I mention Unity? It was a independently developed engine. The engine is in C# 10.

They still ran into limitations where basically "This would be a lot easier if we didn't have GC".

Re:Rust in Linux kernel is just a beginning by throwaway17_17 on Tuesday October 25, 2022 @09:19PM (#33338497)
My take on this is a little different than the comments previous. I tend to side with your position over the default position the GC is workable as a languages base assumption. I think the problem really is an expressiveness issue. In a language conceptualized to have memory managed either manually or GC’d and that said choice should be easily made (i.e. it should not take much work to designate some code path as utilizing a GC’d strategy), but I would say for implementation and performance you would give up being able to easily abstract over the memory strategy.

tr;dl — I’d really prefer the option to determine when I’d like GC, as opposed to dodging the collector to avoid performance hits, hot code can default to manual. Probably not a realistic ask, but it could work.

Re:Rust in Linux kernel is just a beginning by Ygg2 on Wednesday October 26, 2022 @11:32AM (#33345275)
> I’d really prefer the option to determine when I’d like GC, as opposed to dodging the collector to avoid performance hits

Fair enough. If SS14 used D maybe they wouldn't have these problems.

D and early Rust (pre 0.2, like alpha alpha) had that. Problem is you split your community in two. You get a version of "What GC-color is your function/lib?".

It's a tradeoff for some domains - allow no GC bypass you're going to run into nigh insurmountable performance cliff.

Allow GC as opt-in and you run into issue of splitting your APIs in two.

Re:Rust in Linux kernel is just a beginning by pjmlp on Wednesday October 26, 2022 @04:04AM (#33341030)
Well that is what everyone is actually using nowadays when they state they are doing a game in C#.

"This would be a lot easier if we didn't have malloc()/free()", basically.

In any case Sony, Nintendo and Microsoft have been doing graphics stuff with C# for their platforms, although they could have kept being pure C++.

Also we shouldn't silo ourselves into only C# as discussion point, Go, D, Nim, Swift, Eiffel are also possible examples.

Re:Rust in Linux kernel is just a beginning by Ygg2 on Wednesday October 26, 2022 @12:01PM (#33345688)
> "This would be a lot easier if we didn't have malloc()/free()", basically.

Well, not really. It's just some libraries like YamlDotNet copy waaaay more than needed and it shows in serialization. They mostly minimized calling YamlDotNet, but true solution would be a zero copy parser.

Other issue was HashSet operation like Clear had huge impact. Think they replaced those with arrays.

Third issue was something about flecs and archetype ECS. I don't know if it was a jest, but they mentioned changing GC layout or rewriting GC.

Points is, they now face a steep performance cliff. The only way out of it is through sheer effort.

So no, it's not anti-GC religion. Some domains and GC really badly mix.

Re:Rust in Linux kernel is just a beginning by 5e92cb50239222b on Tuesday October 25, 2022 @08:51AM (#33329801)
Re:Rust in Linux kernel is just a beginning by theta_d on Tuesday October 25, 2022 @08:51AM (#33329799)
It does have GC but that is not the point being made.

I believe the point the author is making is that other languages provide better safety than C and have faster compile times than Rust, therefore Rust should be able to improve its compile times.

Re:Rust in Linux kernel is just a beginning by pedrocr on Tuesday October 25, 2022 @09:19AM (#33330094)
If those languages achieve their memory safety at runtime, like C# does with GC, then that becomes relevant to the point of the compile time performance. The C# compiler has to do less as that complexity has been pushed elsewhere with different tradeoffs.
Re:Rust in Linux kernel is just a beginning by pjmlp on Tuesday October 25, 2022 @09:24AM (#33330152)
Rust safety with runtime dependencies, Vec bounds checking, Arc and Rc datatypes.

Ada with SPARK 2014 formal proofs, for your other part of the remark.

Re:Rust in Linux kernel is just a beginning by rbanffy on Wednesday October 26, 2022 @06:25AM (#33341805)
GC is not a roadblock for OS kernel work. Smalltalk is itself an OS and had GC from the start. IBM's i (the descendant of OS/400) most likely has GC as part of its kernel. Lisp machines had hardware-assisted GC.

What you may want to try to avoid is complex and non-deterministic GC, which makes it harder to reason about.