How a read write lock enabled resource (collection) know which are all are read threads and which all are write threads ?
The collection doesn't know or care if a thread is all read or all write operations. All it knows is which of its own methods are read methods and which of its own methods are write methods. It then protects its own methods with an appropriate lock. So a thread that does all reads will only get read locks, a thread which does all writes gets only write locks, and a thread which reads sometimes and which writes other times will get a read lock when it reads and a write lock when it writes.