Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've got a game on my system that suffers some minor performance problems. I can make these go away by using renice to take it to priority -1. I am root, so doing this isn't a problem for me (just annoying), but I do have another two users who would love to play the game properly, but can't unless I do a quick su and renice their game.
So, I'm looking for a way that I can get them to run something without root having to interfere. My instincts are to create a wrapper script that they can run, but I don't know how to get it to do the job.
I've played with sudo, but don't want to grant them permission to run renice at any time, and I had a look at chmod +s, but I think that would make them run the game as root (definitely don't want that!).
You should not have to alter the priority. Particularly by any large amounts. Something else will be penalized, and you ought to try to find out what it is.
If you punch a process into better-than-normal priority, sometimes it depends upon some other process that runs at normal-priority and things start to clog up.
>What game is it, and how does reniceing by 1 level fix it
Game is Neverwinter Nights. There's a slight jerkiness when starting to rotate the "camera", when opening/closing some of the panels and when there's a lot of activity on screen. The jerkiness goes away with a small renice for the first two issues, and the number of moving objects on screen can double before there's any loss of performance.
Checking top when the game is running is a dead giveaway - it's constantly vying with all the other nice 0 processes. Renicing stops this, without seeming to affect any other process.
>You should not have to alter the priority.
Nope, but it works!
>Particularly by any large amounts.
Hence only one point. I've locked up machines before by misusing renice, so I keep it to a minimum. The game starts at 0 and we renice it to -1.
>Something else will be penalized, and you ought to try to find out what it is.
Well, yes, everything with priority 0 to 20. But this machine is a desktop, for single user use, and when playing, we're not interested in any other process that is running, so it doesn't really matter.
>If you punch a process into better-than-normal priority, sometimes it depends upon some other process that runs at normal-priority and things start to clog up.
Good point - nwn does use the sound and GUI processes, which continue at normal priority, but renicing doesn't affect the game. I will have a look at the process tree when running it later, to see what it is spawning
Why not allow them to sudo and ONLY perform 'renice -n -1 `pidof PROCESS`'. You might not be able to put that directly into the sudoers file, and may need to place it in a script... but then allow them to sudo that script. Or better, create a script that launches the game through nice. 'nice -n -1 su $USER -c GAME'.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.