title: Understanding preemptive multitasking with locks and the Python GIL?
body: <p>I'm reading through <a href="https://opensource.com/article/17/4/grok-gil" rel="nofollow noreferrer">Grok The GIL</a> and it has the following statement in the discussion about locking. </p>
  
  <blockquote>
    <p>So long as no thread holds a lock while it sleeps, does I/O, or some other GIL-dropping operation, you should use the coarsest, simplest locks possible. Other threads couldn't have run in parallel anyway.</p>
  </blockquote>
  
  <p>It comes just after a discussion about preemptive multitasking. What prevents the preemptive dropping of the GIL from happening while you have a lock? Or is that not what this statement is referring to?</p>