Coder Social home page Coder Social logo

winmmf-rs's Introduction

Memory-Mapped Files

When working with Windows, there isn't a really ergonomic shm or mmap implementation that lets you share regions of memory across the application boundary easily. Instead the usual ways are calling back to localhost, (Named) Pipes, RPC, or Sockets (including the broken AF_UNIX implementation). None of these are viable for low latency and/or large amounts of data being exchanged however, as they all use the networking stack and some of these don't even support communicating with multiple external processes. And if you don't need a message and sometimes you just need to move more data, or move it faster on the local system, than what these methods allow. Enter Named shared memory, the roundabout way of mapping a named region of memory backed by the pagefile!

This crate exists to support this IPC mechanism in Rust. With the power of microSEH to handle Structured Exception Hissy fits and some well thought out ways to make using this as safe as possible, it should be fine to use. I'm currently working on getting this production ready for some real-world use cases and slowly expanding it to support more architectures. It's very much still a WIP crate though, and as such is not yet available on crates.io at this time.

Supported platforms

This crate only supports Windows. Nothing else uses this mechanic for shared memory to the best of my knowledge and it sounds painful to even test it. If you find it works in other places, let me know and I'll list it!

Architecture OS Supported Notes
x86 Windows Yes Just Works:tm:
x86_64/AMD64 Windows Yes Currently limited to the same ranges and sizes as 32-bit
ARM Windows Maybe? Have not tested this, nor do I have a system to test with
lolwut? ????? No What other architectures does Windows even run on?
* *NIX lolnope No Kernel/OS support for these functions, try wine ๐Ÿ˜‚

Goals

Honestly, I just want a working method of multiplexing a camera feed to a couple applications at the same time. And the biggest issues there are exclusive access and camera startup time and playback delay. But yeah, the goal is to make a stable MMF wrapper that handles the headache of the OS API surrounding it.

License

This crate is brought to you under shared MIT or Apache 2.0 licensing, at your option. Contributions made will share this licensing unless explicitly stated otherwise. When stating other licensing on your work, please ensure it's compatible with the existing licenses. License texts can be found in the MIT License and the Apache 2.0 license files.

winmmf-rs's People

Contributors

rivenskaye avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.