64b Subj : Re: pthread library architecture (threading model) To : comp.programming.threads From : David Butenhof Date : Mon Sep 19 2005 01:48 pm pankaj-startup wrote: >> The pthread API doesn't imply any particular threading model. Implementations >> on other platforms provide 1:1, m:n, and m:1 models. >> -- > > are there any pthread apis to choose one of these models? POSIX thread implementations may support "1:1", called "System Contention Scope", or "M:N", called "Process Contention Scope". "M:1", or multiplexing on top of a single "kernel scheduling entity" cannot generally be done without special kernel support that would really make it more of a "M:N" -- a pure "M:1" implementation would allow indefinitely blocking one thread behind another due to problems in preempting UNIX synchronous syscalls, and would violate POSIX requirements. Relatively few implementations support both System and Process contention scopes, and there's no API to determine which are supported. You can however ask for one or the other explicitly using the pthread_attr_setscope() operation on an attributes object that you use to create threads. Check your documentation. (Note that since contention scope is a scheduling attribute, it may be inherited from the creating thread by default; always use pthread_attr_setinheritsched() to PTHREAD_EXPLICIT_SCHED.) -- Dave Butenhof, David.Butenhof@hp.com HP Utility Pricing software, POSIX thread consultant Manageability Solutions Lab (MSL), Hewlett-Packard Company 110 Spit Brook Road, ZK2/3-Q18, Nashua, NH 03062 . 0