Digest: GIL in Ruby

1. Parallel Workers

  • Advantages

  • Disadvantages

    • shared states

      • Problems

        • race conditions
        • deadlock
      • Solutions:

        • non-blocking concurrency algorithm
        • persistent data structure
        • stateless
    • job order is non-deterministic

2. Assembly line

Non-blocking IO operation

  • Actors: mailbox and addresses
  • Channels: subscriptions

3. Functional Parallelism

When each function call can be executed independently, each function call can be executed on separate CPUs. That means, that an algorithm implemented functionally can be executed in parallel, on multiple CPUs.

comments powered by Disqus