Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

License

NotificationsYou must be signed in to change notification settings

odygrd/lockfree_queues

Repository files navigation


Introduction

This repository is dedicated to providing a collection of lock-free queues in C++.

In the realm of concurrent programming, there are numerous ways to implement these queues, and several otherrepositories exist as well.

The goal is to rework various queue types while focusing on making a handful of themefficient, thoroughly tested, and benchmarked.

SPBroadcastQueue

The SPBroadcastQueue is a versatile queue that can function as both a Single-Producer, Single-Consumer (SPSC) queue anda Single-Producer, Multiple-Consumer (SPMC) queue, depending on the template arguments provided.

It can handle both simple and more complex data types, ensuring that the producer takes care of creating and destroyingobjects in the queue. The producer synchronizes with consumers and waits for the slowest one when the queue is full.

To use this queue, consumers need to firstsubscribe to it, and then they can start consuming messages.Importantly, all consumers will see all the messages in the queue.

In addition, special attention has been given to optimizing the queue to avoid performance bottlenecks,such as false sharing and cache issues. This optimization leads to increased throughput, especially when the number ofconsumers grows.

Performance

Throughput benchmark measures throughput between two threads for a queue of2 * size_t items.

Latency benchmark measures round trip time between two threads communicating using two queues of2 * size_t items.

For the most accurate benchmark results, it is recommended to run the benchmarks in your own local environment.

QueueThroughput (ops/ms)Latency RTT (ns)
SPBroadcastQueue 1 consumer436402270
SPBroadcastQueue 4 consumers160785-

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp