This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_extPart_001_01C10A03.60655D80
Content-Type: text/plain;
	charsetso-8859-1"

I kind of like the Ruby interpreter per native thread idea.  I wish I knew
more about what data structures maintain the current state of the
interpreter.  That way I could switch between interpreters at will.  

By the way sorry I mentioned PThreads as the mechanism to accomplish this
functionality!!  I should have used the words "NATIVE THREADS", whatever
platform.  I work with UNIX systems and that just naturally came out, though
I think POSIX is available on most platforms even WinNT/2K (that was kind of
the whole idea behind POSIX I think?)

Anyway, I digress.  I guess I will just study the code more, unless some one
can tell me the exact data structures that I'd have to have in a thread
specific memory hash?

Also matju are you talking about the sleep command not being granular
enough? My understanding is that the sleep command in ruby even though it
returns only integers still honors fractional parameters e.g. "sleep(.1)"

If that's not what you mean, I guess I'm just a bit lower down on the
understanding tree.  

Thanks, 
Gene

PS Would you send me the code your talking about? I missed your post.






Mathieu Bouchard [matju / sympatico.ca] Wrote:
----------------------------------------------------------------------------
------------------------------------------------
Although Ruby could be ported to Posix threads, the advantage of the
current scheme is that you don't have to lock any data structures (and you
don't have to reserve memory for those locks).

And since this is a programming language and the user can do anything he
wants and Threads share a single ObjectSpace, you would have to lock
a whole lot of things (e.g. Java).

What I may like is the possibility to put one Ruby interpreter per POSIX
Thread, and make them communicate together through locked shared memory
and Marshal. But that's almost like networking several Ruby processes
together by SYSV Shared Memory.



Btw I have a question about Ruby's current Thread system. How do I adjust
the thread switching granularity? it was so coarse that I decided to use
fork() instead of Thread for generating timers (Linux goes down to the
1..10 msec range). This is why the profiler I posted the other day calls
fork() with a while/kill/sleep/end loop.



matju

------_extPart_001_01C10A03.60655D80
Content-Type: text/html;
	charsetso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.92">
<TITLE>RE: [ruby-talk:17618] Pthreads</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>I kind of like the Ruby interpreter per native thread idea.&nbsp; I wish I knew more about what data structures maintain the current state of the interpreter.&nbsp; That way I could switch between interpreters at will.&nbsp; </FONT></P>

<P><FONT SIZE=2>By the way sorry I mentioned PThreads as the mechanism to accomplish this functionality!!&nbsp; I should have used the words &quot;NATIVE THREADS&quot;, whatever platform.&nbsp; I work with UNIX systems and that just naturally came out, though I think POSIX is available on most platforms even WinNT/2K (that was kind of the whole idea behind POSIX I think?)</FONT></P>

<P><FONT SIZE=2>Anyway, I digress.&nbsp; I guess I will just study the code more, unless some one can tell me the exact data structures that I'd have to have in a thread specific memory hash?</FONT></P>

<P><FONT SIZE=2>Also matju are you talking about the sleep command not being granular enough? My understanding is that the sleep command in ruby even though it returns only integers still honors fractional parameters e.g. &quot;sleep(.1)&quot;</FONT></P>

<P><FONT SIZE=2>If that's not what you mean, I guess I'm just a bit lower down on the understanding tree.&nbsp; </FONT>
</P>

<P><FONT SIZE=2>Thanks, </FONT>
<BR><FONT SIZE=2>Gene</FONT>
</P>

<P><FONT SIZE=2>PS Would you send me the code your talking about? I missed your post.</FONT>
</P>
<BR>
<BR>
<BR>
<BR>
<BR>

<P><FONT SIZE=2>Mathieu Bouchard [matju / sympatico.ca] Wrote:</FONT>
<BR><FONT SIZE=2>----------------------------------------------------------------------------------------------------------------------------</FONT></P><P><FONT SIZE=2>Although Ruby could be ported to Posix threads, the advantage of the</FONT>
<BR><FONT SIZE=2>current scheme is that you don't have to lock any data structures (and you</FONT>
<BR><FONT SIZE=2>don't have to reserve memory for those locks).</FONT>
</P>

<P><FONT SIZE=2>And since this is a programming language and the user can do anything he</FONT>
<BR><FONT SIZE=2>wants and Threads share a single ObjectSpace, you would have to lock</FONT>
<BR><FONT SIZE=2>a whole lot of things (e.g. Java).</FONT>
</P>

<P><FONT SIZE=2>What I may like is the possibility to put one Ruby interpreter per POSIX</FONT>
<BR><FONT SIZE=2>Thread, and make them communicate together through locked shared memory</FONT>
<BR><FONT SIZE=2>and Marshal. But that's almost like networking several Ruby processes</FONT>
<BR><FONT SIZE=2>together by SYSV Shared Memory.</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=2>Btw I have a question about Ruby's current Thread system. How do I adjust</FONT>
<BR><FONT SIZE=2>the thread switching granularity? it was so coarse that I decided to use</FONT>
<BR><FONT SIZE=2>fork() instead of Thread for generating timers (Linux goes down to the</FONT>
<BR><FONT SIZE=2>1..10 msec range). This is why the profiler I posted the other day calls</FONT>
<BR><FONT SIZE=2>fork() with a while/kill/sleep/end loop.</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=2>matju</FONT>
</P>

</BODY>
</HTML>
------_extPart_001_01C10A03.60655D80--