Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7032365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:55:33+00:00 2026-05-28T00:55:33+00:00

I read somewhere that ruby threads/fibre block the IO even with 1.9. Is this

  • 0

I read somewhere that ruby threads/fibre block the IO even with 1.9. Is this true and what does it truly mean? If I do some net/http stuff on multiple threads, is only 1 thread running at a given time for that request?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:55:34+00:00Added an answer on May 28, 2026 at 12:55 am

    Assuming you are using CRuby, only one thread will be running at a time. However, the requests will be made in parallel, because each thread will be blocked on its IO while its IO is not finished. So if you do something like this:

    require 'open-uri'
    threads = 10.times.map do
      Thread.new do
        open('http://example.com').read.length
      end
    end
    
    threads.map &:join
    puts threads.map &:value
    

    it will be much faster than doing it sequentially.

    Also, you can check to see if a thread is finished w/o blocking on it’s completion.

    For example:

    require 'open-uri'
    thread = Thread.new do
      sleep 10
      open('http://example.com').read.length
    end
    puts 'still running' until thread.join(5)
    puts thread.value
    

    With CRuby, the threads cannot run at the same time, but they are still useful. Some of the other implementations, like JRuby, have real threads and can run multiple threads in parallel.

    Some good references:

    • http://yehudakatz.com/2010/08/14/threads-in-ruby-enough-already/

    • http://www.engineyard.com/blog/2011/ruby-concurrency-and-you/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I read somewhere that synchronized(this) should be avoided for various reasons . Yet some
I think I read somewhere that some modules only have object oriented interfaces (
I read somewhere that you can stop Magento from requiring two product descriptions... this
I read somewhere that CSS Expressions were deprecated and shouldn't even be used. I
I read somewhere that calling ensureIndex() actually creates a collection if it does not
I have read somewhere that CreateGraphics() will do this steps for us : BeginPaint
I think I've read somewhere that this is possible. Use case I want to
I read somewhere that older VB .net (pre VB .NET 2005?) couldn't use overloaded
I read somewhere that the isset() function treats an empty string as TRUE ,
I read somewhere that setting DataContext = this in the constructor of a user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.