Imagine that you are developing a multi-threaded application which proceeds concurrently many read and write requests on a shared data structure. Your goal is to speed up the application and achieve processing of 50k write operations per second and as much read operations as possible.
Steps
git clone https://gitlab.fel.cvut.cz/matejjoe/list_mutex.git
make
in list_mutex directory)
./list_mutex <number or reader threads>
) and see how slow the program is
The rwlock is part of pthread library. You could be interested in:
The liburcu should work on Linux, Cygwin and MacOS X. You can obtain liburcu from distribution repository or compile yourself. I would recommend you compiling the library because libraries in repositories are usually a bit old. In order to compile and use library do following:
wget --no-check-certificate http://www.lttng.org/files/urcu/userspace-rcu-latest-0.10.tar.bz2
tar -xjf userspace-rcu-latest-0.10.tar.bz2
cd userspace-rcu-0.10.1/
./configure --prefix=/home/me/somefolder/mybuild/output/target
make -j8
make install
-lurcu
or other rcu flavour into $LIBS
(before -lpthread
)
-I/home/me/somefolder/mybuild/output/target/include
into $INCLUDES
-L/home/me/somefolder/mybuild/output/target/lib
into $LFLAGS