<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Single threaded, event loop based code like twisted rocks hard.<br>
<br>
Once upon a time, threads were like that too and the distinction
between threads and event loops was grey.  But with the advent of
mandatory preemptive thread scheduling and the ability to run multiple
threads on separate shared memory processors, the difference between
programming with threads and programming with parallel heavy weight
processes that share memory became extremely grey, (aside from the
problems debugging threads which don't exist for heavy weight
processes).<br>
<br>
Threads routinely use shared memory and shared memory (generally)
requires a common kernel.  OTOH, message passing can use a common
kernel but can also extend out to other machines on the network.  If
you use twisted for highly efficient "single thread/multiple task"
heavy weight processes, and something like spread, you end up with the
best of all worlds.  Highly efficient, symmetric, network based
parallelism, with fault tolerance thrown in for free.<br>
<br>
My point here is that there are other ways to go about exploiting
symmetric multiprocessor machines, even banks of them, that neither
require threads, nor the multiprocessing package.<br>
<br>
--rich<br>
<br>
Darren Govoni wrote:
<blockquote cite="mid:1267042271.2532.200.camel@kratos" type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="GENERATOR" content="GtkHTML/3.28.1">
Looks interesting. I'm going to check out that package.<br>
  <br>
  <br>
My original request was more along the lines of using Python's new
support for native CPU core's and processes (the multiprocessing
package is for this). Python's built-in thread support has global lock
constraints that underperform in some situations.<br>
  <br>
But I ran into a problem using multiprocessing module with Twisted that
was pointed out on the Twisted trac with pickling class methods and
apparently Python's CPU threading support attempts to do this in some
situations (e.g. when I try to pass a class method to a native thread).<br>
  <br>
On Wed, 2010-02-24 at 12:04 -0800, K. Richard Pixley wrote:<br>
  <blockquote type="CITE"> Glyph Lefkowitz wrote:
    <blockquote type="CITE">
      <pre>On Feb 21, 2010, at 8:00 PM, Alexandre Quessy wrote
      </pre>
      <blockquote type="CITE">
        <pre>Hello everyone,
I have done something similar to this, but I used the children IO
stream to control them. Maybe I should have done that using some
higher level protocol, such as AMP or PB.
    
        </pre>
      </blockquote>
      <pre>Using a higher-level protocol is generally better, if for no other reason that it gives you a framework within which to document your design decisions.  It's much easier to say "An AMP command with a 'foo' String argument and a 'bar' Integer argument" than to say "The first two bytes of the message are the length of the first argument.  The next n bytes are the first argument.  The first argument shall be interpreted as... (etc, etc)"
      </pre>
    </blockquote>
I'm working on an interface right now to the spread toolkit, (<a
 moz-do-not-send="true" href="http://spread.org">http://spread.org</a>),
which implements virtual synchrony, (<a moz-do-not-send="true"
 href="http://en.wikipedia.org/wiki/Virtual_synchrony">http://en.wikipedia.org/wiki/Virtual_synchrony</a>).<br>
    <br>
For distributed, symmetric, fault tolerant parallelism in small to
medium scale with high reliability, this might be an option.<br>
    <br>
--rich
    <pre>_______________________________________________
Twisted-Python mailing list
<a moz-do-not-send="true" href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a>
<a moz-do-not-send="true"
 href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a>
    </pre>
  </blockquote>
  <br>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Twisted-Python mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a>
<a class="moz-txt-link-freetext" href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a>
  </pre>
</blockquote>
</body>
</html>