This repository aims to facilitate efficient communication between Python and C++ processes. To accelerate data transfer between different processes, the repository implements a shared memory queue for seamless communication between Cpp-Cpp, Py-Py, and Cpp-Py processes.
This project contains:
- shm_rwlock.cpp、shm_rwlock.h、shmmqueue.cpp、shmmqueue.h: these four files are the main files that implement the core function. This section is a reference to the shmqueue repo: https://github.com/DGuco/shmqueue/.
By reproducing the repo, I found that it doesn't support process data transfer between multiple processes very well. By reproducing the repository, I have identified that it doesn't effectively support inter-process data transfer in a multi-process environment. To address this limitation, I propose enhancing the functionality by introducing a GetInstance function. This function would allow binding an already created shared memory instance to a queue, enabling the maintenance of a single queue across multiple processes.
-
PyWapper:The folder's main content is identical to the first point, primarily encapsulated in C language for Python invocation.
-
cpp-cpp、py-cpp、py-py:These folders contain the read and write test code.
- cpp-cpp
$ cd cpp-cpp
$ mkdir build
$ cmake ..
$ make
- py-py
$ cd PyWapper
$ mkdir build
$ cd build
$ cmake ..
$ make
$ cp libshmmqueue.so ../
- py-cpp
$ cd PyWapper
$ mkdir build
$ cd build
$ cmake ..
$ make
$ cp libshmmqueue.so ../
$ cd py-cpp
$ mkdir build
$ cd build
$ cmake ..
$ make
- cpp-cpp
- py-py
- py-cpp
Reference:https://github.com/DGuco/shmqueue