高效的Python到Python IPC [英] Efficient Python to Python IPC
问题描述
什么是具有以下要求的进程间通信(IPC) framework \ technique:>
- 在两个Python进程之间传输本机Python对象
- 时间和CPU效率高(与RAM效率无关)
- 跨平台Win \ Linux
- 必备:可与 PyPy 一起使用
更新1::这些进程位于同一主机上,并使用相同版本的Python和其他模块
更新2::这些进程由用户独立运行,没有一个产生其他进程
本地对象不会在进程之间共享(由于引用计数).
相反,您可以将它们腌制并使用unix域套接字,mmap,zeromq或专为并发访问而设计的sqlite3之类的中介来共享它们.
What would be an inter-process communication (IPC) framework\technique with the following requirements:
- Transfer native Python objects between two Python processes
- Efficient in time and CPU (RAM efficiency irrelevant)
- Cross-platform Win\Linux
- Nice to have: works with PyPy
UPDATE 1: the processes are on the same host and use the same versions of Python and other modules
UPDATE 2: the processes are run independently by the user, no one of them spawns the others
Native objects don't get shared between processes (due to reference counting).
Instead, you can pickle them and share them using unix domain sockets, mmap, zeromq, or an intermediary such a sqlite3 that is designed for concurrent accesses.
这篇关于高效的Python到Python IPC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!