Subj : Re: threads do not get cpa To : comp.programming.threads,comp.sys.sgi.misc From : azb123 Date : Mon Aug 08 2005 06:14 am loic-dev@gmx.net wrote: > Salut Markus, > > > However, the original question still remains: the number of processors > > the program runs on seems unpredictable (at least to me), even after I > > have added the pthread_setconcurrency() call. When I create 3 threads, > > the program sometimes gets 3 processors, and sometimes just 1 (the SGI > > is still mostly empty). > > > > Is there anything known about the way the number of processors to be > > used is determined under IRIX 6.5.24m? > > I don't have access to a SGI machine, so I can't verify in the > practice... However, accordingly to the a manual about IRIX > programming, I read: > > > You can specify an initial thread scheduling scope by calling > pthread_attr_setscope() and passing one of the scope constants > (PTHREAD_SCOPE_SYSTEM or PTHREAD_SCOPE_PROCESS) in the pthread_attr_t > object. By default, process scope is selected and scheduling is > performed by the thread runtime, but thread scheduling by the kernel is > provided with the system scope attribute. System scope threads run at > real-time policy and priority and may be created only by privileged > users. > > > You may need to select system contention scope (PTHREAD_SCOPE_SYSTEM) > to obtain the wanted bahavior. Hi Loic, yes, PTHREAD_SCOPE_SYSTEM sounds like it would be the solution. However, threads with scheduling scope PTHREAD_SCOPE_SYSTEM require under IRIX to be run as root or with scheduling management capabilities, since with this scope you can have (under IRIX) threads with a priority higher than system daemons. Therefore, this scheduling scope is not available to me. There is another, non-portable, scheduling scope available under IRIX (PTHREAD_SCOPE_BOUND_NP), but that shows the same behavior, i.e. the cpu-usage seems to be erratic and unpredictable (at least for me). Markus .