Re:What Unix Cost Us [video]
by usrbinbash on Monday July 10, 2023 @04:32AM
(#36663539)
> Multithreading in C, however, is left as an exercise to the coder.
Well, it is a systems implementation language, so it cannot, and should not, impose too many guardrails.
And yes, sometimes systems implementations need to do things that even all the checks built into Rust would scream loudly about. Rust, which is also meant to implement system code with, acknowledges this duality, that's why the `unsafe` keyword exists.
And while the complexity of avoiding race conditions does exist, we have good solutions for it. One such solution is CSP. Passing state and synchronizing via messages is an incredibly natural and logical way to think about the structure of concurrent codebases.
Rust is also a “system implementation” language.
Re:What Unix Cost Us [video]
by usrbinbash on Monday July 10, 2023 @08:28AM
(#36665355)
Yes? I said so in my above post?
> Rust, which is also meant to implement system code with
Rust prevents data races by the help of the borrow checker (by preventing multiple threads using the same resource concurrently), and it also helps by disallowing sending objects to other threads if they were not marked as capable of such.
I don't use Rust very much, so someone correct me if I'm wrong, but the ownership and borrowing system makes the compiler fail if you transfer data to child threads and then use it in the main one. It's just safer to parallelize code, and you'll do it! (unlike in C, where it may be better not to risk it)