When can I use Un-named shared memory?

When did you decide to use unnamed shared memory in windows?

It seems to me that the message passing between the threads is not very useful. Instead, you can pass a pointer to a structure / variable to the worker threads and use it as shared memory instead, rather than calling the CreateFileMapping system call.

+3
source share
3 answers

One of the reasons for using unnamed shared memory is to restrict access to file associations only to those processes that create using the descriptor. This avoids two problems:

  • , , , - .
  • , .

, , , , . MSDN CreateFileMapping:

, .

+3

(, " " ) . - -, . ( " " ) , .

+3

. !

Look at the call DuplicateHandlethat you can use to pass descriptors to unnamed objects across process boundaries.

+3
source

Source: https://habr.com/ru/post/1775599/


All Articles