File Mover Blog

July 6, 2025

Python Thread Exec Mode setup within Limagito File Mover

Python Thread Exec Mode setup within Limagito File Mover

In version v2025.6.7.0 we added a “Global Python” setup option.

limagito file mover global python setup

The GIL (Global Interpreter Lock) in Python is a mutex (mutual exclusion lock) that protects access to Python objects, ensuring that only one thread executes Python bytecode at a time, even on multi-core processors.

We added two Thread Exec Modes:

New Interpreter

  • Each thread gets its own Python interpreter state (Py_NewInterpreter).
  • Shared global interpreter (GIL) lock, but separate Python states.
  • Useful when isolation between threads is desired.
  • Each interpreter is independent: global variables, modules, and sys state are not shared.
  • Not all Python C modules work well in sub-interpreters (some share global state unsafely).
  • Use this when:
    • You need full isolation between threads (like sandboxing).
    • You can tolerate potential issues with C extension compatibility.

New Interpreter Own GIL

  • Same as “New Interpreter”, but each thread also manages its own GIL state.
  • This mode gives each thread its own Python interpreter + GIL state.
  • Makes thread-safe management of the Python GIL easier.
  • Internally uses PyEval_SaveThread / PyEval_RestoreThread.
  • Use this when:
    • You want per-thread interpreters with clean GIL handling.
    • You want Python output or state kept separate per thread (e.g. in logs).
    • This is the recommended mode when you want each thread to run Python independently.

limagito file mover Python Thread Exec Mode

If you need any help with this ‘Python Thread Exec Mode’ option, please let us know.

Best Regards,

Limagito Team

#python #managedfiletransfer #filetransfer #filemanagement

By Limagito-Team Python Share:
SEARCH