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
The second argument in setpriority (and getpriority) indicates the process you want to change; using 0 will specify the current process.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With