|P is for Practical|
Score: Perl 1, Ruby 0by hackdaddy (Hermit)
|on Feb 21, 2006 at 04:03 UTC||Need Help??|
I should have known better, but I experimented with threading in Ruby on Win32. I started with the condition variables example in the Ruby Programming book. A different version of the book, but online, is available here: Ruby Programming
To my detriment, I quickly skimmed through the introduction for the chapter on Threads and Processes. I then quickly created a nifty script that has a controller thread and a worker thread. The controller thread puts tasks on a shared queue.
I was able to whip something together which quickly suited my needs, or, so I thought.
This morning I was thinking, "Wow, this Ruby could be something." Well, I did some more testing and tweaking of my code, and then finally gave the worker thread some real work to do. I am using the worker thread to run Subversion commands such as:
I was slightly surprised when the worker thead running `svn update` command caused thread starvation and hung all threads. If only I had read the chapter introduction closely.
I know this is OT for Perl, but I think it illuminates how Perl is a real world language, while Ruby is still somewhat of a pipe dream. By the way, if you know how to work around thread starvation with Ruby and Windows, please let me know. I'd like to get a full preview of Ruby vs. Perl.
I'm also trying Ruby on Rails. I know Perl is as slick as Ruby, but I wish the Perl community made tools easier to install and use. I don't know how many times I had missed opportunities to use Perl about the workplace, but somebody couldn't get Perl and whatever else installed on their box.
Also, if you have any nifty examples of thread pools and/or Subversion Perl utilities, please send them my way. Thanks.