title: how to start multiple jobs in python and communicate with the main job
body: <p>I am a novice user of python multithreading/multiprocessing, so please bear with me.
  I would like to solve the following problem and I need some help/suggestions in this regard.
  Let me describe in brief:</p>
  
  <ol>
  <li><p>I would like to start a python script which does something in the
  beginning sequentially.</p></li>
  <li><p>After the sequential part is over, I would like to start some jobs
  in parallel.</p>
  
  <ul>
  <li>Assume that there are four parallel jobs I want to start. </li>
  <li>I would like to also start these jobs on some other machines using  "lsf" on the computing cluster.My initial script is also running on a ” lsf”
  machine.</li>
  <li>The four jobs which I started on four machines will perform two logical steps A and B---one after the other.</li>
  <li>When a job started initially, they start with logical step A and finish it.</li>
  <li>After every job (4jobs) has finished the Step A; they should notify the first job which started these. In other words, the main job which started is waiting for the confirmation from these four jobs.</li>
  <li>Once the main job receives confirmation from these four jobs; it should notify all the four jobs to do the logical step B.</li>
  <li>Logical step B will automatically terminate the jobs after finishing the task.</li>
  <li>Main job is waiting for the all jobs to finish and later on it should continue with the sequential part.</li>
  </ul></li>
  <li><p>An example scenario would be:</p>
  
  <ul>
  <li>Python script running on an “lsf” machine in the cluster starts four "tcl shells" on four “lsf” machines. </li>
  <li>In each tcl shell, a script is sourced to do the logical step A.</li>
  <li>Once the step A is done, somehow they should inform the python script which is waiting for the acknowledgement.</li>
  <li>Once the acknowledgement is received from all the four, python script inform them to do the logical step B.</li>
  <li>Logical step B is also a script which is sourced in their tcl shell; this script will also close the tcl shell at the end.</li>
  <li>Meanwhile, python script is waiting for all the four jobs to finish.</li>
  <li>After all four jobs are finished; it should continue with the sequential part again and finish later on.</li>
  </ul></li>
  </ol>
  
  <p>Here are my questions:</p>
  
  <ol>
  <li><p>I am confused about---should I use multithreading/multiprocessing. Which one suits better?
  In fact what is the difference between these two? I read about these but I wasn't able to conclude.</p></li>
  <li><p>What is python GIL? I also read somewhere at any one point in time only one thread will execute.
  I need some explanation here. It gives me an impression that I can't use threads.</p></li>
  <li><p>Any suggestions on how could I solve my problem systematically and in a more pythonic way. 
  I am looking for some verbal step by step explanation and some pointers to read on each step.
  Once the concepts are clear, I would like to code it myself.</p></li>
  </ol>
  
  <p>Thanks in advance.</p>