LD_PRELOAD a library that interposes on thread_create or pthread_create, Have this lib use priocntl to change thread priorities. If you are not running as root, you must use RBAC to give yourself permission to modify priority (proc_priocntl). in /etc/user_attr username::::defaultpriv=basic,proc_priocntl
See attached for sample code. rick On Fri, Nov 12, 2010 at 10:17:12PM -0800, Kishore Kumar Pusukuri wrote: > X-CAA-SPAM: N00000 > X-Authority-Analysis: v=1.1 cv=Vo4WaqpQzdXh3TDz0aTf8sQKpTOcUPPMiuxtL/uhrDA= > c=1 sm=1 a=F_NJan216uAA:10 a=RKG6q5SKwUUA:10 a=kj9zAlcOel0A:10 > a=zRG8QCroJ/deLx9kZ5Uhsg==:17 a=ep_KMAzDAAAA:8 a=QTY7wmpXApE6zZSs1GgA:9 > a=Mnur60GtzMOK2vtekxCLLs3upvMA:4 a=CjuIK1q_8ugA:10 a=RD1bzJOsQUcA:10 > a=TC1Ce7_l9HwA:10 a=zRG8QCroJ/deLx9kZ5Uhsg==:117 > X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on > lv-drc6.opensolaris.org > X-Spam-Level: > X-Spam-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,RDNS_NONE > autolearn=no version=3.3.1 > X-Original-To: observability-discuss@opensolaris.org > Delivered-To: observability-discuss@opensolaris.org > Date: Fri, 12 Nov 2010 22:17:12 PST > From: Kishore Kumar Pusukuri <kish...@cs.ucr.edu> > To: observability-discuss@opensolaris.org > Subject: [observability-discuss] Change scheduling class of a thread (lwp) > of a process. > X-BeenThere: observability-discuss@opensolaris.org > X-Mailman-Version: 2.1.13 > Precedence: list > List-Id: Discussion of tools and facilities to observe software and hardware > behavior on OpenSolaris <observability-discuss.opensolaris.org> > List-Unsubscribe: > <http://mail.opensolaris.org/mailman/options/observability-discuss>, > <mailto:observability-discuss-requ...@opensolaris.org?subject=unsubscrib > e> > List-Archive: <http://mail.opensolaris.org/pipermail/observability-discuss> > List-Post: <mailto:observability-discuss@opensolaris.org> > List-Help: > <mailto:observability-discuss-requ...@opensolaris.org?subject=help> > List-Subscribe: > <http://mail.opensolaris.org/mailman/listinfo/observability-discuss>, > <mailto:observability-discuss-requ...@opensolaris.org?subject=subscribe> > Errors-To: observability-discuss-boun...@opensolaris.org > > Hi, > We can change the scheduling class of a process (either single threaded or > multithreaded) using priocntl(1) utility. However, I would like to use > different scheduling classes for different threads (lwps) of a process on > OpenSolaris.2009.06. But there is no such an option with priocntl(1) (as far > as I have seen). It seems that the utility priocntl(1) changes the scheduling > class for the whole process (same class for all the threads of that process). > > Could anyone provide me if there is a way to do this, please? > > Thank you. > -- > This message posted from opensolaris.org > _______________________________________________ > observability-discuss mailing list > observability-discuss@opensolaris.org -- Rickey C. Weisner Software Development and Performance Specialist Principal Software Engineer Systems Quality Office Oracle Corporation cell phone: 615-308-1147 email: rick.weis...@oracle.com
#include <stdio.h> #include <pthread.h> #include <sys/types.h> #include <sys/priocntl.h> #include <sys/rtpriocntl.h> #include <sys/tspriocntl.h> #include <sys/iapriocntl.h> #include <sys/fsspriocntl.h> #include <sys/fxpriocntl.h> #include <dlfcn.h> int pthread_create(pthread_t *restrict thread, const pthread_attr_t *restrict attr, void *(*start_routine)(void*), void *restrict arg) { static int (* fptr)()= 0; pcparms_t my_parms; int rc; if (fptr == 0) { fptr = (int (*)())dlsym(RTLD_NEXT, "pthread_create"); if (fptr == NULL) { printf("dlopen: %s\n",dlerror()); return (int) -1; } printf("setting FX priority for thread 1 \n"); priocntl(P_LWPID, 1, PC_SETXPARMS, "FX", FX_KY_UPRILIM, 60, FX_KY_UPRI, 60, FX_KY_TQSECS, 300, NULL); } rc =(int )fptr( thread, attr, start_routine, arg); priocntl(P_LWPID, *thread, PC_SETXPARMS, "TS", NULL); return(rc) ; }
_______________________________________________ observability-discuss mailing list observability-discuss@opensolaris.org