Java for around 8 years Started learning Ruby ~3 years back ♥ Ruby ♥ the Ruby community Also learning some CoffeeScript and Scala http://rockyj.in @whatsuprocky
complete in overlapping time periods Concurrency can be implemented even in single processing units to speed things up Concurrency is non-deterministic Whereas a parallel program is one that merely runs on multiple processors, with the goal of hopefully running faster than it would on a single CPU
in the same memory context Ruby has Green Threads which are managed by the Ruby process JRuby has real OS thread that run parallel to the parent thread
Process ~= 150 MB 15 Processes ~= 2 GB RAM* Scaling this means more processes = more memory = more money Also, If you are CPU bound you want to use no more unicorn processes than you have cores, otherwise you overload the system and slow down the scheduler.
applications are IO bound With MRI you are always thread safe MRI is getting faster and GC is getting better Processes management is optimized Passenger is using a hybrid - evented + threaded / process architecture
don't share data across threads. If you must share data across threads, don't share mutable data. If you must share mutable data across threads, synchronize access to that data.
by a lot of scholars and universities Popularized by Erlang, now in Scala Simple and high-level abstractions for concurrency and parallelism Objects are Actors each with their own state which is never shared Communication happens through messages Very lightweight event-driven processes (approximately 2.7 million actors per GB RAM [Akka])
thread safe by default due to GIL / GVL JRuby gives you real concurrency (RBX as well) With power comes responsibility Don't worry, concurrency can be easy if you follow the ground rules If you want to write concurrent code yourself, use Actors * I did not cover STM (provided by Clojure)