Re: thread programming

jps@TFS.COM
Fri, 7 Apr 1995 12:04:23 -0700

Luckily, I do plenty of multithreaded programming on other platforms,
so I'm familiar with the issues and pitfalls. And yep, you sure do
have to be fully awake to write a correct program.

What interests me is the python IMPLEMENTATION of threads. For example,
Guido mentioned in passing that the "import" statement isn't
thread-safe in python. That was news to me, and it got me wondering
about the thread-safety of other features of the python language.

And, yes, I'm disappointed that python doesn't have better support for true
threads. I imagine it traces back to Guido's well-founded concern for
platform independence. But I'm at the point in life where I'll write
off operating systems that don't support threads.

-jeff stearns

> >Is this an isolated phenomena, or are there other pitfalls to multhithreaded
> >python programs? I've only used the python thread module a modest amount,
> >but I've been surprised by how much has worked.
> >
> >thanks again, -jeff stearns
>
>
> Thread programming (not necessarily of the Python flavor)
> has some interesting properties. Truly pre-emptive systems
> are scary in that a program may work 99.9999% of the
> time and fail .0001% of the time. This is because the
> order that program instructions are executed may vary with
> each invocation (depending on the thread scheduling algorithm).
> Unless properly synchronized, very short (in time) windows may
> exist where the program is in an invalid state.
>
> Just don't expect robustness unless you are really sure of
> what you are doing.
>
> Lack of true thread support is my ONLY disappointment with Python.
>
> -Richard Walker