STM hash library for C (glib?)

I am looking for some C library that includes STM-style hash maps (Software Transactional Memory), but so far I have no luck. It would be great if it were based on glib / gobject, but this is not so important. It also does not need the correct transactions on many objects - the only constant hash support is all I really need.

Must have: an immutable picture, read without blocking, with automatic repeat.

+6
c hash stm
source share
3 answers

Wikipedia has a list of various STM implementations .

+4
source share

Well, I think (and there are some studies) that the current STM is not faster than the lock and mutex code. This is obvious: STM requires online data verification. However, such conflict checking in pure software is very time-consuming. Currently, only the Sun ROCK processor supports the limited form of STM (Best-effort HTM with STM) through hardware. No x86 processors currently support TM in hardware. In short, STM is slow.

In my opinion, you'd better just use a parallel hash table. For example, you can find concurrent_hash_map in Intel TBB. Here is the TBB Guide link. Oh, but this is C ++, not C. But I suppose you can (although it can take a lot of work) translate such a hash table from C ++ to C code. Intel TBB is open source.

In addition, I think that such highly competitive (usually implemented as blocking) data structures are not always useful. In some workload templates, the use of such data structures is not good. Of course, I recommend you write a small micro-test for two versions of the hash tables: (1) without blocking and (2) blocking. Also, remember that workload patterns for such a micro benchmark should be close to real. An example can be found in here .

+3
source share

TBoost.STM implemented a hash map in its example.

0
source share

All Articles