From owner-freebsd-hackers Thu Jul 20 1:16: 4 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from idet.rsn.hk-r.se (idet.rsn.hk-r.se [194.47.142.179]) by hub.freebsd.org (Postfix) with ESMTP id A78C537BC0F for ; Thu, 20 Jul 2000 01:16:00 -0700 (PDT) (envelope-from bjorn@tornqvist.net) Received: from tornqvist.net ([194.52.130.37]) by idet.rsn.hk-r.se (8.9.3/8.9.3) with ESMTP id KAA83874 for ; Thu, 20 Jul 2000 10:12:44 +0200 (CEST) (envelope-from bjorn@tornqvist.net) Message-ID: <3976B539.77FB6626@tornqvist.net> Date: Thu, 20 Jul 2000 10:15:53 +0200 From: Bjorn Tornqvist Organization: West Entertainment Solutions & Technologies AB X-Mailer: Mozilla 4.72 [en] (X11; I; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Subject: SCHED_RR(root only!?) vs SCHED_FIFO(any user!?) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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