Python multiprocessing : processes do not start

Viewed 8174

I'm new into multiprocessing in Python (2.7).

I try to run the following piece of code:

from time import sleep
from multiprocessing import Process
import multiprocessing

def func(x):
    print("start %s"%(x))
    sleep(x)
    print("end %s"%(x))
    return

if __name__ == '__main__':

    Process(target=func(10)).start()
    Process(target=func(1)).start()

This return something as :

start 10
end 10
start 1
end 1

While start 1 and end 1 should a priori appear before end 10.

I would appreciate help to understand what I might be missing here.

3 Answers
Related