Python multiprocessing start method doesn't run the process
<p>I'm new to multiprocessing and I'm trying to check that I can run two process simultaneously with the following code :</p>

<pre><code>import random, time, multiprocessing as mp

def printer():
    """print function"""
    z = random.randit(0,60)
    for i in range(5):
        print z
        wait = 0.2
        wait += random.randint(1,60)/100
        time.sleep(wait)
    return

if __name__ == '__main__':
    p1 = mp.Process(target=printer)
    p2 = mp.Process(target=printer)
    p1.start()
    p2.start()
</code></pre>

<p>This code does not print anything on the console although I checked that the process are running thanks to the is.alive() method.</p>

<p>However, I can print something using :</p>

<pre><code>p1.run()
p2.run()
</code></pre>

<p><strong>Question 1 :</strong> Why doesn't the start() method run the process ?</p>

<p><strong>Question 2 :</strong> While running the code with run() method, why do I get a sequence like</p>

<p>25,25,25,25,25,11,11,11,11,11</p>

<p>instead of something like</p>

<p>25,25,11,25,11,11,11,25,11,25 ?</p>

<p>It seems that the process run one after the other.</p>

<p>I would like to use multiprocessing for using the same function on multiple files to parallelize file conversion.</p>

<p>I made the script run by adding </p>

<pre><code>from multiprocessing import Process
</code></pre>

<p>However, I don't have a random sequence of two numbers, the pattern is always A,B,A,B.. If you know how to show that the two process run simultaneously, any ideas are welcome !</p>

python multithreading python-2.7 multiprocessing