It recent past many network device vendors are moving their applications to user space for multiple reasons. Some of the reasons are:
- Easy maintenance.
- Applications are becoming complex and Linux user space has many more debugging tools compared to Linux user space.
- Many library utilities are available for complex networking applications (Example: PCRE libary, openSSL library, XML libraries, Compression libraries etc..
Fortunately, there is one user space RCU library. One can download it from here.
There is one good presentation comparing the performance with read/write mutexes and different types of RCU implementation. Please find it here.
I, personally like QSBR approach. It has very good 'read' and 'update' performance. I believe RCU DEFER with QSBR would be even better.
Usage is simple and similar to Kernel space RCU:
Read Side:
- rcu_read_lock
- critical section of the code. (Typically searching for matching node from data structures such as linked lists, hash lists etc...)
- rcu_read_unlock.
- Thread specific Mutex Lock (outside of RCUs) : This is required to protect multiple threads doing the add/delete operations simultaneously).
- Critical section of the code. (which removes the node from the data structures such as linked list or adds a new node to the data structure)
- Thread specific Mutex Unlock
- synchronize_rcu()
- Free the node (if it is delete operation)
- Thread specific Mutex Lock (outside of RCUs) :
- Critical section of the code. (
- Thread specific Mutex Unlock
- defer_rcu(Freefnptr, node that was removed)
- FreeFnPtr would get called at later point of time. This function would free the node that was passed to it.
It appears that even without the 'defer' mechanism, QSBR read performance is 1000 times more than pthread read/write lock and QSBR update performance is at least 15 times better than pthread read/write locks.
I hope that it would get into Linux distribution soon.
No comments:
Post a Comment