<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 12, 2014 at 5:55 PM, Perry E. Metzger <span dir="ltr"><<a href="mailto:perry@piermont.com" target="_blank">perry@piermont.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Personally I'm partial to go's solution, which is to adopt the CSP<br>


model and get rid of shared state entirely, but that's another long<br>
story, and we're getting far afield of crypto.</blockquote><div><br></div><div>Go still shares state between goroutines and is still just as susceptible to data races as any other language which bolts on CSP or actors as an afterthought. They have at least started shipping a race detector, but this will only detect data races when they manifest (which is often at the worst times, e.g. in production and under unusual load), as opposed to Rust, which leverages the type system to ensure it's impossible to share state unsafely.</div>

<div><br></div><div>I think there's a bit of a misconception that Go has separate heaps per goroutine or something of that nature ala Erlang, but this isn't the case, it has a single flat shared heap and sending a value over a channel just shares a reference to the same data between two potentially racy goroutines.</div>

<div><br></div><div>It's described on Wikipedia here:</div><div><br></div><div><a href="https://en.wikipedia.org/wiki/Go_(programming_language)#Race_condition_safety">https://en.wikipedia.org/wiki/Go_(programming_language)#Race_condition_safety</a><br>

</div><div><br></div><div>I'd also note that Rust also implements CSP and has tasks/channels, although Rust supports both synchronous and asynchronous channels (whereas Go only supports synchronous channels) and Rust also supports both 1:1 and M:N tasks:threads (which you can mix and match in the same program using the same API), whereas Go only supports M:N tasks (i.e. goroutines)</div>

<div><br></div><div>Anyway, I apologize if I'm dragging the list further off topic ;) I just wanted to make it clear that Go is not a "concurrency safe" language in the same way Rust is. CSP alone is not a silver bullet.</div>

<div><br></div></div>--<br>Tony Arcieri<br>
</div></div>