title: Coordinating parallel execution in node.js
body: <p>The event-driven programming model of node.js makes it somewhat tricky to coordinate the program flow.</p>
  
  <p>Simple sequential execution gets turned into nested callbacks, which is easy enough (though a bit convoluted to write down). </p>
  
  <p>But how about parallel execution? Say you have three tasks A,B,C that can run in parallel and when they are done, you want to send their results to task D.</p>
  
  <p>With a fork/join model this would be</p>
  
  <ul>
  <li>fork A</li>
  <li>fork B</li>
  <li>fork C</li>
  <li>join A,B,C, run D</li>
  </ul>
  
  <p>How do I write that in node.js ? Are there any best practices or cookbooks? Do I have to <a href="https://stackoverflow.com/questions/4496403/extjs-two-parallel-ajax-call">hand-roll a solution</a> every time, or is there some library with helpers for this?</p>