开发者

Python Apps and Python Interpreter?

开发者 https://www.devze.com 2023-04-05 21:32 出处:网络
I\'m wondering how man开发者_JAVA百科y python interpreter would be executed for distinct python apps?

I'm wondering how man开发者_JAVA百科y python interpreter would be executed for distinct python apps? Say I have 6 different python apps up and running, so does that mean there are 6 different python interpreters are running for each of them?


when executing a python script, you have 1 interpreter running per process executing.

  • if your application executes in a single process, you have 1 interpreter executing for each instance of your application.
  • if your application launches multiple processes, then you get additional interpreters for each process launched.
  • if your application uses threads, the interpreter is shared between the multiple threads which belong to the same process.


Yes, each python script is launched by a separate python interpreter process. (unless your applications are in fact a single application multi threaded of course ;) )


Assuming CPython, yes you have 'n' different interpreters running but (at least on operating systems like Windows, UNIX, and Linux) the interpreter code itself is shared.
The data areas (which includes your Python code, depending on the implementation) will be unique to each process. Any modules written in C that produce a .dll or .so (shared object) will also share the code areas between processes, but have their own data areas.

0

精彩评论

暂无评论...
验证码 换一张
取 消