Create a shared memory region in one process, write data, open it from another, read it back.Documentation Index
Fetch the complete documentation index at: https://mine-27913f41.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Step 1: Create a writer
The writer process creates a shared region, writes a float value, and notifies any waiters.Step 2: Create a reader
Run this in a separate terminal window while the writer is running.Step 3: Verify
Run the writer first. Then run the reader in a separate terminal. The reader prints42.0. Same value the writer wrote, same physical memory. No serialization, no socket, no file I/O.
What happened
- The writer called
zinc_create("my-data", 4096), which calledshm_openwithO_CREAT | O_EXCL, thenftruncateto set the size, thenmmapto map it. - The reader called
zinc_open("my-data"), which calledshm_openwithoutO_CREAT, thenmmapto map the same pages. - Both processes now have the same physical RAM pages in their address space.
- The writer wrote
42.0to the first 4 bytes. The reader read those same bytes. - The transfer cost was zero. There was nothing to transfer.
Next steps
- Read about core concepts to understand the ownership model, naming rules, and lifecycle.
- See the notify/wait guide for synchronization between processes.
- Browse the language adapter reference for your language.
