we are currently designing a multithreaded server application.

To optimize performance, we decided to implement a ReadWriteLock, i.e. multiple threads can get a lock if they only want to read but just one thread may hold the write lock.

This lock is used with a list and iterating over the list is the "read" operation.

Now this change from simple mutex did in fact increase performance but only to a certain amout of concurrency. If there are more threads, the ones who wait for the write lock, starve because before an iterator unlocks, another iterator often already locks.

Any ideas / default approach to provide more fairness to the threads wanting to change the list while still getting a better performance?