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

Celluloid & DCell

Celluloid & DCell

Patrick Van Stee

July 11, 2012

More Decks by Patrick Van Stee

Other Decks in Programming


  1. class Counter attr_reader :count def initialize @count = 0 @mutex

    = Mutex.new end def increment @mutex.synchronize do @count += 1 end end end
  2. class Counter include Celluloid def increment(count, actor) return count if

    count < 10000 actor.increment( count + 1, Actor.current ) end end
  3. counter = Counter.new # returns immediately counter.increment! puts counter.count #

    returns immediately future = counter.future :increment puts future.value
  4. • The GIL in MRI does not allow parallelism •

    Threads and Fibers are expensive • Concurrency is still a hard problem [not really]
  5. Celluloid General purpose concurrency framework for Ruby built on the

    Actor Model DCell Distributed Celluloid over 0MQ
  6. “I thought of objects being like biological cells or individual

    computers on a network, only able to communicate with messages. Alan Kay