title: Parallelize recursive code using multiprocessing in python
body: <p>how can I parallelize following code using python multiprocessing</p>
  
  <pre><code>def func(a,i):
     if (a&gt;i):
        func(a-1,i)
        func(a-5,i)
     else :
        print a
  </code></pre>
  
  <p>EDIT : Is it true that once parent process exits, all child subprocesses also exit?</p>
  
  <p>EDIT 2 :</p>
  
  <p>I have implemented following code but it is not working. can you please find the error.</p>
  
  <pre><code>p=[]
  def func(a,i):
   if a&gt;i :
     proc=Process(target=func,args=(a-1,i,))
     p.append(proc)
     proc=Process(target=func,args=(a-5,i,))
     p.append(proc)
  
   else :
     print a
  
  if _name_=='_main_':
     proc=Process(target=func,args=(100,25,))
     p.append(proc)
     for x in p:
       x.start()
       x.join()
  </code></pre>
  
  <p>Above code is executing only for (100,25) and not for subprocesses even though the subprocesses are getting added in list.</p>