Ruby 1.8.7 does NOT use Real OS Threads but Python does !!! Proof !!!

Proof that Ruby 1.8.7 does NOT use Real OS Threads !!!

How many times have I heard someone tell me Ruby 1.8.7 uses Real OS Threads and always has from the beginning ?!?

Far too many times…

You see, some people are so deep in denial they want Ruby to be what it is very clearly not and cannot be.  They proclaim Ruby can do everything it cannot do like use Real OS Threads by default without so much as taking the time to give it a real objective test.  Here is a real objective test.  I have no vested interest in either Ruby or Python, my only interest is in testing to see which is using Real OS Threads.

Ruby uses green threads which is to say Ruby simulates the use of Threads but it does NOT use Real OS Threads by default. There are some Ruby Gems out there that do allow Real OS Threads to be used but Ruby itself by default does NOT use Real OS Threads.  If Ruby did use Real OS Threads one would see the Real OS Threads when one views the process at runtime.

Python 2.5.x does use Real OS Threads because you can see the number of threads appear when viewing the process at runtime.

You cannot fool the OS.  When the OS knows there are Real OS Threads they show-up otherwise nothing but a single thread shows-up.

Run the tests. Write some code. Look at the OS Process.  See the Proof. It’s just that easy !  In the meantime, don’t try to talk smack to me unless you have actually seen the proof for yourself !!!

Look, if you want to prove me wrong then prove me wrong but do it with code I can run in my own Ruby right here with my own computer(s) or don’t bother to tell me how wrong I might be… On the other hand, if it helps me get a job and earn some money then I don’t mind letting certain select people tell me how wrong I am while I am taking their money – after I have cashed all the checks I will be right back here testing to see who’s right and who’s wrong.  So far Ruby keeps telling me how much it don’t use Real OS Threads…  and I am not the only person saying this even though people keep telling me just how wrong I am.

BTW, I am NOT the one who is wasting his money on Ruby… When it’s my money I don’t throw it away trying to make-believe Ruby is what Ruby cannot be.  I know exactly what Ruby is and how it works.

So here’s the Proof !

The Ruby Code:

The Python Code:

The OS:

  • iMac Core i7 running OS/X 10.7 Lion
  • Ruby 1.8.7
  • Python 2.5.2 Stackless 3.1b3 060516 (python-2.52:61022, Feb 27 2008, 16:52:03)
  • [GCC 4.0.1 (Apple Computer, Inc. build 5341)]

The Proof

Conclusion

Some people hear the work “multi-threaded” and they fail to look any deeper into the issue because they will concluse, “…I can use threads therefore it must be multi-threaded…”.  It is possible for Ruby 1.8.7 to be single-threaded from the OS Process perspective while being mutli-threaded from the perspective of Ruby within the larger context of a single OS Thread.  Everything that happens in Ruby 1.8.7 that does not specifically use real os threads will use simulated green threads that are not real os threads.

Advertisement

About raychorn
See my profile at http://www.linkedin.com/in/raychorn with more than 10 million connections.

Comments are closed.

Follow

Get every new post delivered to your Inbox.

Join 329 other followers