Giving an SDL app high priority (Linux)

Hi

How can I enable my SDL applications to always grab the highest priority when
it starts up?

I am noticing jerky blits (xflame demo by Sam L) if my system load avg goes
above about 3.1 - this of course is the task switching to keep the other apps
running (two raytracing processes - PovRay).

My problem is that I would like a game I may write for example on SDL to
automatically get high priority on a user’s system, without him having to
renice it manually or such. I would also like to avoid requiring that the
user have root priviliges in order to renice the game process.

Is there a way to do this?

Thanks!–
Stefan Viljoen
F/EMS Dispatcher
Potchefstroom Public Safety Dept.
Republic of South Africa
http://home.intekom.com/rylan/

“We want you to be soldiers - deadly as long as you have one leg or one arm
and you are still alive.”

  • R. A. H. in Starship Troopers

My problem is that I would like a game I may write for example on SDL to
automatically get high priority on a user’s system, without him having to
renice it manually or such. I would also like to avoid requiring that the
user have root priviliges in order to renice the game process.

Under Linux, there’s beginning to be support for process capabilities
– that is, individual rootish privileges that can be granted to a
process. However, filesystem support for them does not exist yet
AFAIK, one would still have to be root on install to grant the
privilege (in this case CAP_SYS_NICE, I think) in the first place, and
it’s not portable.

Pretty much the way to change the priority of a process on Unix-like
systems, AFAIK, is setpriority() or nice(), and to raise the priority
of a process above normal requires either full root, or, on systems
with more fine-grained capabilities, something like the Linux
CAP_SYS_NICE.

In short, I think you may be out of luck. My approach would be to
make it the user’s responsibility to reduce the priority of the
batch resource hogs appropriately, but I assume that’s not really what
you’re trying to do.

Sorry.

—> Drake Wilson