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

Concurrent Ruby

Miha Filej
September 29, 2016

Concurrent Ruby

A short overview of concurrency and parallelism, the perils of the shared memory model, safer alternatives, the Guilds proposal for Ruby 3, and a short look at the concurrent-ruby gem.

Miha Filej

September 29, 2016
Tweet

More Decks by Miha Filej

Other Decks in Programming

Transcript

  1. CPU CPU CPU CPU CPU CP CP CP CP CPU

    CPU PU CPU CPU CPU CPU PU PU PU CPU CPU CPU CPU CPU
  2. ✴ Mutable objects belong to ONLY ONE Guild ✴ OTHER

    Guilds cannot access those objects ✴ No need for LOCKS ✴ Guilds communicate via CHANNELS (copying or moving). ✴ IMMUTABLE objects can be accessed by any Guild
  3. irb> [1, 2, 3].freeze irb> [1, Object.new, 3].freeze irb> 1,

    :sup, true, false, nil irb> "sup" # ruby 2.3 irb> "sup".freeze # ruby 2.3 irb> "sup" # ruby 3 irb> String("sup") # ruby 3 IMMUTABLE MUTABLE IMMUTABLE IMMUTABLE MUTABLE IMMUTABLE MUTABLE