thread scheduling

Discussion in 'Ruby' started by Mark Volkmann, Jan 10, 2006.

  1. 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.
     
    Mark Volkmann, Jan 10, 2006
    #1
    1. Advertising

  2. 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
     
    Robert Klemme, Jan 11, 2006
    #2
    1. Advertising

  3. On 1/11/06, Robert Klemme <> 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=3D 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.
     
    Mark Volkmann, Jan 11, 2006
    #3
  4. Mark Volkmann

    Lou Vanek Guest

    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.


    > --
    > R. Mark Volkmann
    > Partner, Object Computing, Inc.
     
    Lou Vanek, Jan 11, 2006
    #4
  5. On 1/11/06, Lou Vanek <> 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.
     
    Mark Volkmann, Jan 11, 2006
    #5
  6. Mark Volkmann

    Lou Vanek Guest

    times are set in either function:

    thread_timer, or
    rb_thread_start_timer,

    depending on whether _THREAD_SAFE is set (on my platform it is).

    On my platform, time slice is set to 10 milliseconds:

    req.tv_nsec = 10000000;


    WAIT_TIME is just a flag. It is not the amount of time to wait.


    Mark Volkmann wrote:

    > On 1/11/06, Lou Vanek <> 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.
     
    Lou Vanek, Jan 11, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony Proctor

    ASP Thread Scheduling Anomalies

    Tony Proctor, Mar 2, 2005, in forum: ASP General
    Replies:
    6
    Views:
    269
    Tony Proctor
    Mar 16, 2005
  2. chris guenther
    Replies:
    0
    Views:
    113
    chris guenther
    Apr 10, 2005
  3. vincent
    Replies:
    0
    Views:
    167
    vincent
    Jun 22, 2005
  4. Replies:
    1
    Views:
    114
    Ara.T.Howard
    Sep 3, 2005
  5. Jeffrey Flint

    thread scheduling question

    Jeffrey Flint, Jan 9, 2008, in forum: Ruby
    Replies:
    0
    Views:
    80
    Jeffrey Flint
    Jan 9, 2008
Loading...

Share This Page