Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q: Threads and priority

11 views
Skip to first unread message

Cédric Pillonel

unread,
Oct 7, 2003, 2:22:28 AM10/7/03
to
If the scheduling policy is SCHED_RR priorities of thread can only be
changed by the superuser. If the policy is SCHED_OTHER ony the superuser can
raise the priority. Users without superuser priviledges can only lower the
priorities of threads.

I want to run my application as a normal user (not superuser) but I want to
raise the priority of one of my threads (real-time priority = SCHED_RR). Is
it possible?

Thank you.
Cédric Pillonel

Nils O. Selåsdal

unread,
Oct 7, 2003, 2:47:08 AM10/7/03
to
You'd have to start the program as root(e.g. setuid root) set the scheduler,
and drop privilegies with seteuid() and similar. Just note that the realtime
scheduler can bite you. One little error and your machine might appear
locked. I'd say you should rather use nice(2).

Mikko Rauhala

unread,
Oct 7, 2003, 2:57:04 AM10/7/03
to
On Tue, 7 Oct 2003 08:22:28 +0200, Cédric Pillonel
<cedric....@swisscom.com> wrote:
> I want to run my application as a normal user (not superuser) but I want to
> raise the priority of one of my threads (real-time priority = SCHED_RR). Is
> it possible?

You need to do one of two things:

1) Make the program setuid root, have it set RR scheduling and immediately
drop root priviledges. Alternatively, make a suid root wrapper that starts
the actual program with normal user priviledges and gives it SCHED_RR from
outside.

2) Arrange for the program to have the CAP_SYS_NICE capability; no root
needed at runtime. In practice you could probably do this e.g. through
the use of a suid root wrapper executable ;P (I don't think there's
official filesystem support for capabilities yet; patches maybe, dunno.)

--
Mikko Rauhala - m...@iki.fi - <URL:http://www.iki.fi/mjr/>
Transhumanist - WTA member - <URL:http://www.transhumanism.org/>
Singularitarian - SIAI supporter - <URL:http://www.singinst.org/>

0 new messages