ctypes

Implementing a reader-writer lock for multiple processes in python

Python lacks a lock type that supports multiple readers and a single writer across multiple processes. Here we investigate how one can be implemented using only default python features: ctypes and mmap, and the POSIX reader-writer locks. TL;DR: If you just want to use it, refer to the module's repository. Introduction I had a setting similar to the figure below. A single Python process would start up and spawn N children that would receive requests from the network.