4 ms·
> If memory allocation fails, an exception is thrown and a retry with less memory requirements is a possible execution path. So, since we're talking about the
by tialaramex 5y ago
> If memory allocation fails, an exception is thrown and a retry with less memory requirements is a possible execution path.
So, since we're talking about the Linux kernel, that's a red flag straight away. Notice a whole section of this new LKML post is about their implementation of Rust's alloc crate? Linus doesn't want useless exceptions here and has previously objected on that basis.
Meanwhile... Over in the C++ world they have this same behaviour. For them these exception handlers are a fiction, in reality popular standard libraries (never mind everything else you're using) will blow up in low memory and it's game over. Maybe Ada does a lot better. Maybe.
- pjmlp 5y agoLinux kernel doesn't have clearance for high integrity computing, or being in control of machines responsible for human life's, Ada does. Ada also has no exception allowed profiles and other mechanisms. HN is not the place to hold a lecture on Ada features. It is not a maybe, rather lack of knowledge.
- short_sells_poo 5y agoYou seem to be arguing as if this effort should have gone to Ada instead. So go ahead and do it. There's a group of people who are trying to get kernel support for Rust. This is not a statement about Rust being superior to Ada or Ada's (in)suitability for the same job. It's only a statement that this group of people likes rust for it's safety features. I'm sure they are all aware that there are other, even safer languages, but these people like Rust. We can lead academic discussions about which language is safer/better/leaner/whatever-er, but the fact is that Rust has a larger and growing mindshare so this effort is unsurprising. For Ada, the solution isn't to try and prove to anonymous forum goers it would've been better choice if only people recognized the fact. The solution is to mobilize the Ada community to put the same amount of effort into the publicity and marketing (yes, the bad M word) of their ecosystem. Ada clearly lives on in many safety critical systems, but judging by the admittedly biased topic frequency on HN and other technical sites, it has a tiny community who mostly keep to themselves. That's fine, but then don't be surprised when it's Hip Language X that gets the headlines and these sort of efforts.
- pjmlp 5y agoThat effort has been happening for production code in high integrity systems since Ada was released to the world in 1983. My only point is how many in the Rust community advocate as if Rust would be the first language having features, that actually were already in Ada for the past decades. As for Ada on Linux, naturally Linus would never go along it. A C kernel guy liking a language with Pascal syntax, a community that worships a paper that hasn't been true in the Pascal world since early 80's, not even at gunpoint. If you want to see a use case where Ada was chosen against Rust, check NVidia's project for self driving vehicles firmware.
- short_sells_poo 5y agoI appreciate what you are saying, but it is again just repeating why Ada is better than Rust. I posit that's irrelevant to this discussion. Rust is a safety centered language that seems to have champions and a growing community around it. Can we not just be happy that finally a safety conscious language has a following? If you are convinced Ada is better, nobody is stopping you from being the champion and building the Ada ecosystem. Right now, Ada is for all intents and purposes invisible both in terms of libraries, mindshare and hype.
- pjmlp 5y agoAda is alive where it matters most, high integrity systems. Plenty of safety conscious language have had followings since ALGOL, this is the point that many miss when praising Rust, while ignoring our computing history.
- grumblenum 5y ago>the fact is that Rust has a larger and growing mindshare so this effort is unsurprising. I think that is a false perception created by the dev-blogging community. Based on GitHub activity (https://madnight.github.io/githut/#/pull_requests/2021/2 https://madnight.github.io/githut/#/pull_requests/2021/2) Rust usage is declining (absolute numbers show little growth). Based on developer surveys (https://www.jetbrains.com/lp/devecosystem-2020/ https://www.jetbrains.com/lp/devecosystem-2020/) very few people use rust outside of hobby development. I think the concern is that the core argument that "I think Linux should adopt rust for safety" is a bit dishonest, given that there are a large number of well-vetted alternatives. "I think Linux should adopt rust because I like rust for social reasons" would probably be more correct. That Google staff seem to think rust is good for the Linux kernel but not, say, Zircon, would be surprising if those same people actually believed that any legal rust program is safe and inherently trustworthy. "Embrace, extend, extinguish" wasn't that long ago.
- geofft 5y agoRight. It is a lack of knowledge, and I know I've seen you argue that Ada has facilities for this before, and I don't know enough Ada to answer that one way or another. I think you and 'grumblenum should team up and write a working kernel module in Ada/Spark and then we can have a fruitful discussion about it, instead of just theorizing about whether it could be done. I'm interested in seeing the problems solved, and I'm indifferent to technology. If you think Ada/Spark can solve them, that would be awesome! (Editing to reply to a small claim in another subthread, "Linus would never go for it" - we believed the same thing when we started. We were originally thinking that we'd pitch this directly at Linux distros shipping out-of-tree modules that they didn't want to keep having to push security updates for. https://github.com/fishinabarrel/linux-kernel-module-rust https://github.com/fishinabarrel/linux-kernel-module-rust was out-of-tree and we tried to keep compatibility with kernels 4.4 onwards. But it turned out Linus isn't opposed to it.)
- grumblenum 5y ago>I'm interested in seeing the problems solved, and I'm indifferent to technology. I think the first problem is some kind of language specification. That it's not possible to know what behavior one should expect from rustc means that it isn't a solution. It's another problem. You should check out Ken Thompson's great speech on why this is an issue. https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_ReflectionsonTrustingTrust.pdf https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_Ref... Or do you think it's wrong to regard unauditable enhancements to free software paid for by Google with suspicion?
- geofft 5y agoKen Thompson's speech was made two years before the first draft specification of C was published, so I don't understand how it is connected to language specifications. Here's a way to address the issue he brings up in that speech that does not involve language specifications: https://dwheeler.com/trusting-trust/ https://dwheeler.com/trusting-trust/
- pjmlp 5y agoWhy should we waste time doing stuff already exists? https://www.adacore.com/academia/projects/muen-project https://www.adacore.com/academia/projects/muen-project https://www.adacore.com/company/partners/nvidia https://www.adacore.com/company/partners/nvidia https://genode.org/about/road-map https://genode.org/about/road-map https://www.ptc.com/-/media/Files/PDFs/Developer-Tools/apexada/PTC-ApexAda-for-ApexAdaExec64.pdf https://www.ptc.com/-/media/Files/PDFs/Developer-Tools/apexa... (ApexAda Exec) https://www.ghs.com/products/safety_critical/integrity_178_extensions.html https://www.ghs.com/products/safety_critical/integrity_178_e... https://www.windriver.com/products/helix https://www.windriver.com/products/helix (Wind River Helix Bare Metal partitions)