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, [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to