ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Controlling system resources with nice and ionice

asked 2017-05-26 09:42:48 -0600

nckswt gravatar image

updated 2017-05-26 10:20:24 -0600

I'd like to run nodes with high priority for both cpu time and file i/o time. As found in roslaunch documentation, we can use a launch-prefix to run nice, like this example for rosserial:

<node name="rosserial" pkg="rosserial_python" type="serial_node.py"
    launch-prefix="nice -n -5 ionice -c2 -n0"
    respawn="true" >
    <param name="port" value="/dev/ttyS0" />
    <param name="baud" value="115200" />
</node>

This works if I run nice -n 10 (or any nice value above 0), but requires superuser privileges if I want to increase the priority of the process using a negative nice value. However, this leads into a slew of nastiness with the superuser (e.g. rospy not existing on the PYTHONPATH), even if I use passwordless sudo.

Am I missing some typical way nice is used to elevate process priorities in ROS?

edit retag flag offensive close merge delete

Comments

I think the 'nicest' way to do something like this is to give the user roslaunching the capability to set process priorities / niceness, but that might be involved. You could try and see whether sudo -E works.

gvdhoorn gravatar image gvdhoorn  ( 2017-05-26 10:21:40 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-05-26 10:34:51 -0600

nckswt gravatar image

In looking for answers to my question, it seems like the approach I'm going for is wrong, as setting a user process to a negative nice value can lead to some conflict with system processes. Better to limit other user-space processes' resource usage than to increase a single user process's priority into the system process space.

That said, if anyone else is trying to do this in the future, it should be possible to add a rule in /etc/security/limits.conf to allow user-space procresses to have negative nice values without sudo (but I haven't tested this.)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-05-26 09:42:48 -0600

Seen: 1,804 times

Last updated: May 26 '17