When solving the problem of reader writing, I try to use it ReentrantReadWriteLock. I know that all readers can get a read lock at the same time, however a write lock must wait until all read locks are released. Will this be the reason that the writer will be in a state of starvation if we have many readers?
ReentrantReadWriteLock
ReentrantReadWriteLock can be built using an equity policy. If the flag is true, then there will be no starvation, however if it is false, perhaps it may be.