tags:

views:

66

answers:

1

Hi,

When I exec a Ruby process, how can I have that process lower it's priority? I've looked at the documentation for Process.setpriority but I just don't get it. Does anyone have an example of how a Ruby process would lower it's own priority?

Chris

+3  A: 

You should be able to specify the current process with a 0. If you look at the ruby source for Process.setpriority all this call is doing is calling the underlying OS setpriority call. On unix the priority can be between -20 and 20 where -20 is the most favorable and 20 is the least favorable for scheduling. So if you want to boost the current process as high as it can go you would do:

Process.setpriority(Process::PRIO_PROCESS, 0, -20)
carson
I'll check this out but points for explaining that the 0 refers to the current process. - Chris
Chris McCauley