Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Go has concurrency features built in to the core language while Scala uses the <a href="http://www.scala-lang.org/api/current/index.html#scala.concurrent.package" rel="nofollow noreferrer">concurrent package</a> and concurrency primitives from Java's <code>java.util.concurrent</code>.</p> <p>In Scala it's idiomatic to use either thread-based concurrency or the <a href="http://en.wikipedia.org/wiki/Actor_model" rel="nofollow noreferrer">Actor Model</a>, while Go concurrency is based on <a href="http://en.wikipedia.org/wiki/Communicating_sequential_processes" rel="nofollow noreferrer">Hoare's Communicating Sequential Processes</a>.</p> <p>Although the concurrency primitives between the two languages aren't the same, it looks like there is <em>some</em> similarity.</p> <p>In Go concurrency is usually achieved using <a href="http://golang.org/doc/effective_go.html#goroutines" rel="nofollow noreferrer">Goroutines</a> and <a href="http://golang.org/doc/effective_go.html#channels" rel="nofollow noreferrer">Channels</a>. There are also other more traditional <a href="http://golang.org/pkg/sync/" rel="nofollow noreferrer">low level synchronization primitives such as mutexes and wait groups</a>.</p> <p>In Scala, as far as I know, any class that is declared "Runnable" will be launched in a separate thread, and will not block. This is functionally similar to goroutines.</p> <p>In Scala Queues can be used to pass information between routines in a <em>similar</em> fashion to Channels in Go.</p> <p>EDIT: As pointed out by <a href="https://stackoverflow.com/users/50742/chuck">Chuck</a>, <em>"the crucial difference between Scala's Queues and Go channels is that, by default, Go's channels block on write until something is ready to read from them and block on read until something is ready to write to them."</em>. This would need to be written into any Scala implementation of channels.</p> <p>EDIT 2: As pointed out by <a href="https://stackoverflow.com/users/293686/mauricio-linhares">Maurício Linhares</a>, <em>"You can do concurrency without visible callbacks in Scala using Async - github.com/scala/async - but you can't do it without callbacks at all, it's just not possible given the way the JVM is currently implemented."</em>.</p> <p>Thanks to all for the constructive comments.</p> <p>For more info see:</p> <ul> <li><a href="http://golang.org/doc/effective_go.html#concurrency" rel="nofollow noreferrer">http://golang.org/doc/effective_go.html#concurrency</a></li> <li><a href="http://www.scala-lang.org/api/current/index.html#scala.concurrent.package" rel="nofollow noreferrer">http://www.scala-lang.org/api/current/index.html#scala.concurrent.package</a></li> <li><a href="http://twitter.github.io/scala_school/concurrency.html" rel="nofollow noreferrer">http://twitter.github.io/scala_school/concurrency.html</a></li> <li><a href="https://github.com/scala/async" rel="nofollow noreferrer">https://github.com/scala/async</a></li> <li><a href="http://akka.io/docs/" rel="nofollow noreferrer">http://akka.io/docs/</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload