Ruby goes to hollywood
Upcoming SlideShare
Loading in...5
×
 

Ruby goes to hollywood

on

  • 6,739 views

 

Statistics

Views

Total Views
6,739
Views on SlideShare
6,733
Embed Views
6

Actions

Likes
6
Downloads
40
Comments
0

5 Embeds 6

http://lanyrd.com 2
http://edespecial-profsimone.blogspot.com 1
http://twitter.com 1
http://formation.scd.univ-brest.fr 1
http://static.slidesharecdn.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Ruby goes to hollywood Ruby goes to hollywood Presentation Transcript

  • Ruby goes to @elise_huard Euruko 2011Monday 30 May 2011
  • Why Concurrency?Monday 30 May 2011
  • “... for the first time in history, no one is building a much faster sequential processor. If you want your programs to run significantly faster (...) you’re going to have to parallelize your program.” Hennessy and Patterson “Computer Architectures” (4th edition, 2007)Monday 30 May 2011
  • Concurrency != ParallellismMonday 30 May 2011
  • 3 threads, 2 cores 1 1 2 2 3 1 3 3 2 1 core1 core2 core1 core2Monday 30 May 2011
  • Your program language VM OS (kernel processes, other processes) multicore - multiCPUMonday 30 May 2011
  • Concurrency will melt your brain non-determinism mutable AND shared stateMonday 30 May 2011
  • Actor ModelMonday 30 May 2011
  • Hewitt et al. 1973 no shared state in response to a message, an actor can: make local decisions create more actors send more messages determine how to respond to the next message receivedMonday 30 May 2011
  • Hewitt et al. 1973 Generalization of the lambda calculusMonday 30 May 2011
  • Inspiration artificial intelligence ‘quantum mechanics’ - observing details by which the order of arrival of messages for an actor is determined can affect resultMonday 30 May 2011
  • The point only actors - no global state partial order of execution from http://pragprog.com/titles/vspcon/programming-concurrency-on-the-jvmMonday 30 May 2011
  • Implementations • using threads/processes • async messaging - mailbox • pattern matching on incoming messages • actors = state machines.Monday 30 May 2011
  • Lifecycle from http://pragprog.com/titles/vspcon/programming-concurrency-on-the-jvmMonday 30 May 2011
  • Sleeping barber shop with x chairs 1 barber no customer: sleep. customers: cut hairs customer if barber is sleeping: wake him up else if enough chairs take a chair else leaveMonday 30 May 2011
  • Monday 30 May 2011
  • Actors in RubyMonday 30 May 2011
  • Concurrent gem theoretical - different concurrency models https://github.com/mental/concurrentMonday 30 May 2011
  • Rubinius Actors require actor actor = Actor.spawn(Actor.current) do |master| msg = Actor.receive master.send msg end actor.send "test" msg = Actor.receive # msg == "test"Monday 30 May 2011
  • Revactor concurrent I/O for networking apps Evented rather than parallel https://github.com/tarcieri/revactorMonday 30 May 2011
  • Celluloid thread-based actors based on erlang https://github.com/tarcieri/celluloidMonday 30 May 2011
  • No true parallelism with MRIMonday 30 May 2011
  • Cheat on RubyMonday 30 May 2011
  • Erlang light-weight processes = actorsMonday 30 May 2011
  • Erlang blocking receives timeouts supervision trees: fault-toleranceMonday 30 May 2011
  • Erlectricity require rubygems require erlectricity receive do |f| f.when([:echo, String]) do |text| f.send!([:result, "You said: #{text}"]) f.receive_loop end end https://github.com/mojombo/erlectricityMonday 30 May 2011
  • Reia or Elixir languages on erlang vm friendlier, more ruby-like, OOMonday 30 May 2011
  • Scala “We also included enhancements to make it easier to call from Ruby into Scala libraries, which has enabled the Lift web framework to offer support for Ruby.” Charles Nutter, ‘JRuby 1.6 released, now what ?’ http://www.engineyard.com/blog/2011/jruby-1-6-released-now-what/ Actors in standard libraryMonday 30 May 2011
  • Akka actor model + software transactional memory java and scalaMonday 30 May 2011
  • Akka • sending: reply is possible or not, sync or async • supervision: several strategies • as library or as framework • local and distributedMonday 30 May 2011
  • JRuby!Monday 30 May 2011
  • CaveatMonday 30 May 2011
  • Advantages easy to grasp real encapsulation - separation of concerns highly decentralizedMonday 30 May 2011
  • But many messages (bandwidth) livelocks are still possibleMonday 30 May 2011
  • Back to RubyMonday 30 May 2011
  • Time to control shared state ? Change RubySpec: default: variables not shared between threads? integrate better concurrency primitives into the Ruby stdlib ?Monday 30 May 2011
  • Let’s think about it.Monday 30 May 2011
  • Thanks @elise_huard http://www.delicious.com/elisehuard/concurrencyMonday 30 May 2011
  • Ruby goes to Hollywood Elise Huard LRUG 11-04-2011Monday 30 May 2011
  • Ruby goes to Hollywood Elise Huard LRUGMonday 30 May 2011
  • Monday 30 May 2011