# Does the os.sched\_yield() release the GIL?

**URL:** <https://discuss.python.org/t/does-the-os-sched-yield-release-the-gil/18301>\
**Category:** Python Help\
**Created:** [August 18, 2022, 2:55pm UTC](https://discuss.python.org/t/does-the-os-sched-yield-release-the-gil/18301 "2022-08-18T14:55:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeZee](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@DeZee](https://discuss.python.org/u/DeZee)\
**Post date:** [August 18, 2022, 2:55pm UTC](https://discuss.python.org/t/does-the-os-sched-yield-release-the-gil/18301/1 "2022-08-18T14:55:25Z")

</div>

Hi,  
I’ve asked a question on SO, but no answer leads to digging further.  
I couldn’t find the instruction that releases the GIL in the os.sched\_yield() implementation.

Please check the link below for more info:

> <https://stackoverflow.com/questions/73324975/does-the-pythonic-os-sched-yield-release-the-gil>

Final question: does the os.sched\_yield() release the GIL?

---

<div class="post-metadata">

**Author:** ![ronaldoussoren](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ronaldoussoren/32/61_2.png) [@ronaldoussoren](https://discuss.python.org/u/ronaldoussoren)\
**Post date:** [August 18, 2022, 4:05pm UTC](https://discuss.python.org/t/does-the-os-sched-yield-release-the-gil/18301/2 "2022-08-18T16:05:03Z")

</div>

Looking at the source in posixmodule.c I’d say: No, `os.sched_yield` does not release the GIL.

I don’t know why it doesn’t release the GIL. Could you create an issue for this on GitHub, and if you’re up for it a pull request as well?

---

<div class="post-metadata">

**Author:** ![DeZee](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@DeZee](https://discuss.python.org/u/DeZee)\
**Post date:** [August 18, 2022, 4:25pm UTC](https://discuss.python.org/t/does-the-os-sched-yield-release-the-gil/18301/3 "2022-08-18T16:25:03Z")

</div>

Thank you for checking this. I’ll create an issue but I’m not experienced enough to make a PR.

EDIT: [Related issue](https://github.com/python/cpython/issues/96078)
