5 ms·
> Mumble mumble kernel embedded something something intrusive. And this is why kernel/embedded/something/something developers don't take Rust as seriously as y
by ajross 7y ago
> Mumble mumble kernel embedded something something intrusive.
And this is why kernel/embedded/something/something developers don't take Rust as seriously as you want them to.
You can't simultaneously declare your language the best choice for system software development and treat the long-evolved patterns of those paradigms as a joke.
There are very good reasons for intrusive data structures, not least of which being their ability to operate in contexts where no heap is available. If you don't understand them or don't want to talk about them or want to limit your discussion to situations with different requirements, then say so.
- deleted 7y ago[deleted]
- jszymborski 7y agoI think it must be stressed that this is an unofficial guide and not "the voice of the project", etc...
- robbyt 7y agoTo explain what I think this comment means. When working on embedded systems, you can interact with hardware devices by writing directly to specially mapped memory areas. E.g., if you want to write text to a small screen, the kernel driver gives you a memory region that you write bytes to, and they're shown on the screen immediately, without requiring the CPU.
- redrobein 7y ago> To explain what I think this comment means. When working on embedded systems, you can interact with hardware devices by writing directly to specially mapped memory areas. And why can't you do this in rust?
- jasondclinton 7y agoYou can. Rust allows full memory addressing.
- lawn 7y agoThere's nothing to prevent you from doing this, although you may have to wrap it in an unsafe block.
- monocasa 7y agoThey're saying more that intrusive data structures are really nice in situations that restrict heap allocation. The memory overhead outside of the structures linked together is O(1), because all of the per object metadata is stored in the objects themselves. That means consumers generally don't have to be hardcoded for certain number of objects like you would for an array/vector that doesn't have access to a heap.
- fortran77 7y agoMy feelings, too. I do both embedded programming (in C/C++ and CUDA) and Erlang programming for a living. Erlang, too, doesn't let you (easily) write your own linked list structures, etc. But for embedded programming with tight memory or performance constraints these data structures are essential so we use C++ or even C. They're well understood and the implementations have simple, elegant solutions. For "safety" when we don't need absolute control, we'll choose a GC language like C# or F#. No need for the complication of Rust.
- saagarjha 7y agoRust gives you just as much control as C when you need it.
- throwaway17_17 7y agoI may be mistaken, but if using unsafe does not allow for the ‘borrow-checker’ to be turned off and allow for code which doesn’t abide by the checker’s requirements, then it clearly does not give “as much control as C”. Again, I might have missed some of the subtleties of circumventing Rust’s static checking, but I don’t think I can purposely create some non-deterministic racy-appearing abstractions, which would be trivial to do using global variables in C.
- saagarjha 7y ago> if using unsafe does not allow for the ‘borrow-checker’ to be turned off and allow for code which doesn’t abide by the checker’s requirements It does, that’s why it’s there.
- steveklabnik 7y agoUnsafe doesn’t turn off the borrow checker, but it does give you access to pointers that aren’t checked.
- zozbot234 7y ago> if using unsafe does not allow for the ‘borrow-checker’ to be turned off and allow for code which doesn’t abide by the checker’s requirements It allows the latter. 'Code that doesn't abide by the checker's requirements' uses separate facilities that are only allowed in unsafe code. This means that `unsafe` doesn't have to turn off anything, and further pinpoints the parts of the code where caution is needed in order to maintain the invariants that Safe Rust is based on.
- steveklabnik 7y agoIt explicitly says that there are good use cases, just that they’re very rare.
- ajross 7y agoIt does not. Maybe somewhere else it does. That section, verbatim, says: It's niche. You're talking about a situation where you're not even using your language's runtime. Is that not a red flag that you're doing something strange? It's also wildly unsafe. But sure. Build your awesome zero-allocation lists on the stack. And this is (1) wildly mistating the requirements and (2) deeply offensive to those of us who work in those regimes. Obviously, yes, there's room for a reasoned argument about this stuff and whether alternative paradigms can be deployed in heapless contexts. This isn't it.
- steveklabnik 7y ago> It's a fine data structure with several great use cases, but those use cases are exceptional, not common.
- MaulingMonkey 7y ago> And this is (1) wildly mistating the requirements and (2) deeply offensive to those of us who work in those regimes. Care to expand how? While not a kernel dev, I've had my share of use cases where I've done exactly this kind of thing in gamedev, and I simply cannot bring myself to disagree with what's been said, or see what's offensive. It's strange, debugging when the pointers get corrupted by other code exhibiting UB is painful, it's a potential multithreading hazard, and flat contiguous arrays are frequently more appropriate - but it's sometimes useful. It's not arguing that an alternative paradigm can - or even should - be deployed in a heapless context. It's explicitly admitting that intrusive linked lists are an appropriate paradigm.
- catatattat 7y ago> (2) deeply offensive to those of us who work in those regimes You know how sometimes someone who is A Little Too Online gets offended because they think you said a Bad Thing, but it was actually just a typo or a straight misreading, and you try to explain that they’re reacting to something you didn’t even say let alone believe, but because they have already decided you are the Bad Person they interpret that as you “doubling down“ on the bad opinion that they attributed to you, so they get even angrier and even more convinced that you sincerely believe the Bad Thing? I mean no judgment. We all have such sensitivities. But maybe now you see how easily you can wind up on the wrong side of a public debate by searching for offense where there is in fact none.
- roblabla 7y agoThe actual context of your quote: > Just so we're totally 100% clear: I hate linked lists. With a passion. Linked lists are terrible data structures. Now of course there's several great use cases for a linked list: > > - You're writing a kernel/embedded thing and want to use an intrusive list. So I’ve got no clue what you’re railing about. The project specifically acknowledges that there is a need in kerneldev for those data structures. I’m a kernel dev using Rust for my kernel. I use both intrusive linked list and growable vectors in it. The thing is, the sentiment expressed in the article really resonates in me: in most cases, growable vectors are a better choice, performance-wise.
- ajross 7y ago(Had to edit in a quote to what I was replying to because you fixed the original): > The actual context of your fake quote: Good grief, that was a verbatim quote! Here's a link to the exact text I quoted: https://rust-unofficial.github.io/too-many-lists/#mumble-mumble-kernel-embedded-something-something-intrusive https://rust-unofficial.github.io/too-many-lists/#mumble-mum...
- throwaway17_17 7y agoThe quote that the GP is talking about is included below, which copy/pasted from the project page, and the Mumble mumble line is the heading for a paragraph: ‘’’Mumble mumble kernel embedded something something intrusive. It's niche. You're talking about a situation where you're not even using your language's runtime. Is that not a red flag that you're doing something strange? It's also wildly unsafe.’’’ Also, prior to this author claims the following, where the first line also a section heading: ‘’’ I can't afford amortization You've already entered a pretty niche space’’’ These fiat rulings based on one an authors generalization of what is ‘niche’ are what I assume GP was commenting on. These are the kinds of dismissals that some developers take issue with, as GP states.
- saagarjha 7y agoKernel development is niche. Most of the time you don’t need linked lists.
- jasondclinton 7y agohttps://github.com/Amanieu/intrusive-rs https://github.com/Amanieu/intrusive-rs implements what you're looking for with no heap. There's no need to flame or misrepresent what the book says (no one said embedded was a joke). The Rust embedded community is strong.
- ajross 7y agoYou're like the sixth person to argue I'm somehow "misrepresenting" what is being said in this book? I'm quoting it directly. The "flame" is in the original, and I'm responding to it. Take it out. It's bad.
- jasondclinton 7y agoAssuming that you're not trolling, I'll explain how you misinterpreted what you read: the section that you quoted is a sub-heading under: > An Obligatory Public Service Announcement which is an argument that: > Linked lists are as niche and vague of a data structure as a trie. The author then goes on to state that many people have contacted him to argue that linked lists are not niche and he puts each of those arguments under a heading: > Mumble mumble kernel embedded something something intrusive. is one such heading. Inside of it, he continues the argument that linked lists for embedded no-heap scenarios are niche and—to continue his argument—we therefore shouldn't be teaching undergrads linked lists just like we don't teach them tries.
- fhars 7y agoI think what ajross is arguing is that it is the author of the tutorial who is trolling here. It is all true what you and everyone else say against ajross‘ argument on the purely factual layer, it is just that the tone of the PSA is needlessly aggressive and condescending.
- deleted 7y ago[deleted]