All Projects → rolag → Lockfreehashmap Rs

rolag / Lockfreehashmap Rs

Licence: other
A concurrent lock-free hash map for Rust.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Lockfreehashmap Rs

Hashmap
A Golang lock-free thread-safe HashMap optimized for fastest read access.
Stars: ✭ 899 (+5518.75%)
Mutual labels:  hashmap, lock-free
hatrack
Fast, multi-reader, multi-writer, lockless data structures for parallel programming
Stars: ✭ 55 (+243.75%)
Mutual labels:  hashmap, lock-free
Mlib
Library of generic and type safe containers in pure C language (C99 or C11) for a wide collection of container (comparable to the C++ STL).
Stars: ✭ 321 (+1906.25%)
Mutual labels:  hashmap, lock-free
Object threadsafe
We make any object thread-safe and std::shared_mutex 10 times faster to achieve the speed of lock-free algorithms on >85% reads
Stars: ✭ 280 (+1650%)
Mutual labels:  lock-free
Spscqueue
A bounded single-producer single-consumer wait-free and lock-free queue written in C++11
Stars: ✭ 307 (+1818.75%)
Mutual labels:  lock-free
Atomic queue
C++ lockless queue.
Stars: ✭ 373 (+2231.25%)
Mutual labels:  lock-free
Yac
A fast, lock-free, shared memory user data cache for PHP
Stars: ✭ 782 (+4787.5%)
Mutual labels:  lock-free
gumble
Collection of high-performance, thread-safe, lock-free data structures for go
Stars: ✭ 12 (-25%)
Mutual labels:  lock-free
Algorithms
CLRS study. Codes are written with golang.
Stars: ✭ 482 (+2912.5%)
Mutual labels:  hashmap
Hashmap
HashMap JavaScript class for Node.js and the browser. The keys can be anything and won't be stringified
Stars: ✭ 363 (+2168.75%)
Mutual labels:  hashmap
Crossbeam
Tools for concurrent programming in Rust
Stars: ✭ 4,180 (+26025%)
Mutual labels:  lock-free
Rustbreak
A simple, fast and easy to use self-contained single file storage for Rust
Stars: ✭ 315 (+1868.75%)
Mutual labels:  hashmap
Tstl
TypeScript-STL (Standard Template Library, migrated from C++)
Stars: ✭ 397 (+2381.25%)
Mutual labels:  hashmap
Concurrencyfreaks
Stars: ✭ 299 (+1768.75%)
Mutual labels:  lock-free
Sled
the champagne of beta embedded databases
Stars: ✭ 5,423 (+33793.75%)
Mutual labels:  lock-free
Smoothiemap
A gulp of low latency Java
Stars: ✭ 255 (+1493.75%)
Mutual labels:  hashmap
Wyhash
The FASTEST QUALITY hash function, random number generators (PRNG) and hash map.
Stars: ✭ 410 (+2462.5%)
Mutual labels:  hashmap
Capsule
The Capsule Hash Trie Collections Library
Stars: ✭ 350 (+2087.5%)
Mutual labels:  hashmap
Bus
Efficient, lock-free, bounded Rust broadcast channel
Stars: ✭ 368 (+2200%)
Mutual labels:  lock-free
Exchange Core
Ultra-fast matching engine written in Java based on LMAX Disruptor, Eclipse Collections, Real Logic Agrona, OpenHFT, LZ4 Java, and Adaptive Radix Trees.
Stars: ✭ 801 (+4906.25%)
Mutual labels:  lock-free

LockFreeHashMap-rs

License Cargo Documentation Continuous Integration

A concurrent, lock-free hash map for Rust.

This is an implementation of the lock-free hash map created by Dr. Cliff Click. Click released a talk about his hash map. Additionally, "reference" Java code is available here and more recently here.

Getting Started

This crate is available on crates.io.

To use this crate in your project, add the following to your Cargo.toml file:

[dependencies]
lockfreehashmap = "0.1"

and then add to your project root file:

extern crate lockfreehashmap;

Example

extern crate lockfreehashmap;
use lockfreehashmap::LockFreeHashMap;

fn main() {
    let map = LockFreeHashMap::<u8, u8>::new();
    let insert_guard = lockfreehashmap::pin();
    for i in 1..4 {
        map.insert(i, i, &insert_guard);
    }
    drop(insert_guard);

    let map = &map;
    lockfreehashmap::scope(|scope| {
        // Spawn multiple threads, e.g. for a server that executes some actions on a loop
        for _ in 0..16 {
            scope.spawn(|| {
                loop {
                    let mut line = String::new();
                    ::std::io::stdin().read_line(&mut line).unwrap();
                    let mut iter = line.split_whitespace();
                    let command: &str = iter.next().unwrap();
                    let key: u8 = iter.next().unwrap().parse().unwrap();
                    let value: u8 = iter.next().unwrap().parse().unwrap();
                    let guard = lockfreehashmap::pin();
                    let _result = match command {
                        "insert" => map.insert(key, value, &guard),
                        _ => unimplemented!(),
                    };
                }
            });
        }
    });
}

Documentation

Documentation is available on docs.rs.

Developer documentation of private types is available here.

Debugging

To use valgrind, add the following lines to the top of the src/lib.rs file.

#![feature(alloc_system, global_allocator, allocator_api)]
extern crate alloc_system;
use alloc_system::System;
#[global_allocator]
static A: System = System;

Then call valgrind --leak-check=full --show-leak-kinds=all ./target/debug/deps/lockfreehashmap-*

License

GNU Lesser General Public License v3.0 or any later version

See LICENSE and LICENSE.LESSER for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].