O
O
OnYourLips2018-11-14 17:13:55
linux
OnYourLips, 2018-11-14 17:13:55

How to implement inter-process locks/semaphores?

Which IPC to use to lock certain actions in a program running in different processes?
Target OS - Linux, preferably Linux + OS X.
Implementation language - Python, but cross-language locking is desirable, for example PHP + Python.
Google told me about semaphore.h/sem_open.
1. Is it a good choice?
2. A very cursory search showed me that there are no analogues in the languages ​​​​above. Am I wrong?
3. There is sem_get in php, but the first parameter in it is not a string, but a number. Apparently they are not that compatible.
4. Why is it so unpopular? Crutches are constantly used, from the most common - lock files.
5. What should I do if network work is needed? Probably, there is some server with similar functionality.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
OnYourLips, 2018-11-25
@OnYourLips

https://pypi.org/project/posix_ipc/

T
ThunderCat, 2018-11-14
@ThunderCat

Traditionally, processes in lanes use pid files. Nothing more cross-language has yet been invented like. Further, stray ala memkesh, radish and others like them, which are not always sparkling.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question