Arc in Rust stands for Atomic Reference Counting.

Arc in Nim stands for Automatic Reference Counting.

For a shared mutable variable you need to consider ownership:

  * which thread allocates the variable, which thread deallocates. For example 
if there is a master thread that create and destroy child threads, you can 
ensure that data lives long enough by having alloc/dealloc in the master 
thread. On the other hand, if data can be allocated and deallocated from any 
thread, you need atomic reference counting, which can be implemented in a 
couple dozens lines: 
<https://github.com/mratsim/weave/blob/71dc2d7/weave/cross_thread_com/flow_events.nim#L176-L201>=
  * can mutation be concurrent on the same data (and so need synchronization) 
or not (say parallel map on a sequence/vector)


Reply via email to