Re:The state of the Rust Runtime
by yepguy on Sunday December 29, 2013 @05:26PM
(#6981754)
No, not necessarily. Rust does not allow shared memory between tasks, but Go does, for example.
[ Parent
| on HN ]
Rust has the concept of a shared heap meant for sharing memory between tasks. Tasks do have to claim (and then release) ownership of references from this shared heap, so this works like a locking mechanism, preventing 2 tasks from modifying a reference at the same time.
References on the shared heap can't be managed by a garbage collector. But references on local heaps can be managed by a thread-local garbage collector. Which is actually rather cool, as Rust basically sidesteps the need for having a concurrent, compacting, generational GC (in Rust the GC is also entirely optional).
This is entirely wrong. You can easily pass a raw pointer (I.e. same semantics as a C pointer) between tasks and use this to unsafely share memory (I.e. risk of data races), or you can use one of the safe higher level wrappers in extra::arc, that is, Arc for immutable shared memory, or RWArc or MutexArc for lock-protected mutable shared memory.
Re:The state of the Rust Runtime
by chrismorgan on Sunday December 29, 2013 @10:06PM
(#6982798)
It's still worth while noting that Rust’s modus operandi eschews shared memory; to get shared memory between tasks, you've got to be fairly explicit about it.