As the description of XPC says that it can be used for inter process communication mechanism, what exactly the inter process means?
Can it be used to create shared memory between any type of processes (ex. Swift Process (App) and any other language process) or it is for strictly App to App (swift to swift) communication?
macOS supports a variety of Unix-y shared memory APIs, including mmap
, POSIX shared memory (see the shm_open
man page), and System V shared memory (see the shmget
man page).
IMPORTANT macOS’s support for System V IPC is intended for compatibility only. If you’re writing new code, avoid that API.
The only thing to watch out for here is that the App Sandbox can restrict all forms of IPC, including shared memory. Whether that’s a concern depends on your specific circumstances. Which brings us to …
is there code reference available for this?
Can your post a quick summary of your architecture? What sort of product are you developing? An app? A daemon? Something more complex?
For shared memory to make sure you must have two different processes. What contexts are those processes running in?
IMPORTANT Execution context is really important on macOS because there are significant differences between it and other Unix-y platforms. See Technote 2083 Daemons and Agents for an in-depth explanation of that.
And any other requirements? Do you have existing shared memory code that you plan to reuse?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"