从 Python 进程设置的 FPU 舍入模式可以被另一个 Python 进程更改吗?

Can the FPU rounding mode set from a Python process be altered by another Python process?

我经常使用 libqd 库,它需要在任何计算之前设置 FPU 舍入模式。到目前为止,我主要在 C 程序中使用它,但有时我想在 Python 脚本中使用它。

我听说 全局解释器锁 (GIL),在 https://wiki.python.org/moin/GlobalInterpreterLock or in the answer to this question same python interpreter instance running multiple scripts simultaneously?

中有描述

在这两页的第一页,我可以看到:"The GIL is controversial because it prevents multithreaded CPython programs from taking full advantage of multiprocessor systems in certain situations."

因此我想知道一个非常长的计算(例如几天)是否会被同一台机器上的另一个 Python 程序 运行 打扰:FPU 舍入模式会不会是在计算过程中被另一个进程改变了?

不,GIL 是针对每个进程的。您是每个流程的 运行 独立解释器。操作系统应确保不同进程不会相互影响。

linked question 表明操作系统可能会在这些不同的进程之间共享一些内存,但仅限于两者中相同的内存。