shared-memory

How are windows DLL actually shared?

感情迁移 提交于 2019-12-21 16:18:16
问题 By examing several DLLs I have in my windows machine (for instance KERNEL32.DLL) I've notice that none of their sections, not even the read only data section have the IMAGE_SCN_MEM_SHARED flag set. DLLs are mapped from the .dll file so only when you read a page of the file it is copied to physical memory but still, if the same page of let's say kernel32.dll is accessed by both process A and process B then the page will exist twice in physical memory. I am asking for the veracity of this last

Share memory areas between celery workers on one machine

十年热恋 提交于 2019-12-21 12:06:30
问题 I want to share small pieces of informations between my worker nodes (for example cached authorization tokens, statistics, ...) in celery. If I create a global inside my tasks-file it's unique per worker (My workers are processes and have a life-time of 1 task/execution). What is the best practice? Should I save the state externally (DB), create an old-fashioned shared memory (could be difficult because of the different pool implementations in celery)? Thanks in advance! 回答1: I finally found

jemalloc, mmap and shared memory?

落爺英雄遲暮 提交于 2019-12-21 07:44:02
问题 Can jemalloc be modified to allocate from shared memory? The FreeBSD function dallocx() implies you can provide a pointer to use for allocation, but I don't see an obvious way to tell jemalloc to restrict all allocations from that memory (nor set a size, etc). The dallocx() function causes the memory referenced by ptr to be made available for future allocations. If not, what is the level of effort for such a feature? I'm struggling to find an off-the-shelf allocation scheme that can allocate

How to atomically update a counter shared between Docker instances

会有一股神秘感。 提交于 2019-12-21 07:17:17
问题 I have a simple C++ service (API endpoint) that increases a counter every time the API is called. When the caller posts data to http://10.0.0.1/add the counter has to be incremented by 1 and return the value of the counter to the caller. Things get more complicated when the service is getting dockerized. When two instances of the same service run the addition has to be done atomically, ie the counter value is stored in a database and each docker instance has to acquire a lock get the old

How to atomically update a counter shared between Docker instances

最后都变了- 提交于 2019-12-21 07:17:02
问题 I have a simple C++ service (API endpoint) that increases a counter every time the API is called. When the caller posts data to http://10.0.0.1/add the counter has to be incremented by 1 and return the value of the counter to the caller. Things get more complicated when the service is getting dockerized. When two instances of the same service run the addition has to be done atomically, ie the counter value is stored in a database and each docker instance has to acquire a lock get the old

accessing shared variable from inside a Runnable class

喜欢而已 提交于 2019-12-21 04:56:09
问题 I need to define a shared variable in my Main class's main() method. I need two threads to be able to access that shared variable. Im creating the threads by implementing the Runnable interface and implementing the abstract run() method of the interface. How do i refer to the shared variable defined in the Main class's main() method from within the run() method defined in my class that implements the Runnable interface? Obviously just calling them by name is not working - as they appear out

Resource cleanup on abnormal process termination

前提是你 提交于 2019-12-21 04:28:14
问题 My question is, when a process terminates abnormally (via a signal, it could be SIGKILL so we can't intercept it), is there any guaranteed order or atomicity in which its resources are released? In particular, i m interested in file locks and shared memory. For example: 1) If the process is holding locks on 2 files and terminates abnormally, is it at all possible that another process trying to lock the same files sees one file being locked and another being unlocked? Or is the process of

Can I pass an object to another process just passing its' pointer to a shared memory?

给你一囗甜甜゛ 提交于 2019-12-21 04:12:52
问题 I have a very complicated class(it has unordered_map and so on on inside it) and I want to share an object of it withit two my processes. Can I simply pass just a pointer to it from one process to another? I think, no, but hope to hear "Yes!". If "no", I'd be grateful to see any links how to cope in such cases. I need to have only one instance of this object for all processes because it's very large and all of the processes will work woth it for read only. 回答1: No, process do not ( naturally

How to choose a fixed address for shared memory mapping

纵然是瞬间 提交于 2019-12-21 03:52:46
问题 I would like to use shared memory between several processes, and would like to be able to keep using raw pointers (and stl containers). For this purpose, I am using shared memory mapped at a fixed address : segment = new boost::interprocess::managed_shared_memory( boost::interprocess::open_or_create, "MySegmentName", 1048576, // alloc size (void *)0x400000000LL // fixed address ); What is a good strategy for choosing this fixed address? For example, should I just use a pretty high number to

Process communication of Python's Multiprocessing

半世苍凉 提交于 2019-12-20 22:00:08
问题 I've learned about Python multiprocess's Pipes/Queues/Shared ctypes Objects/Managers, and I want to compare them with Linux's anonymous pipes, named pipes, shared memory, socket, and so on. I now have the following questions The pipes and queue modules of Python's multiprocessing are based on anonymous pipes. Does it provide named pipes? Does Python multiprocessing.sharedctypes support independent process communication? I think it only supports father and child process or brotherly process