Precise Event Synchronization with Python
<p>I have a multinode network of VMs spread across several machines, one management VM and 7-15 worker VMs.  I would like to run an NTP server on the management VM and have all the worker VMs synchronize with the mangament VM.</p>

<p>From there I plan on having a python process on each worker VM spawn a new thread at at arbitary times from one start date.  Each process will know ahead of time (ie when the process starts) when it needs to spawn a new thread.</p>

<p>An approach I can think of is to synchronize the machines with NTP, subtract the known waiting time from the current time and then call usleep on the difference.</p>

<p>Pseudo-Code</p>

<pre><code>for ii in eventTimes:
   curTime = getCurrentTime()
   waitTime = ii - curTime
   usleep(waitTime)
   spawnEventThread()
</code></pre>

<p>There's no shared data between the threads.  The minimum time inbetween each thread being spawned is 1 second and they should be simple enough to finish whatever they're doing in that second.</p>

<p>Any help is appreciated</p>
