Problem with threading on Solaris

Lionel Ulmer bbrox at bbrox.org
Fri Sep 7 14:37:39 EDT 2001


On Fri, 7 Sep 2001 13:41:05 -0400, Tim Peters <tim.one at home.com> wrote:
>Solaris people have reported that often; the usual workaround seems to be to
>sprinkle their code with time.sleep(0.1) (or other small values).

Yup, but it's really a pain to do that... Slows things down :-)

>Cool!  If you're sure this will work under all Solaris releases, please
>submit a Solaris patch to SourceForge (you can't assume this won't harm
>other platforms -- or even compile on other platforms -- and it needs to be
>#ifdef'ed by the version of pthreads in use too, since PTHREAD_SCOPE_SYSTEM
>didn't always exist).

I will see what I can do on monday (the only solaris box I have access is at
work).

But what option is best : add a Solaris-specific option in thread_pthread.h
or use thread_solaris.h on Solaris even when pthread is present ? I somewhat
prefer the Solaris thread option, it will have less chance to break POSIX
thread compilation on other Unices.

>Python isn't an operating system:  it doesn't schedule threads.  That's
>entirely up to whatever thread package you use.

Yes, I know... But one could have imagined that (by using some black magic
:-) ), Python thread would have been time-sliced on all OSes (and thus
preventing people to need to add 'sleep' commands in their code even when
not needed).

>For whatever reason on Solaris (I guess you'd have to ask Sun),
>their default pthreads behavior is extremely reluctant to switch threads.
>OTOH, Windows is very eager to switch threads.  And so on -- YMMV.

Yes, I find this behaviour somewhat strange... What is even stranger, is
that Solaris threads do NOT exhibit this behaviour (so I wonder why they
choose 'PTHREAD_SCOPE_PROCESS' as the default behaviour for the pthreads).

             Lionel

-- 
		 Lionel Ulmer - http://www.bbrox.org/



More information about the Python-list mailing list