Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jul 2000 10:15:53 +0200
From:      Bjorn Tornqvist <bjorn@tornqvist.net>
To:        freebsd-hackers@freebsd.org
Subject:   SCHED_RR(root only!?) vs SCHED_FIFO(any user!?)
Message-ID:  <3976B539.77FB6626@tornqvist.net>

next in thread | raw e-mail | index | archive | help

Hi all!

Can anyone please explain why I have to be root (or make the executable
run as root) to be able to use SCHED_RR in my LinuxThreads (btw, same
thing happens in pthreads) application?
pthread_create() returns an "Operation not permitted" error if not run
as root.
My application *must not* run as root (there is no need for it to) but I
also *must have* Round-Robin scheduling for overall system (application)
stability and availability.

Please help! (And, majordomo@freebsd.org doesn't respond to my subscribe
requests so please reply in private)

//Bjorn

pthread_attr_t attr;
/* Set scheduling policy to Round-Robin so that all threads will have a
chance to
   run. In extreme environments, the default first-in first-out
scheduler is used,
   and some threads might never get a chance to run. */
if ((status = pthread_attr_setschedpolicy(&attr, SCHED_RR)) != 0)
{
  cerr << "WARNING: Thread scheduling policy defaults to FIFO!!! Some
threads "
	"might never run!" << endl;
  cerr << "         Reason given: " << strerror(status) << endl;
}
if ((status = pthread_create(&myThreadID, &attr, &thread_func, this)) !=
0)
{
  cout << strerror(status)<< endl;
  throw "Thread could not be created";
}


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3976B539.77FB6626>