title: Multiple processes write a same CSV file, how to avoid conflict?
body: <p>9 processes write a same CSV output simultaneously in our system. And the output speed is fast. About 10 million new rows per day.
  To write CSV file we use the csv module of Python2.7.</p>
  
  <p>Recently i noticed there are some mixed rows(See following example) in the CSV file.</p>
  
  <p>e.g.</p>
  
  <pre><code>"name", "sex", "country", "email"
  ...# skip some lines
  "qi", "Male", "China", "redice
  ...# skip some lines
  "Jamp", "Male", "China", "jamp@site-digger.com"
  ...# skip some lines
  @163.com"
  </code></pre>
  
  <p>The correct output should be:</p>
  
  <pre><code>"name", "sex", "country", "email"
  ...# skip some lines
  "qi", "Male", "China", "redice@163.com"
  ...# skip some lines
  "Jamp", "Male", "China", "jamp@site-digger.com"
  ...
  </code></pre>
  
  <p>How to avoid such kind of conflict?</p>