On 28 Jan 2001, at 10:02, Hal E. Fulton wrote:

[clipped]
> My knowledge of threading in general is weak
> (though most of Ruby's threads seem straightforward
> so far).

I have not used threading in Ruby but I use it in C/C++

[clipped]
> A mutex is slightly harder to grasp.

A mutex (mutual exclusion) is a lock which may selectively used 
for data which may be accessed by multiple threads.  A thread 
locks the mutex to ensure that it is the only thread operating on 
that piece of data.  Should another thread currently hold the mutex 
the thread will block until the mutex becomes unavailable.

> Condition variables are a little harder.

A condition variable allows threads to wait for an event to occur, 
usually with an optional timeout.  All the threads waiting on the 
condition variable will be unsuspended when the condition is 
signalled.  Presumably by another thread.

> As for monitor.rb and sync.rb, I haven't even looked 
> at them yet.

I am sorry I am not familiar with these, I'm sure someone more 
familiar with Ruby will comment.

> Can anyone shed a paragraph or two of light on this
> topic? I'm just looking for an overview, i.e., when/why
> to use, pros/cons.

This is like most design issues is not very straight forward and 
open to "discussion" (or outright mud slinging).  I suggest a good 
starting refence is the comp.programming.threads FAQ.  Which 
any good search engine should turn up for you.

I hope you find this helpful.

Marc

--
Last time I fell frame grace I bruised my knee.
Aussie lost in America.
marcbutler / acm.org
Last time I fell frame grace I bruised my knee.
Aussie lost in America.
marcbutler / acm.org