Giter Club home page Giter Club logo

fastpub's Introduction

FastPub

Zero-copy non-blocking shared memory publisher/subscriber IPC library

This is the result of me needing a shared memory publisher-subscriber protocol that would not have any copying overhead at all. The protocol is conceptually pretty simple, and I hope to improve the interface a lot in the future.

The protocol's core algorithm is essentially an extension of triple buffering, with the addition of multiple readers. The writer writes to one buffer, while a "current" buffer is always available for readers to grab. When all readers release a buffer that is not current, it falls into a "slack" pool, where the writer can grab it when it needs to produce a new buffer. As long as there are n + 2 total buffers, where n is the number of readers, the writer will always have at least one slack buffer available and the readers will always have the current buffer to grab, so neither side will ever block. For the trivial case of one reader, this is exactly triple buffering.

The buffers are all preallocated and stay in the shared memory region, and are also never copied, which means that this algorithm should have pretty close to optimal performance for just moving buffers of data between processes. The strict no-blocking guarantee makes it suitable for soft realtime applications, like realtime computer vision and robot control (which is the original intended purpose). Of course, it will readily (but safely) drop buffers that are not picked up by subscribers, and will only provide the most recent update at any one time, so it is not a general-purpose IPC mechanism by any means.

fastpub's People

Contributors

nickbjohnson4224 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.