Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Concurrency in Ruby

Concurrency in Ruby

Rahul Trikha

October 13, 2015
Tweet

More Decks by Rahul Trikha

Other Decks in Technology

Transcript

  1. What is Concurrency? Concurrency is when two tasks can start,

    run, and complete in overlapping time periods. It doesn't necessarily mean they'll ever both be running at the same instant. Eg. multitasking on a single- core machine. Parallelism is when tasks literally run at the same time, e.g. on a multicore processor.
 
 Quoting Sun's Multithreaded Programming Guide
  2. Why do we need Concurrency? • The Power Wall •

    MultiCore CPUs • Blocking IO • Wasted Compute Cycles
  3. Concurrency Models • Threads and Locks • Almost all languages

    support this one way or another • Actors (Message passing via Actors) • Scala • Erlang • Elixir • Communicating sequential processes (Message passing via Channels) • Clojure's core.async • Go • Data Parallelism (Computing across Multiple Processors in Parallel Computing Environments) • Open Computing Language (OpenCL)
  4. Actor Model "I thought of objects being like biological cells

    and/or individual computers on a network, only able to communicate with messages (so messaging came at the very beginning -- it took a while to see how to do messaging in a programming language efficiently enough to be useful)." Alan Kay