From owner-freebsd-threads@FreeBSD.ORG Thu Jan 15 22:21:42 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 118AA1065672 for ; Thu, 15 Jan 2009 22:21:42 +0000 (UTC) (envelope-from pramod@juniper.net) Received: from exprod7og110.obsmtp.com (exprod7og110.obsmtp.com [64.18.2.173]) by mx1.freebsd.org (Postfix) with ESMTP id C3C1D8FC12 for ; Thu, 15 Jan 2009 22:21:41 +0000 (UTC) (envelope-from pramod@juniper.net) Received: from source ([66.129.224.36]) (using TLSv1) by exprod7ob110.postini.com ([64.18.6.12]) with SMTP ID DSNKSW+29UnScoy4vtktNWxaPKAR2uXP5pUs@postini.com; Thu, 15 Jan 2009 14:21:41 PST Received: from p-emfe01-sac.jnpr.net (66.129.254.72) by P-EMHUB01-HQ.jnpr.net (172.24.192.35) with Microsoft SMTP Server id 8.1.336.0; Thu, 15 Jan 2009 14:19:02 -0800 Received: from emailcorp3.jnpr.net ([66.129.254.13]) by p-emfe01-sac.jnpr.net with Microsoft SMTPSVC(6.0.3790.3959); Thu, 15 Jan 2009 14:19:02 -0800 Received: from 172.23.1.52 ([172.23.1.52]) by emailcorp3.jnpr.net ([66.129.254.13]) with Microsoft Exchange Server HTTP-DAV ; Thu, 15 Jan 2009 22:19:02 +0000 User-Agent: Microsoft-Entourage/12.0.0.071130 Date: Thu, 15 Jan 2009 14:19:09 -0800 From: Pramod Srinivasan To: Daniel Eischen Message-ID: Thread-Topic: Priority scheduling in 6.x Thread-Index: Acl3X0ks/0ytv3fge0a4i9mYY2iZoA== In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 15 Jan 2009 22:19:02.0493 (UTC) FILETIME=[454B48D0:01C9775F] Cc: freebsd-threads@freebsd.org Subject: Re: Priority scheduling in 6.x X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jan 2009 22:21:42 -0000 Hi Daniel Thanks for your response. On 1/14/09 7:25 PM, "Daniel Eischen" wrote: > On Wed, 14 Jan 2009, Pramod Srinivasan wrote: > >> Hi, >> >> I have 3 threads low, medium and high , and the scheduling policy is set to >> SCHED_FIFO. The priority of the threads are at 28,29,30 respectively. Looks >> like on FreeBSD 6.x, the priority of the threads are not honored while >> scheduling the threads, but the same test on FreeBSD 7.x seems to work fine. >> Are there known issues with the priority scheduling in FreeBSD 6.x or am I >> doing something wrong? (I am using libthr) > > Are you using libpthread or libthr on 6.3? I am using libthr on 6.1, but had similar issues on 6.2 as well. > > If you are using libthr, then you need to be running with > superuser privileges for SCHED_FIFO to work. I'm not sure > if this works correctly at all in 6.3. I am running the program with super user privileges on 6.1, tried this on 6.2 as well. Priority scheduling using libthr does not work, unless I am missing something very basic?. The same program works fine on 7.1, any ideas? > > If you are using libpthread, then it will work if the > threads are PTHREAD_SCOPE_PROCESS, but will not work > if they are PTHREAD_SCOPE_SYSTEM. You do not need > superuser privileges for SCHED_FIFO with libpthread > and process scope threads. I don't believe the kernel > has ever worked properly for libpthread (kse) SCHED_FIFO > system scope threads. I tried libpthread with PTHREAD_SCOPE_PROCESS, it was better, I see that the priority is honored. Thanks for the pointer. Thanks, Pramod