cs_libguarded VS parking_lot

Compare cs_libguarded vs parking_lot and see what are their differences.

cs_libguarded

Header-only library for multithreaded programming (by copperspice)

parking_lot

Compact and efficient synchronization primitives for Rust. Also provides an API for creating custom synchronization primitives. (by Amanieu)
Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
cs_libguarded parking_lot
10 7
218 2,532
0.0% -
5.0 7.2
about 1 month ago 3 days ago
C++ Rust
GNU General Public License v3.0 or later Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

cs_libguarded

Posts with mentions or reviews of cs_libguarded. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-04-06.

parking_lot

Posts with mentions or reviews of parking_lot. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-07-27.
  • How fair should an unfair mutex be?
    1 project | /r/rust | 27 Aug 2023
    Recently I've been developing my own mutex using a lot of inspiration from the excellent parking_lot crate. The mutex in parking_lot is eventually fair in that it occasionally does a fair unlock to ensure threads aren't completely starved.
  • Which Mutex to use in this case (independent tasks, partially under contention)
    3 projects | /r/rust | 27 Jul 2022
    parking_lot still has an open issue #201: Heavily degraded performance while in extreme contention on some processors which reveals that parking_lot selfishly uses spinning locks under some circumstances to sacriice total system efficiency in the name of trying to improve its own latency. In my opinion, the only place spinning locks are excusable is fullscreen games and, even then, Linus Torvalds is of the opinion they're usually implemented wrong. (Issue 201 also includes a bunch of benchmark runs if you want to read through to figure out which one applies to the current shipping state of the codebase.)
  • Why Rust mutexes look like they do
    2 projects | /r/rust | 2 Apr 2022
    I think there was at some point the plan to make it the std implementation. However, cross platform support was kinda tricky if I remember link to an issue. I tend to suggest to always first prototype with std primitives. Often your bottlenecks are in totally different places. For example, you wait on some data C that also waits on data B but this depends on A which is a really slow query to a database.
  • How to call RawRwLock.lock_exclusive() of parking_lot?
    1 project | /r/rust | 9 Mar 2022
  • Parking_lot: Compact and efficient synchronization primitives for Rust
    1 project | news.ycombinator.com | 2 Jul 2021
  • A Firehose of Rust, for busy people who know some C++
    1 project | /r/rust | 1 Jun 2021
    I think the current state-of-the-art in terms of high-performance, general-purpose mutexes is parking_lot. (Which was ported from a C++ project of the same name.) Rather than initializing a new underlying pthread_mutex for every instance of Mutex, it keeps a global collection of thread parking queues somewhere, which turns out to be more efficient in various ways. An individual parking_lot::Mutex doesn't require a heap allocation, and is just 1 byte in size (plus the size of T).
  • Eliminating Data Races in C++ and Rust with Thread Sanitizer in Firefox – A Technical Report
    2 projects | /r/rust | 7 Apr 2021
    The first was bug 1674770, which was a bug in the parking_lot library. This Rust library provides synchronization primitives and other concurrency tools and is written and maintained by experts. We did not investigate the impact but the issue was a couple atomic orderings being too weak and was fixed quickly by the authors. This is yet another example that proves how difficult it is to write bug-free concurrent code.

What are some alternatives?

When comparing cs_libguarded and parking_lot you can also consider the following projects:

ultimatepp - U++ is a C++ cross-platform rapid application development framework focused on programmer's productivity. It includes a set of libraries (GUI, SQL, Network etc.), and integrated development environment (TheIDE).

concurrencpp - Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all

concurrent-resource - A header-only C++ library that allows easily creating thread-safe, concurrency friendly resources.

Folly - An open-source C++ library developed and used at Facebook.

lock_ios - iostream synchronization manipulator for concurrency

ThreadSafeVar - Simple wrapper to create thread safe variable with a mutex.

freertos-addons - Additions to FreeRTOS

rwspinlock - Slim, simple, cross-process, reader-writer unfair fast spin lock for Windows