{"id":25830349,"url":"https://github.com/pjsny/macos-zero-copy-ipc","last_synced_at":"2025-02-28T19:14:32.412Z","repository":{"id":279549790,"uuid":"939178114","full_name":"pjsny/macos-zero-copy-ipc","owner":"pjsny","description":"Fast zero-copy IPC for macOS using POSIX shared memory (not XPC) with examples","archived":false,"fork":false,"pushed_at":"2025-02-26T06:25:50.000Z","size":0,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T06:29:19.810Z","etag":null,"topics":["c","interprocess-communication","ipc","macos","memory-mapping","mmap","performance","posix","posix-shm","shared-memory","zero-copy"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pjsny.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-26T05:49:54.000Z","updated_at":"2025-02-26T06:25:53.000Z","dependencies_parsed_at":"2025-02-26T06:29:27.269Z","dependency_job_id":"e5e14d3a-7be4-4870-8f48-1f683821406b","html_url":"https://github.com/pjsny/macos-zero-copy-ipc","commit_stats":null,"previous_names":["pjsny/macos-zero-copy-ipc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjsny%2Fmacos-zero-copy-ipc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjsny%2Fmacos-zero-copy-ipc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjsny%2Fmacos-zero-copy-ipc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjsny%2Fmacos-zero-copy-ipc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pjsny","download_url":"https://codeload.github.com/pjsny/macos-zero-copy-ipc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241209527,"owners_count":19927734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","interprocess-communication","ipc","macos","memory-mapping","mmap","performance","posix","posix-shm","shared-memory","zero-copy"],"created_at":"2025-02-28T19:14:31.854Z","updated_at":"2025-02-28T19:14:32.404Z","avatar_url":"https://github.com/pjsny.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# macOS Zero-Copy IPC\n\nA collection of examples demonstrating zero-copy shared memory communication between processes on macOS.\n\n## Overview\n\nThis repository contains examples of inter-process communication using zero-copy shared memory on macOS. The examples demonstrate different approaches to shared memory:\n\n- POSIX shared memory (shm_open) with memory mapping\n- Memory-mapped files (mmap) for persistent storage\n- Lock-free synchronization with atomic operations\n- SIMD-accelerated processing with Apple Silicon optimizations\n\nEach approach has different performance characteristics and use cases.\n\n## Examples\n\n### 1. Countdown\n\nA simple demonstration where one process counts down from 10 to 0, sending each number to another process that processes it. Uses POSIX shared memory (shm_open) and semaphores for synchronization.\n\n### 2. Buffer Transfer\n\nAn example of continuous data streaming between processes. One process generates random X,Y coordinates and the other displays them in real-time. Uses POSIX shared memory (shm_open) and semaphores for synchronization.\n\n### 3. Lock-Free Ring Buffer\n\nA high-performance lock-free ring buffer implementation using atomic operations for thread-safe communication without mutexes. Demonstrates efficient producer-consumer pattern with non-blocking I/O. Uses POSIX shared memory (shm_open) but replaces semaphores with atomic operations.\n\n### 4. Memory-Mapped File Database\n\nA persistent shared memory example using memory-mapped files (mmap) with regular files. Demonstrates how to create a simple database that persists between program executions and can be accessed by multiple processes simultaneously. Uses pthread mutexes for synchronization.\n\n### 5. SIMD-Accelerated Processing\n\nA high-performance example optimized for Apple Silicon (M-series) processors. Uses SIMD vector instructions (ARM NEON) to process data in parallel, huge pages for better TLB efficiency, and cache-line alignment to prevent false sharing. Demonstrates how to achieve maximum performance on modern hardware.\n\n### 6. SIMD vs Standard Processing Benchmark\n\nA benchmark comparing standard buffer processing against SIMD-accelerated processing.\n\n## Cloning the Repository\n\nThis repository uses Git submodules for external dependencies. To clone the repository with all submodules:\n\n```bash\n# Clone the repository with submodules\ngit clone --recursive https://github.com/pjsny/macos-zero-copy-ipc.git\n\n# Or if you already cloned without --recursive:\ngit submodule init\ngit submodule update\n```\n\n## Building\n\n```bash\n# Build all examples\nmake\n\n# Build a specific example\nmake countdown\nmake buffer_transfer\nmake ring_buffer\nmake mmap_file\nmake simd_processing\nmake benchmark_simd\n```\n\n## Credits\n\nThe SIMD-Accelerated Processing example uses the [math_intrinsics](https://github.com/Geolm/math_intrinsics) library by Geolm for efficient SIMD math operations. This excellent library provides transcendental math functions (cos, sin, acos, etc.) implemented using 100% AVX/Neon instructions with no branching.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjsny%2Fmacos-zero-copy-ipc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpjsny%2Fmacos-zero-copy-ipc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjsny%2Fmacos-zero-copy-ipc/lists"}