[#5218] Ruby Book Eng tl, ch1 question — Jon Babcock <jon@...>

13 messages 2000/10/02

[#5404] Object.foo, setters and so on — "Hal E. Fulton" <hal9000@...>

OK, here is what I think I know.

14 messages 2000/10/11

[#5425] Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — Jon Babcock <jon@...>

18 messages 2000/10/11
[#5427] RE: Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — OZAWA -Crouton- Sakuro <crouton@...> 2000/10/11

At Thu, 12 Oct 2000 03:49:46 +0900,

[#5429] Re: Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — Jon Babcock <jon@...> 2000/10/11

Thanks for the input.

[#5432] Re: Ruby Book Eng. tl, 9.8.11 -- seishitsu ? — Yasushi Shoji <yashi@...> 2000/10/11

At Thu, 12 Oct 2000 04:53:41 +0900,

[#5516] Re: Some newbye question — ts <decoux@...>

>>>>> "D" == Davide Marchignoli <marchign@di.unipi.it> writes:

80 messages 2000/10/13
[#5531] Re: Some newbye question — matz@... (Yukihiro Matsumoto) 2000/10/14

Hi,

[#5544] Re: Some newbye question — Davide Marchignoli <marchign@...> 2000/10/15

On Sat, 14 Oct 2000, Yukihiro Matsumoto wrote:

[#5576] Re: local variables (nested, in-block, parameters, etc.) — Dave Thomas <Dave@...> 2000/10/16

matz@zetabits.com (Yukihiro Matsumoto) writes:

[#5617] Re: local variables (nested, in-block, parameters, etc.) — "Brian F. Feldman" <green@...> 2000/10/16

Dave Thomas <Dave@thomases.com> wrote:

[#5705] Dynamic languages, SWOT ? — Hugh Sasse Staff Elec Eng <hgs@...>

There has been discussion on this list/group from time to time about

16 messages 2000/10/20
[#5712] Re: Dynamic languages, SWOT ? — Charles Hixson <charleshixsn@...> 2000/10/20

Hugh Sasse Staff Elec Eng wrote:

[#5882] [RFC] Towards a new synchronisation primitive — hipster <hipster@...4all.nl>

Hello fellow rubyists,

21 messages 2000/10/26

[ruby-talk:5905] Re: [RFC] Towards a new synchronisation primitive

From: Robert Feldt <feldt@...>
Date: 2000-10-27 11:57:03 UTC
List: ruby-talk #5905
On Fri, 27 Oct 2000, Robert Feldt wrote:

> * We can either introduce new syntax / new primitives into the language or
> choose a simple but sufficient primitive in the language (much like
> Thread.critical today) and then implement mutexes et al on top of that
> (MutexM in RAA is similar to your proposed solution but implemented in the
> current synch model).
> 	* pros with second model is that you can choose the synch
> 	  primitive mostly suited to your needs; there is no one mandated
> 	  by the language.
> 	* cons with sencond model is that people might be tempted to use
> 	  Thread.critical even though a mutex or similar might do, thus
> 	  unnecessarily halting the scheduling / suffering
> 	  performance-wise. (ways to overcome this might be to have Mutex,
> 	  Semaphore, Monitor et al in the standard lib (in the lib ref for
> 	  example) so that they are as visible as Thread.critical)
> 	* lots of more pros/cons...?
> 
Here's a proposal for a refactoring/design of Ruby's thread
synchronization built on a "simple but sufficient" primitive (in order of 
increasingly higher abstraction levels):

1. rb_test_and_set(var)
	Atomic operation (ie. NO scheduling while it runs) for the
        pseudocode:

	int TestAndSet(int *x){
           int temp = *x;
	   *x = 1;
	   return temp;
	end;

        The syntax in Ruby might be test_and_set(x) or something similar.

	This is actually everything that is needed to implement all of
	the other common synch primitives.

	Do not supply Thread.critical= that can stop the scheduler since
        it's both dangerous and might incur unnecessary performance
        penalties. This must of course be weighted against the cost of
        older Ruby scripts using Thread.critical= not working anymore...

2. Implement the common synch primitives (Semaphore, Monitor,
ConditionVariable, what-have-you) using test_and_set. They can even be
written to handle the priority inversion problem since we have
get_priotity and set_priority (alternatively this should/could be in the
scheduler?). IMHO these basic building blocks should be part of the
standard lib and we should encourage people to use them instead of using
the test_and_set directly. To simplify things we can choose one of them
and have it in the standard lib and then have the rest in an
extension (see 4 below).

3. Implement synch/lock on the user-object level using the synch
primitives in 2 above. See for example Masatoshi SEKI's MutexM at
http://www.ruby-lang.org/en/raa-list.rhtml?name=MutexM

4. Implement message queues and the rest of the common multi-threading
helper classes in extension 'multithreading'.

My knowledge of the current implementation of Ruby threads is somewhat
limited though, so I'm not sure how this would affect the deadlock
detection currently available?

Regards,

Robert


In This Thread