Search
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
./list_mutex <number or reader threads>
The rwlock is part of pthread library. You could be interested in:
This part should be quite straightforward. In short, replace all pthread_mutex_lock/unlock, and update initialization. Variables (also structures) in C created on the stack (e.g. local variables) are initialized by random values, therefore, make sure that you initialize any created structure before use.
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.2/
./configure --prefix=/home/me/somefolder/mybuild/output/target
make -j8
make install
-lurcu
$LIBS
-lpthread
-I/home/me/somefolder/mybuild/output/target/include
$INCLUDES
-L/home/me/somefolder/mybuild/output/target/lib
$LFLAGS
Which steps should I do?
Article about threads and various types of locks
Article about Userspace RCU library
User-Level Implementations of Read-Copy Update