Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kshk123/hashMap
A concurrent thread-safe hash map implemented in C++
https://github.com/kshk123/hashMap
Last synced: 3 months ago
JSON representation
A concurrent thread-safe hash map implemented in C++
- Host: GitHub
- URL: https://github.com/kshk123/hashMap
- Owner: kshk123
- License: mit
- Created: 2016-11-27T14:27:15.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-05-21T10:04:06.000Z (over 1 year ago)
- Last Synced: 2024-05-02T16:34:59.158Z (6 months ago)
- Language: C++
- Size: 41 KB
- Stars: 135
- Watchers: 14
- Forks: 32
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- AwesomeCppGameDev - hashMap - safe hash map implemented in C++ (C++)
README
# hashMap
A concurrent thread-safe hash map implemented in C++.Anyone can use the hash-map by simply including the header files in the "inc" folder.
Currently, copy and move of the hash is not supported.A "main" is provided to test the basic scenarios of the hashMap.
The hash map is implemented as an array of hash buckets.
Each hash bucket is a single linked list of hash nodes and has a mutex associated with it.
Multiple threads can read from the same bucket simulatenously, but only one thread can write
into the same bucket. Since the mutex is per bucket, if multiple threads try to write into different
buckets simulatenously, they will be allowed to do so.This allows some level of concurrency for the hash map.The mutex is implemented as "std::shared_timed_mutex" from C++14 and uses "std::unique_lock" from C++11 for writes
and "std::shared_lock" from C++14 for reading from a bucket.