{"id":25036572,"url":"https://github.com/diwic/shmem-ipc","last_synced_at":"2025-04-07T16:19:10.023Z","repository":{"id":37721031,"uuid":"336963790","full_name":"diwic/shmem-ipc","owner":"diwic","description":"Untrusted IPC with maximum performance and minimum latency. On Rust, on Linux.","archived":false,"fork":false,"pushed_at":"2022-11-22T10:30:45.000Z","size":58,"stargazers_count":144,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T14:13:31.391Z","etag":null,"topics":["communication","linux","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/diwic.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}},"created_at":"2021-02-08T04:52:10.000Z","updated_at":"2025-03-24T00:22:17.000Z","dependencies_parsed_at":"2022-09-02T15:01:19.966Z","dependency_job_id":null,"html_url":"https://github.com/diwic/shmem-ipc","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diwic%2Fshmem-ipc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diwic%2Fshmem-ipc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diwic%2Fshmem-ipc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diwic%2Fshmem-ipc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diwic","download_url":"https://codeload.github.com/diwic/shmem-ipc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685634,"owners_count":20979085,"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":["communication","linux","rust"],"created_at":"2025-02-06T00:05:04.597Z","updated_at":"2025-04-07T16:19:10.000Z","avatar_url":"https://github.com/diwic.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![crates.io](https://img.shields.io/crates/v/shmem-ipc.svg)](https://crates.io/crates/shmem-ipc)\n[![API documentation](https://docs.rs/shmem-ipc/badge.svg)](https://docs.rs/shmem-ipc)\n[![license](https://img.shields.io/crates/l/shmem-ipc.svg)](https://crates.io/crates/shmem-ipc)\n\nUntrusted IPC with maximum performance and minimum latency. On Rust, on Linux.\n\nWhen is this Rust crate useful?\n--------------------------\n\n * Performance or latency is crucial, and\n * you run Linux.\n\nA typical use case could be audio/video streaming.\n\nDon't need maximum performance and minimum latency, and want a higher level protocol\nwith serialization and lots of bells and whistles built-in? Try [D-Bus](https://docs.rs/dbus/).\n\nAlso, a [unix socket](https://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html)\nis easier to set up and is not that much slower (see benchmark below).\n\nAs for Linux, this crate uses memfd sealing to ensure safety between untrusted processes,\nand ringbuffer signaling is done using eventfd for best performance.\nThese two features are Linux only.\n\nGetting started\n---------------\n\nYou probably want to start in the `sharedring` module, which sets up a ringbuffer\nbetween untrusted processes (it's a wait-free/lock-free, bounded, SPSC queue).\nAnother useful function is `mem::write_once` for a scenario where\nyou write data once and make it available for reading afterwards. The `mem` and `ringbuf`\nmodules contain building blocks that might be useful in other use cases.\n\nThe downside of using memfd based shared memory is that you need to set it up\nby transferring file descriptors, using some other way of communication.\nUsing [D-Bus](https://docs.rs/dbus/) would be the standard way of doing that -\nit's also possible using [unix sockets](https://crates.io/crates/uds).\n\nThere is also a client/server example in the `examples` directory that can help you get started.\nEnjoy!\n\nBenchmark\n---------\n\n[![Sharedring vs unix sockets vs D-Bus](https://github.com/diwic/shmem-ipc/blob/master/lines.svg)](https://github.com/diwic/shmem-ipc/blob/master/lines.svg)\nNotice the log scale: for a 64K packet, sharedring is a three times faster than unix sockets,\nand 60 times faster than D-Bus. (D-Bus is a higher level protocol, so that comparison\nis to some degree comparing apples and oranges.)\n\nLicense\n-------\n\nThe code is Apache 2.0 / MIT dual licensed. Any code submitted in Pull Requests, discussions or\nissues is assumed to have this license, unless explicitly stated otherwise.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiwic%2Fshmem-ipc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiwic%2Fshmem-ipc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiwic%2Fshmem-ipc/lists"}