title: How to create global lock/semaphore with multiprocessing.pool in Python?
body: <p>I want limit resource access in children processes. For example - limit <strong>http downloads</strong>, <strong>disk io</strong>, etc.. How can I achieve it expanding this basic code?</p>
  
  <p>Please share some basic code examples.</p>
  
  <pre><code>pool = multiprocessing.Pool(multiprocessing.cpu_count())
  while job_queue.is_jobs_for_processing():
    for job in job_queue.pull_jobs_for_processing:
      pool.apply_async(do_job, callback = callback)
  pool.close()
  pool.join()
  </code></pre>