blocking ruby threads

Discussion in 'Ruby' started by snacktime, Feb 24, 2007.

  1. snacktime

    snacktime Guest

    I've read a lot of bits and pieces in the past but maybe someone can
    help me finalize my thoughts here or correct me where I am wrong.

    From my understanding ruby threads will not block unless you are
    calling out to a C extension which blocks, or in specific off the wall
    case like needing to use resolve-replace so dns lookups don't block.
    I understand it to be this way because the select loop that is used to
    implement the threads will not do IO reads/writes unless there is data
    that is ready.

    Am I missing anything here? Are there other edge cases where ruby
    threads would block?

    Chris
     
    snacktime, Feb 24, 2007
    #1
    1. Advertising

  2. On 24.02.2007 04:41, snacktime wrote:
    > I've read a lot of bits and pieces in the past but maybe someone can
    > help me finalize my thoughts here or correct me where I am wrong.
    >
    > From my understanding ruby threads will not block unless you are
    > calling out to a C extension which blocks, or in specific off the wall
    > case like needing to use resolve-replace so dns lookups don't block.


    That depends on how DNS lookups are implemented in Ruby. If a standard
    library funtion is called then the interpreter might actually block.

    > I understand it to be this way because the select loop that is used to
    > implement the threads will not do IO reads/writes unless there is data
    > that is ready.
    >
    > Am I missing anything here? Are there other edge cases where ruby
    > threads would block?


    Not exactly an edge case but Ruby threads will block when trying to grab
    a mutex or monitor that is hold by another thread.

    Kind regards

    robert
     
    Robert Klemme, Feb 24, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hendra Gunawan
    Replies:
    1
    Views:
    12,582
    Allan Herriman
    Apr 8, 2004
  2. Andre Kelmanson

    blocking i/o vs. non blocking i/o (performance)

    Andre Kelmanson, Oct 10, 2003, in forum: C Programming
    Replies:
    3
    Views:
    937
    Valentin Tihomirov
    Oct 12, 2003
  3. nukleus
    Replies:
    14
    Views:
    836
    Chris Uppal
    Jan 22, 2007
  4. Christian
    Replies:
    5
    Views:
    738
    Esmond Pitt
    Dec 2, 2007
  5. Serge Savoie
    Replies:
    4
    Views:
    270
    Serge Savoie
    Oct 1, 2008
Loading...

Share This Page