Does the OS have visibility into the call stack (e.g. calls made between functions) in CPython? E.g. In what way is the OS involved in the creation, retrieval and/or management of the Python stack and operations of its stack frames?
Context:
- My understanding is that the Python interpreter does not support tail call recursion, so this seems to be something left to Python to handle.
- Most OS impose a maximum limit on the size of a stack (e.g. I believe in Linux OS the maximum stack size is 8192 KB by default but it can be changed via e.g.
ulimit
), meaning the kernel clearly can get involved in at least limiting the size of the call stack.