|
For my application (a BGP daemon) I think I should be setting all its
pthreads to PTHREAD_SCOPE_SYSTEM. (This may be where I am going wrong, of course, but bear with me.) I have studied the POSIX specifications and the FreeBSD man pages, and am stuck. pthread_init_attr() is supposed to give me the default settings for everything, including the scope and PTHREAD_INHERIT_SCHED/_EXPLICIT_SCHED. First difficulty: if it is PTHREAD_INHERIT_SCHED, what are the scope, schedpolicy and schedparam set to ? Second difficulty: if I set PTHREAD_EXPLICIT_SCHED, will that change the scope/policy/param to the defaults, or leave them unchanged (in which case are they the appropriate defaults) ? Or, am I really expected to set all of scope/policy/param if I override a default PTHREAD_INHERIT_SCHED ? (If the default is PTHREAD_SCOPE_SYSTEM, am I all set having cleared PTHREAD_INHERIT_SCHED ?) Third difficulty: if I set PTHREAD_SCOPE_SYSTEM and the default is PTHREAD_SCOPE_PROCESS, do I also need to set policy/param ? If so, where do I find suitable default policy/param ? (I could copy the policy/param from the main thread... but will that be suitable for PTHREAD_SCOPE_SYSTEM ?) Fourth difficulty: if I dick about with scope/policy/param, will I need special privileges (root, say) ? Fifth difficulty: it is clearly easiest to leave this whole thing alone and ignore pthread_attr_t altogether. Is there a way to set PTHREAD_SCOPE_SYSTEM as the default for a given application from the outside ? POSIX appears to define a bunch of stuff in this area... but so much is implementation defined, or simply not defined I imagine (a) 99.9% of threaded applications do not attempt to use pthread_attr_t at all, and (b) that somewhere each implementation will define what it does ? Help !! Thanks, Chris _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-threads To unsubscribe, send any mail to "[hidden email]" |
|
On 4/28/12 5:44 AM, 'Chris Hall' wrote:
> For my application (a BGP daemon) I think I should be setting all its > pthreads to PTHREAD_SCOPE_SYSTEM. (This may be where I am going > wrong, of course, but bear with me.) > [...] > Third difficulty: if I set PTHREAD_SCOPE_SYSTEM and the default is > PTHREAD_SCOPE_PROCESS, do I also need to set policy/param ? If so, > where do I find suitable default policy/param ? > (I could copy the policy/param from the main thread... but will that > be suitable for PTHREAD_SCOPE_SYSTEM ?) AS far as I know the default is PTHREAD_SCOPE_SYSTEM now. we no longer support PTHREAD_SCOPE_PROCESS as far as I know. (I may be confused of course.. it wouldn't be the first time). We used to have the ability to switch but the complexity was not worth the added benefit. > Fourth difficulty: if I dick about with scope/policy/param, will I > need special privileges (root, say) ? > > Fifth difficulty: it is clearly easiest to leave this whole thing > alone and ignore pthread_attr_t altogether. Is there a way to set > PTHREAD_SCOPE_SYSTEM as the default for a given application from the > outside ? > > > _______________________________________________ > [hidden email] mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to "[hidden email]" > _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-threads To unsubscribe, send any mail to "[hidden email]" |
|
Julian Elischer wrote (on Sun 29-Apr-2012 at 07:49 +0100):
... > AS far as I know the default is PTHREAD_SCOPE_SYSTEM now. > we no longer support PTHREAD_SCOPE_PROCESS as far as I know. > (I may be confused of course.. it wouldn't be the first time). Ah. Well, that certainly finesses all the issues. > We used to have the ability to switch but the complexity was not > worth the added benefit. Not surprised. Particularly as it all seems so badly defined :-( For my application I would be happy to have a mechanism to give some higher priority to the I/O driven threads, and to lower the priority of the garbage collector and scanning threads. The higher priority stuff ought to be system scope, the lower could be process scope. The POSIX defined stuff almost but not quite provides that, but is so full of implementation-defined and not defined at all, that it seems quite useless to me. Thanks, Chris _______________________________________________ [hidden email] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-threads To unsubscribe, send any mail to "[hidden email]" |
| Powered by Nabble | Edit this page |
