[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

thread scheduling

Mark Volkmann

1/10/2006 10:52:00 PM

I've search for documentation about whether Ruby thread scheduling
uses FIFO or round-robin and can't find anything. It seems to be
round-robin. Is that correct?

Is there a way to control the time slice used for each thread running
at the same priority?

--
R. Mark Volkmann
Partner, Object Computing, Inc.


5 Answers

Robert Klemme

1/11/2006 9:50:00 AM

0

Mark Volkmann wrote:
> I've search for documentation about whether Ruby thread scheduling
> uses FIFO or round-robin and can't find anything. It seems to be
> round-robin. Is that correct?
>
> Is there a way to control the time slice used for each thread running
> at the same priority?

No direct means AFAIK. You can always use Thread#pass but I recommend to
not to. Also, there are no thread priorities AFAIK.

robert

Mark Volkmann

1/11/2006 2:10:00 PM

0

On 1/11/06, Robert Klemme <bob.news@gmx.net> wrote:
> Mark Volkmann wrote:
> > I've search for documentation about whether Ruby thread scheduling
> > uses FIFO or round-robin and can't find anything. It seems to be
> > round-robin. Is that correct?
> >
> > Is there a way to control the time slice used for each thread running
> > at the same priority?
>
> No direct means AFAIK. You can always use Thread#pass but I recommend to
> not to. Also, there are no thread priorities AFAIK.

The Thread class has priority and priority= instance methods. I
created two threads and noticed that they were time slicing. Then I
set the priority of one to be higher than the other and it got all the
time until it completed. So thread priorities seem to be supported.

--
R. Mark Volkmann
Partner, Object Computing, Inc.


vanekl

1/11/2006 2:46:00 PM

0

Mark Volkmann

1/11/2006 3:17:00 PM

0

On 1/11/06, Lou Vanek <vanek@acd.net> wrote:
> Mark Volkmann wrote:
>
> > I've search for documentation about whether Ruby thread scheduling
> > uses FIFO or round-robin and can't find anything. It seems to be
> > round-robin. Is that correct?
>
> all threads being equal, it's round robin.
>
> the thread scheduler is called rb_thread_schedule in the eval.c file.
>
> > Is there a way to control the time slice used for each thread running
> > at the same priority?
>
> you would have to change the hard-coded time (integer) values
> in the eval.c file and recompile ruby.

Thanks for the info! That's some tough code to read. I thought I
could at least find the time slice duration, but I failed. Do you know
which variable/constant holds that? Is it WAIT_TIME? That has a
value of (1<<2) which I guess is equal to 4. 4 what? milliseconds?
microseconds?

--
R. Mark Volkmann
Partner, Object Computing, Inc.


vanekl

1/11/2006 4:29:00 PM

0